Command Line Cheat Sheet

Subscribe to my newsletter and never miss my upcoming articles

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

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

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

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

Find more commands at Git-Tower or this cheat sheet.

No Comments Yet