# Unix Shell Cheat Sheet Common commands we will use throughout the workshop (and are generally good for efficiently navigating the unix shell). Wherever you see brackets (\<\>) you should in the appropriate name (i.e., foldername or username). ## Unix Shell Basics | Command | Description | | :------ | ----------: | | cd \ | Enter directory | | cd .. | Go back one directory | | cd ∼ | Go to home directory | | ls | List files within current directory | | ls \ | List files within another directory | | pwd | Get directory path | | clear | Clear terminal | | mkdir \ | Create new folder | | mv \ \| Rename file | | mv \ \ | Move file to new location | | mv -r \ \| Rename folder | | mv -r \ \ | Move folder and contents to new location | | cp \ \ | Copy file to new location | | cp -r \ \ | Copy folder and contents to new location | | rm \ | Remove file | | rm -r \ | Remove entire folder | | cat \ | Print contents of file to terminal | | head \ | Print first 10 lines of file | | echo "Text" | Print text | | grep "\" \ | Find lines matching PATTERN in location | | help | Get list of commands | | help name | Get info on command name | ## Additional Unix Shell Commands | Command | Description | | :------ | ----------: | | scp \@\:\ \ | Copy file from remote to local computer | | scp \ \@\:\ | Copy file to remote from local computer | | scp -r \ \@\:\ | Do the above for a folder and its contents | | chmod +x \ | Add execute permissions | | bash \ | Run a shell script | | ./\ | Run an executable file | ## vim Editor | Command | Description | | :------ | ----------: | | vim \ | create or open a file | | :w | Save new text | | :q | Quit file editor | | :wq | Save and quit file editor in one command | | :h | Help | | :split \ | Open a second file in split screen | | i | Begin editing file | | x | Cut a letter | | r | Replace a letter | | yy | Yank (copy) current line | | dd | Cut and copy current line | | p | Paste | | esc | Exit editing mode | ## tmux and screen (Managing Terminal Sessions) | Command | Description | | :------ | ----------: | | screen -RD | open a screen session or return to existing | | tmux | create and enter into new file |