Terminal Command Basics

Terminal Command Basics

Michael Charles Aubrey // Wed Apr 19 2023

These commands are fundamental for getting started with the terminal. While there are many other commands available, mastering these will prepare you for more advanced terminal operations.

  • mv

Used to move files and folders or rename files. For example:

mv projects /c/Users/projects

This moves the "projects" folder to the user's folder.

  • cp -r

Used to copy files and folders. For example:

cp -r original_location new_location
  • ls

Lists the contents of the current folder. Adding the "-lah" option displays more detailed information.

  • pwd

Displays the current directory.

  • mkdir

Creates a new folder. For example:

mkdir Projects
  • cd

Used to change directories. For example:

cd Projects

This moves you to the "Projects" directory.

  • cd ..

Moves to the parent directory.

  • cd ~

Moves to the user's home directory.

  • rm -r

Removes files and folders. Adding the "-r" option allows you to delete folders and all files within them. For example:

rm -r FolderName
  • code .

Opens the current folder in Visual Studio Code.

  • touch

Used to create empty files. For example:

touch index.html

This creates a file named "index.html".

  • cat

Displays the contents of a file. For example:

cat index.html

This displays the contents of the "index.html" file.

  • history

Displays a list of previously executed commands.

  • clear

Clears the terminal's content.

This article was originally published on Qiita.