Skip to content

Instantly share code, notes, and snippets.

@nikhilgeo
Last active April 29, 2020 07:30
Show Gist options
  • Save nikhilgeo/cf07c586dba4b76856bf0b2a2abdf3c0 to your computer and use it in GitHub Desktop.
Save nikhilgeo/cf07c586dba4b76856bf0b2a2abdf3c0 to your computer and use it in GitHub Desktop.
Commands Hand books

Linux

safe search for text in all files e.g search for clean_up( in all the files recursive.

$ grep -nre clean_up\( --exclude-dir={proc,dev,lib,sys}

search for file and don't get into other filesystems

$ find . -xdev -name file_name*

Docker

Run a docker container and get bash

$ docker run -it ubuntu:18.04 bash

Get shell of a running container

$ docker exec -it [container-name/id] bash

Remove all the container images

$ docker rmi -f $(docker images -a -q)

Stop and remove all containers

$ docker stop $(docker ps -a -q)
$ docker rm $(docker ps -a -q)

list all the containers

$ docker container ls -a

Delete container

$ docker rm -v containername
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment