Skip to content

Latest commit

 

History

History
90 lines (75 loc) · 2.26 KB

README.md

File metadata and controls

90 lines (75 loc) · 2.26 KB

Barney

#1 ZSH

Thats a lie, we use the command line a lot

#3 VIM

Check out Matti's VIM docs

#4 Brace Expansion

cp /home/foo/realllylongname.cpp{,-old}

Example Source: user10767

#5 Changing to the previous directory you were in

cd -

#6 Repeating the last command

!!

Most usefull in

sudo !!

Example Source: amrox

#7 Replacing Typos

$ ehco foo bar baz
bash: ehco: command not found
$ ^ehco^echo
foo bar baz

Example Source: Seth

#8 Cursor Placement

  1. Alt + Click lets you place your cursor by clicking
  2. Ctrl + A moves your cursor to the beginning of the line
  3. Ctrl + C cancels a command (duh)

#9 Piping Commands

Get the output of command A and use it as the input for command B. Example: List all files (including dotfiles using -a) and find a file which name contains names

ls -a | grep names

#10 Creating files

touch super-rad-kittens.html

#11 Creating/Appending to files

echo "contents of file" > filename.md
echo "appending this to file" >> filename.md

#12 Moving/Renaming Files/Folders

Use the -R flag for folders

mv current-filename.md new-filename.md

#13 Copying Files/Folders

Use the -R flag for folders

cp filename.md filename-2.md

#14 Awesomly Copying

In some (most actually) cases its super usefull to use rsync instead of cp when copying entire folders. This skips all files that are already in the destination and unchanged.

rsync ./ ~/path/to/dest/

Super duper usefull for copying files to a server.

#14 grep using RegExp

If you're not familiar with RegExp learn it. No I'm serious, start right now, you won't regret it.

grep -E "\d" k1ttens