Skip to content

Instantly share code, notes, and snippets.

@skube
Last active August 29, 2015 14:27
Show Gist options
  • Save skube/4e2dc4d83d3e3ec8a02c to your computer and use it in GitHub Desktop.
Save skube/4e2dc4d83d3e3ec8a02c to your computer and use it in GitHub Desktop.

Revisions

  1. skube revised this gist Aug 21, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -12,11 +12,12 @@ Abridged from [Codecademy](https://www.codecademy.com/en/courses/learn-the-comma
    - `rm -r` removes _directories_

    ## Useful Utils
    - `sort` : sorts lines of text alphabetically.
    - `uniq` : filters duplicate, adjacent lines of text.
    - `grep` : searches for a text pattern and outputs it.
    - `sed` : searches for a text pattern, modifies it, and outputs it.
    - `sort` : sorts lines of text alphabetically.
    - `uniq` : filters duplicate, adjacent lines of text.

    ###grep
    `grep` stands for "global regular expression print". It searches files for lines that match a pattern and returns the results. It is also case sensitive. Use `i` option for case insensitive.
    >Find all instances of "Mount" in `mountain.txt' regardless of case
    ```sh
    @@ -27,6 +28,7 @@ $ grep -i Mount mountains.txt
    $ grep -R searchForSomething /path/to/directory
    ```

    ###sed
    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace". Works on each line separately. Use `g` flag to match all instances on line, not just first.
    ```sh
    $ sed 's/snow/rain/g' forests.txt
  2. skube revised this gist Aug 21, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -19,16 +19,16 @@ Abridged from [Codecademy](https://www.codecademy.com/en/courses/learn-the-comma

    `grep` stands for "global regular expression print". It searches files for lines that match a pattern and returns the results. It is also case sensitive. Use `i` option for case insensitive.
    >Find all instances of "Mount" in `mountain.txt' regardless of case
    ```
    ```sh
    $ grep -i Mount mountains.txt
    ```
    > Recursively search (within) files within a directory
    ```
    grep -R searchForSomething /path/to/directory
    ```sh
    $ grep -R searchForSomething /path/to/directory
    ```

    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace". Works on each line separately. Use `g` flag to match all instances on line, not just first.
    ```
    ```sh
    $ sed 's/snow/rain/g' forests.txt
    ```
    ## Putting it all together: Pipes & Redirects
  3. skube revised this gist Aug 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -24,11 +24,11 @@ $ grep -i Mount mountains.txt
    ```
    > Recursively search (within) files within a directory
    ```
    grep -R _search term_ /path/to/directory
    grep -R searchForSomething /path/to/directory
    ```

    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace". Works on each line separately. Use `g` flag to match all instances on line, not just first.
    ```bash
    ```
    $ sed 's/snow/rain/g' forests.txt
    ```
    ## Putting it all together: Pipes & Redirects
  4. skube revised this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #:notebook_with_decorative_cover: Understanding Command Line
    Abridged from [Udemy](https://www.codecademy.com/en/courses/learn-the-command-line)
    Abridged from [Codecademy](https://www.codecademy.com/en/courses/learn-the-command-line)


    ##List
  5. skube revised this gist Aug 21, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #:notebook_with_decorative_cover: Understanding Command Line
    Abridged from [Udemy](https://www.codecademy.com/en/courses/learn-the-command-line)


    ##List
    - `ls -t` orders files and directories by the time they were last modified
  6. skube revised this gist Aug 21, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,10 @@
    ```
    $ grep -i Mount mountains.txt
    ```
    > Recursively search (within) files within a directory
    ```
    grep -R _search term_ /path/to/directory
    ```

    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace". Works on each line separately. Use `g` flag to match all instances on line, not just first.
    ```bash
  7. skube revised this gist Aug 21, 2015. 1 changed file with 14 additions and 6 deletions.
    20 changes: 14 additions & 6 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -3,21 +3,29 @@
    ##List
    - `ls -t` orders files and directories by the time they were last modified

    ##Copy, Move, Rename & Delete##
    ##Copy, Move, Rename & Delete##
    - `cp` copies files
    - `mv` moves and renames files
    - `rm` removes _files_
    - `rm -r` removes _directories_

    ## Pipes & Redirects
    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream
    ## Useful Utils
    - `sort` : sorts lines of text alphabetically.
    - `uniq` : filters duplicate, adjacent lines of text.
    - `grep` : searches for a text pattern and outputs it.
    - `sed` : searches for a text pattern, modifies it, and outputs it.

    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace".
    `grep` stands for "global regular expression print". It searches files for lines that match a pattern and returns the results. It is also case sensitive. Use `i` option for case insensitive.
    >Find all instances of "Mount" in `mountain.txt' regardless of case
    ```
    $ grep -i Mount mountains.txt
    ```

    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace". Works on each line separately. Use `g` flag to match all instances on line, not just first.
    ```bash
    $ sed 's/snow/rain/g' forests.txt
    ```
    ```
    ## Putting it all together: Pipes & Redirects
    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream

  8. skube revised this gist Aug 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@

    ##List
    - `ls -t` orders files and directories by the time they were last modified
    -

    ##Copy, Move, Rename & Delete##
    - `cp` copies files
    - `mv` moves and renames files
    - `rm` removes _files_
    - `rm -r` removes _directories_
    -

    ## Pipes & Redirects
    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream
  9. skube revised this gist Aug 21, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,13 @@

    ##List
    - `ls -t` orders files and directories by the time they were last modified
    ##Copy, Move, Rename & Delete
    -
    ##Copy, Move, Rename & Delete##
    - `cp` copies files
    - `mv` moves and renames files
    - `rm` removes _files_
    - `rm -r` removes _directories_
    -
    ## Pipes & Redirects
    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream
  10. skube revised this gist Aug 21, 2015. No changes.
  11. skube revised this gist Aug 21, 2015. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,15 @@
    #:notebook_with_decorative_cover:Basic Useful Command Line Commands
    #:notebook_with_decorative_cover: Understanding Command Line

    ##List
    - `ls -t` orders files and directories by the time they were last modified
    ##Copy, Move, Rename & Delete
    - `cp` copies files
    - `mv` moves and renames files
    - `rm` removes _files_
    - `rm -r` removes _directories_

    ## Pipes & Redirects
    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream

    - `sort` : sorts lines of text alphabetically.
    - `uniq` : filters duplicate, adjacent lines of text.
    - `grep` : searches for a text pattern and outputs it.
  12. skube revised this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #Basics :boot:
    #:notebook_with_decorative_cover:Basic Useful Command Line Commands
    - `ls -t` orders files and directories by the time they were last modified
    - `cp` copies files
    - `mv` moves and renames files
  13. skube revised this gist Aug 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #Basics :boot:
    - `ls -t` orders files and directories by the time they were last modified
    - `cp` copies files
    - `mv` moves and renames files
    @@ -11,7 +12,7 @@
    - `uniq` : filters duplicate, adjacent lines of text.
    - `grep` : searches for a text pattern and outputs it.
    - `sed` : searches for a text pattern, modifies it, and outputs it.
    -

    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace".
    ```bash
    $ sed 's/snow/rain/g' forests.txt
  14. skube revised this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,6 @@
    - `sed` : searches for a text pattern, modifies it, and outputs it.
    -
    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace".
    ```
    ```bash
    $ sed 's/snow/rain/g' forests.txt
    ```
  15. skube revised this gist Aug 21, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,9 @@
    - `sort` : sorts lines of text alphabetically.
    - `uniq` : filters duplicate, adjacent lines of text.
    - `grep` : searches for a text pattern and outputs it.
    - `sed` : searches for a text pattern, modifies it, and outputs it.
    - `sed` : searches for a text pattern, modifies it, and outputs it.
    -
    `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace".
    ```
    $ sed 's/snow/rain/g' forests.txt
    ```
  16. skube revised this gist Aug 21, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,9 @@
    - `rm -r` removes _directories_

    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream
    - **Redirect** is used to pass output to either a **file** or stream

    - `sort` : sorts lines of text alphabetically.
    - `uniq` : filters duplicate, adjacent lines of text.
    - `grep` : searches for a text pattern and outputs it.
    - `sed` : searches for a text pattern, modifies it, and outputs it.
  17. skube revised this gist Aug 21, 2015. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,8 @@
    - `ls -t` orders files and directories by the time they were last modified
    - `cp` copies files
    `mv` moves and renames files
    `rm` removes _files_
    `rm -r` removes _directories_
    - `mv` moves and renames files
    - `rm` removes _files_
    - `rm -r` removes _directories_

    **Pipe** is used to pass output to another **program** or utility.

    **Redirect** is used to pass output to either a **file** or stream
    - **Pipe** is used to pass output to another **program** or utility.
    - **Redirect** is used to pass output to either a **file** or stream
  18. skube revised this gist Aug 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    `ls -t` orders files and directories by the time they were last modified
    `cp` copies files
    - `ls -t` orders files and directories by the time they were last modified
    - `cp` copies files
    `mv` moves and renames files
    `rm` removes _files_
    `rm -r` removes _directories_
  19. skube revised this gist Aug 21, 2015. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,9 @@
    `ls -t` orders files and directories by the time they were last modified

    `cp` copies files

    `mv` moves and renames files

    `rm` removes _files_

    `rm -r` removes _directories_


    **Pipe** is used to pass output to another **program** or utility.

    **Redirect** is used to pass output to either a **file** or stream
  20. skube revised this gist Aug 21, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,12 @@
    `ls -t` orders files and directories by the time they were last modified

    `cp` copies files

    `mv` moves and renames files

    `rm` removes _files_
    `rm -r` removes *directories*

    `rm -r` removes _directories_


    **Pipe** is used to pass output to another **program** or utility.
  21. skube revised this gist Aug 21, 2015. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,11 @@
    `ls -t` orders files and directories by the time they were last modified

    `cp` copies files
    `mv` moves and renames files
    `rm` removes _files_
    `rm -r` removes *directories*


    **Pipe** is used to pass output to another **program** or utility.
    **Redirect** is used to pass output to either a *file* or stream

    **Redirect** is used to pass output to either a **file** or stream
  22. skube renamed this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion command line.md → command_line_tips.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    **Pipe** is used to pass output to another **program** or utility.
    **Redirect** is used to pass output to either a _file_ or stream
    **Redirect** is used to pass output to either a *file* or stream
  23. skube renamed this gist Aug 21, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  24. skube revised this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion command line
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    **Pipe** is used to pass output to another **program** or utility.
    **Redirect** is used to pass output to either a *file* or stream.
    **Redirect** is used to pass output to either a _file_ or stream
  25. skube created this gist Aug 21, 2015.
    2 changes: 2 additions & 0 deletions command line
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    **Pipe** is used to pass output to another **program** or utility.
    **Redirect** is used to pass output to either a *file* or stream.