Skip to content

Instantly share code, notes, and snippets.

@radavis
Last active February 12, 2018 15:19
Show Gist options
  • Select an option

  • Save radavis/eb19ec95d62a864e1af1 to your computer and use it in GitHub Desktop.

Select an option

Save radavis/eb19ec95d62a864e1af1 to your computer and use it in GitHub Desktop.

Revisions

  1. radavis revised this gist Feb 12, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -238,6 +238,11 @@ scp ~/install.sh user@ip_address:/Users/rd/install.sh
    scp user@ip_address:/Users/rd/Downloads/raspbian.img ~
    ```

    ## Watch a Remote Log
    ```
    ssh [email protected] tail -f /home/ubuntu/shared/logs/production.log
    ```

    ## Change your computer's hostname

    ```
  2. radavis revised this gist Jun 22, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -192,6 +192,13 @@ $ find ~ -iname "time.rb"
    $ find . -type f -name "test.log"
    ```

    ## Find Files Modified between two Dates
    ```
    $ find . -type f -newermt 2017-06-21 ! -newermt 2017-06-22
    ```

    [source](https://stackoverflow.com/a/158235/2675670)

    ## Clean up logfiles in your home directory
    ```
    $ find ~ -iname "*.log" -exec rm {} \;
  3. radavis revised this gist Oct 1, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -188,13 +188,13 @@ $ ag "HTTP POST" --markdown

    ## Searching File Names
    ```
    $ find ~ -name "time.rb"
    $ find ~ -iname "time.rb"
    $ find . -type f -name "test.log"
    ```

    ## Clean up logfiles in your home directory
    ```
    $ find ~ -name "*.log" -exec rm {} \;
    $ find ~ -iname "*.log" -exec rm {} \;
    ```

    ## Searching for Large Files
  4. radavis revised this gist Sep 30, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -55,6 +55,11 @@ $ cp app.rb old-projects/
    $ cp -R old-projects really-old-projects
    ```

    ## Copy with Progress Bar
    ```
    $ rsync -r --progress /folder/to/copy /destination/folder
    ```

    ## Delete Files and Directories `rm`
    ```
    $ rm junk.txt
  5. radavis revised this gist Sep 15, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -241,6 +241,12 @@ ps aux | grep chrome
    renice -n -5 -p pid
    ```

    ## List USB Devices

    ```
    system_profiler SPUSBDataType
    ```

    ## End
    ```
    say 'Thank you'
  6. radavis revised this gist Aug 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -187,7 +187,7 @@ $ find ~ -name "time.rb"
    $ find . -type f -name "test.log"
    ```

    Clean up logfiles in your home directory
    ## Clean up logfiles in your home directory
    ```
    $ find ~ -name "*.log" -exec rm {} \;
    ```
  7. radavis revised this gist Aug 23, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -185,7 +185,11 @@ $ ag "HTTP POST" --markdown
    ```
    $ find ~ -name "time.rb"
    $ find . -type f -name "test.log"
    $ find . -type f -name "test.log" -exec rm {} \;
    ```

    Clean up logfiles in your home directory
    ```
    $ find ~ -name "*.log" -exec rm {} \;
    ```

    ## Searching for Large Files
  8. radavis revised this gist Jul 28, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -177,6 +177,8 @@ way fast
    ```
    $ brew install the_silver_searcher
    $ ag collection_select ~/Dropbox/code
    $ ag --list-file-types
    $ ag "HTTP POST" --markdown
    ```

    ## Searching File Names
  9. radavis revised this gist Jul 13, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,7 @@ $ ./food_trucks.rb
    ```

    ## Environmental Settings and $PATH
    * /usr/local/bin should be first!: `export PATH=/usr/local/bin:$PATH`
    * `/usr/local/bin` should be first when using homebrew!: `export PATH=/usr/local/bin:$PATH`
    * Always append to the end of the $PATH
    * Postres.app: `export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin`
    ```
  10. radavis revised this gist Jul 13, 2015. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Using the OSX Command Line
    # Using the OS X Command Line

    ## Directory Shortcuts
    ```
    @@ -31,6 +31,13 @@ $ mkdir -v code
    $ mkdir -p code/sinatra-app/public code/sinatra-app/views
    ```

    ## Creating Files

    ```
    $ touch notes.md
    $ echo "# Using the OS X Command Line" > cli.md
    ```

    ## Getting Help `--help` and `man`
    ```
    $ ls --help
  11. radavis revised this gist Jul 11, 2015. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -219,6 +219,15 @@ scp user@ip_address:/Users/rd/Downloads/raspbian.img ~
    sudo scutil --set HostName your-new-hostname
    ```

    ## Setting the priority of a running process

    Scale is from +10 (very nice) to -10 (not nice)

    ```
    ps aux | grep chrome
    renice -n -5 -p pid
    ```

    ## End
    ```
    say 'Thank you'
  12. radavis revised this gist Jun 11, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -213,6 +213,12 @@ scp ~/install.sh user@ip_address:/Users/rd/install.sh
    scp user@ip_address:/Users/rd/Downloads/raspbian.img ~
    ```

    ## Change your computer's hostname

    ```
    sudo scutil --set HostName your-new-hostname
    ```

    ## End
    ```
    say 'Thank you'
  13. radavis revised this gist Jun 2, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -179,6 +179,11 @@ $ find . -type f -name "test.log"
    $ find . -type f -name "test.log" -exec rm {} \;
    ```

    ## Searching for Large Files
    ```
    $ find ~ -size +500000 -print
    ```

    ## View Disk Info
    ```
    $ df -H
  14. radavis revised this gist Jun 2, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -163,6 +163,7 @@ $ grep -rn collection_select ~/Dropbox/code
    faster
    ```
    $ brew install ack
    $ ack --bar
    $ ack collection_select ~/Dropbox/code
    ```
    way fast
  15. radavis revised this gist Apr 12, 2015. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -194,6 +194,19 @@ brew install nmap
    sudo nmap -sP 192.168.1.0/24
    ```

    ## Connect via Secure Shell
    ```
    ssh username@ip_address
    ssh [email protected]
    ```

    ## Copy files over SSH with Secure Copy
    ```
    scp source destination
    scp ~/install.sh user@ip_address:/Users/rd/install.sh
    scp user@ip_address:/Users/rd/Downloads/raspbian.img ~
    ```

    ## End
    ```
    say 'Thank you'
  16. radavis revised this gist Apr 10, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -191,7 +191,7 @@ $ cat ~/.ssh/id_rsa.pub | pbcopy
    ## Find Network Devices
    ```
    brew install nmap
    nmap -sP 192.168.1.0/24
    sudo nmap -sP 192.168.1.0/24
    ```

    ## End
  17. radavis revised this gist Apr 1, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -188,6 +188,12 @@ $ df -H
    $ cat ~/.ssh/id_rsa.pub | pbcopy
    ```

    ## Find Network Devices
    ```
    brew install nmap
    nmap -sP 192.168.1.0/24
    ```

    ## End
    ```
    say 'Thank you'
  18. radavis revised this gist Feb 24, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -145,6 +145,11 @@ $ tar -zxvf plans_to_take_over_the_wolrd.tar.gz
    $ tar -xvjf area51_research_documents.tar.gz2
    ```

    ## Zipping a Folder
    ```
    zip -r archive_name.zip folder_to_compress
    ```

    ## Viewing the Contents of a tar.gz File
    ```
    $ tar -tf filename.tar.gz
  19. radavis revised this gist Feb 19, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,8 @@ $ brew install caskroom/cask/brew-cask
    $ brew install wget
    $ brew cask install paintbrush
    $ brew cask install --appdir="/Applications" vlc
    $ brew search wget
    $ brew info p7zip
    ```

    ## Other Useful Commands
  20. radavis revised this gist Jan 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -61,6 +61,7 @@ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/maste
    $ brew install caskroom/cask/brew-cask
    $ brew install wget
    $ brew cask install paintbrush
    $ brew cask install --appdir="/Applications" vlc
    ```

    ## Other Useful Commands
  21. radavis revised this gist Jan 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@
    # Using the Command Line
    # Using the OSX Command Line

    ## Directory Shortcuts
    ```
    ~ - Home Directory
    . - Current Directory
    .. - Enclosing Directory
    / - Root Directory
    ```

    ## Change Directory `cd`
  22. radavis revised this gist Jan 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -53,7 +53,7 @@ $ rm junk.txt
    $ rm -rf really-old-projects
    ```

    ## Install Homebrew and Cask
    ## Install [Homebrew](http://brew.sh/) and [Cask](http://caskroom.io/)
    These two apps allow you to install almost anything from the command line.
    ```
    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  23. radavis revised this gist Jan 21, 2015. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -53,6 +53,15 @@ $ rm junk.txt
    $ rm -rf really-old-projects
    ```

    ## Install Homebrew and Cask
    These two apps allow you to install almost anything from the command line.
    ```
    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    $ brew install caskroom/cask/brew-cask
    $ brew install wget
    $ brew cask install paintbrush
    ```

    ## Other Useful Commands
    ```
    $ echo
  24. radavis revised this gist Jan 21, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -165,6 +165,11 @@ $ find . -type f -name "test.log" -exec rm {} \;
    $ df -H
    ```

    ## Copy Your Public Key to the Clipboard
    ```
    $ cat ~/.ssh/id_rsa.pub | pbcopy
    ```

    ## End
    ```
    say 'Thank you'
  25. radavis revised this gist Jan 9, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -156,6 +156,8 @@ $ ag collection_select ~/Dropbox/code
    ## Searching File Names
    ```
    $ find ~ -name "time.rb"
    $ find . -type f -name "test.log"
    $ find . -type f -name "test.log" -exec rm {} \;
    ```

    ## View Disk Info
  26. radavis revised this gist Jan 7, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,7 @@ ls: illegal option -- -
    usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
    $ man --help
    $ man ls
    $ info ls
    ```

    ## Moving and Copying `mv` and `cp`
  27. radavis revised this gist Jan 6, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cli.md
    Original file line number Diff line number Diff line change
    @@ -157,6 +157,11 @@ $ ag collection_select ~/Dropbox/code
    $ find ~ -name "time.rb"
    ```

    ## View Disk Info
    ```
    $ df -H
    ```

    ## End
    ```
    say 'Thank you'
  28. radavis revised this gist Dec 31, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -152,7 +152,7 @@ $ brew install the_silver_searcher
    $ ag collection_select ~/Dropbox/code
    ```

    # Searching File Names
    ## Searching File Names
    ```
    $ find ~ -name "time.rb"
    ```
  29. radavis revised this gist Dec 31, 2014. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -136,7 +136,7 @@ $ tar -xvjf area51_research_documents.tar.gz2
    $ tar -tf filename.tar.gz
    ```

    ## Searching Files
    ## Searching File Contents
    slooooooow
    ```
    $ grep -rn collection_select ~/Dropbox/code
    @@ -152,6 +152,11 @@ $ brew install the_silver_searcher
    $ ag collection_select ~/Dropbox/code
    ```

    # Searching File Names
    ```
    $ find ~ -name "time.rb"
    ```

    ## End
    ```
    say 'Thank you'
  30. radavis revised this gist Dec 23, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cli.md
    Original file line number Diff line number Diff line change
    @@ -121,7 +121,7 @@ $ subl .

    ## Killing a Frozen Process
    ```
    $ ps aux | grep firefox
    $ ps aux | grep safari
    $ kill 123
    ```