Skip to main content

Command Palette

Search for a command to run...

Command Line Cheat Sheet

Published
•2 min read•View as Markdown
D

Just a confused human trying to find their place in the world. Happy places include, but not limited to: Video games, board games, books, writing, making music, coffee, more coffee, tea, weight lifting, MMA, working with farm animals, tinkering with all the things, hiking.

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.

More from this blog

D

Developer Overload

11 posts

Just a guy trying to be a developer, riddled with impostor syndrome and struggles to focus, chronicling my notes, thought processes and more on Developer Overload.