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.

Revisions

  1. nikhilgeo renamed this gist Apr 29, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. nikhilgeo revised this gist Apr 29, 2020. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions CommandsHandbook.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,14 @@
    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}```
    ```
    $ 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*```
    ```
    $ find . -xdev -name file_name*
    ```


    Docker
  3. nikhilgeo revised this gist Apr 29, 2020. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions CommandsHandbook.md
    Original file line number Diff line number Diff line change
    @@ -1,29 +1,41 @@
    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}
    ```$ 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*
    ```$ 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
    ```
    $ docker rm -v containername
    ```
  4. nikhilgeo renamed this gist Apr 29, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion gistfile1.txt → CommandsHandbook.md
    Original file line number Diff line number Diff line change
    @@ -23,4 +23,7 @@ $ docker stop $(docker ps -a -q)
    $ docker rm $(docker ps -a -q)

    >> list all the containers
    $ docker container ls -a
    $ docker container ls -a

    >> Delete container
    $ docker rm -v containername
  5. nikhilgeo revised this gist Dec 11, 2019. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,9 @@ 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)

  6. nikhilgeo revised this gist Dec 11, 2019. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,12 @@ Docker
    >> Run a docker container and get bash
    $ docker run -it ubuntu:18.04 bash

    >> Remove all the container images - Ubuntu
    >> 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
  7. nikhilgeo revised this gist Dec 11, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,7 @@ Docker
    $ docker run -it ubuntu:18.04 bash

    >> Remove all the container images - Ubuntu
    $ docker rmi -f $(docker images -a -q)
    $ docker rmi -f $(docker images -a -q)

    >> list all the containers
    $ docker container ls -a
  8. nikhilgeo revised this gist Dec 4, 2019. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,9 @@ 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
    ------
  9. nikhilgeo revised this gist Dec 4, 2019. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,13 @@
    Run a docker container and get bash
    docker run -it ubuntu:18.04 bash
    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}

    Remove all the container images - Ubuntu
    docker rmi -f $(docker images -a -q)

    Docker
    ------
    >> Run a docker container and get bash
    $ docker run -it ubuntu:18.04 bash

    >> Remove all the container images - Ubuntu
    $ docker rmi -f $(docker images -a -q)
  10. nikhilgeo revised this gist Nov 26, 2019. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,5 @@
    Run a docker container and get bash
    docker run -it ubuntu:18.04 bash

    Remove all the container images - Ubuntu
    docker rmi -f $(docker images -a -q)
  11. nikhilgeo created this gist Sep 13, 2019.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    Remove all the container images - Ubuntu
    docker rmi -f $(docker images -a -q)