Skip to content

Instantly share code, notes, and snippets.

@rcmorano
Last active November 24, 2021 16:37
Show Gist options
  • Save rcmorano/5056366 to your computer and use it in GitHub Desktop.
Save rcmorano/5056366 to your computer and use it in GitHub Desktop.
'.bash_aliases' useful bits (recopilation)
# do not check certs when connecting thru ssh NOTE: you shouldn't use it as default
alias ssh-no-check='ssh -o StrictHostKeyChecking=no'
# 'ps' that shows cgroupped processes
#
# check url for more info: http://0pointer.de/blog/projects/systemd-for-admins-2.html
#
alias psc='ps xawf -eo pid,user,cgroup,args'
# docker
alias docker-container-most-recent='docker ps| grep -v ^CONTAINER | head -n1 | awk "{print \$1}"'
alias docker-container-diff-most-recent='LAST_CONTAINER=$(docker-container-most-recent); if [ ! -z "$LAST_CONTAINER" ]; then docker diff $LAST_CONTAINER; else echo "There are no running containers!"; fi'
alias docker-container-inspect-most-recent='LAST_CONTAINER=$(docker-container-most-recent); if [ ! -z "$LAST_CONTAINER" ]; then docker inspect $LAST_CONTAINER; else echo "There are no running containers!"; fi'
alias docker-container-remove-all='docker ps -a | grep -v ^CONTAINER|awk "{print \$1}" | xargs -I % sh -c "docker kill %; docker rm %"'
alias docker-container-remove-all-non-running='docker ps -a | grep -v ^CONTAINER | grep Exit | awk "{print \$1}" | xargs -I % sh -c "docker kill %; docker rm %"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment