Cheat sheet for standard terminal and command line commands. They are universal for use in most Unix/Linux environments (such as macOS, Linux), as well as for Windows, but with some differences.
They are also applicable for working with the built-in terminal in Visual Studio Code (VS Code).
These commands allow you to perform various operations, such as navigating folders, creating files, and other basic tasks.
Below are the commands for Windows and Linux, indicating the differences.
Navigating through folders
cd
: Go to the specified folder.
Example:cd Documents
go to the Documents folder.cd ..
: Move up a level in the folder hierarchy.cd ~
: Go to the user's home directory (works on Linux/Mac).
On Windows:cd %USERPROFILE%
go to the home directory.cd -
: Switch to the previous directory (works on Linux/Mac).ls
(Linux/Mac) ordir
(Windows): Show the contents of the current folder.
Creating and deleting files and folders
touch
: Create a new file (works on Linux/Mac).
On Windows: useecho. >file_name
to create the file.mkdir
: Create a new folder (works on all systems).
Example:mkdir myfolder
create a foldermyfolder
.rm
: Delete the file (works on Linux/Mac).
On Windows: usedel filename
to delete the file.rmdir
: Delete an empty folder (works on Linux/Mac).
In Windows:rmdir folder name
— deleting an empty folder.
Copy and Move
cp <source>lt;purpose
: Copy the file (works on Linux/Mac).
On Windows: usecopy source destination
.mv <source>lt;purpose
: Move or rename a file (works on Linux/Mac).
On Windows: usemove source destination
.
Other useful commands
clear
(Linux/Mac) orcls
(Windows): Clear the terminal screen.pwd
(Linux/Mac): Show the current directory path.
On Windows: just runcd
without arguments.git status
: Check the status of the Git repository (works on any system if Git is installed).code .
: Open the current folder in VS Code (if VS Code is added to the PATH).
These are the basic and standard commands that allow you to work effectively both directly in the operating environment itself and with the terminal in Visual Studio Code.