The Command Line Interface (CLI) is a constant companion for the vast majority of developers. It allows you to interact with applications in ways that are oftentimes more complex and powerful than those available through a Graphical User Interface (GUI).
In this document we’ll attempt to summarize some of the most important CLI commands. These commands should work on most *nix systems (Linux, MacOS, WSL).
Files and Folders
ls– List the files and folders in the current directory.-l– This option shows the results in a list format.
cd– Move between directories, e.g.cd mysubdirectory.- Using without any directory name will move one to the root of the file system (on Windows, use
cd \). - Using with
..will move you up to the parent directory.
- Using without any directory name will move one to the root of the file system (on Windows, use
mkdir– Create a new directory, e.g.mkdir somedirectoryname.touch– Create a new file, e.g.touch myfile.txt.pwd– Display the full path to the current directory (pwd = print working directory).- Tab Completion – Begin writing a path and use tab to have the terminal auto-fill it in, e.g.
Doc[tab]. .– Can be used with some apps (git, vscode) to interact with all files within a certain directory (and it’s children).rm– Can be used to remove a file, e.g.rm file.txt.-r– This option causesrmto recursively delete folders and files.
mv– To rename a directory or file, e.g.mv myfile.txt yourfile.txtwould rename myfile.txt to yourfile.txt.