# Command Line Cheat Sheet

> A Quick List of CLI Basics, plus some extras


### Directories
`$ pwd`
Will show the path of the current directory you are in

`$ cd <directory>`
Will change you to the specified directory

`$ cd .. `
Will move you to the parent directory

`$ ls `
Will list contents in the current directory

`$ ls -la`
More detailed view, includes hidden files

`$ mkdir <directory>`
Will create a new directory

### Files
`$ rm <file>`
Deletes the given file

`$ rm -r <directory>`
Deletes the directory

`$ rm -f <file>`
Forces file delete. You can add the `-r` flag to force-delete a directory.

`$ mv <old-file> to <new-file>`
Renames file

`$ mv <file> <directory>`
Moves file to directory. This may overwrite an existing file

`$ cp <file> <directory>`
Copy a file to a directory. This may overwrite an existing file

`$ touch <file>`
Create a new file


### Search
`$ find <dir> -name "<file>"`
Search for all files named <file> inside a directory. You can use wildcards `*` to search for parts of a filename, like "*.html"

`$ grep "<text>" <file>`
Outputs all occurrences of <text> inside <file>

`$ grep -rl "<text>" <dir>`
Searches for all files containing <text> inside <dir>



Find more commands at [Git-Tower][1] or
[this][2] cheat sheet.

[1]: https://www.git-tower.com/blog/command-line-cheat-sheet/        "Git-Tower"
[2]: https://gist.github.com/poopsplat/7195274  "this"


