Linux Terminal Commands (Beginner Focused)

A quick reference guide to basic Linux terminal commands with plain explanations and simple examples—perfect for beginners.

cd folder_name

Description: Changes directory to /folder_name.

Use Case:

  • cd .. → navigates up one directory from the current location.
  • cd ../.. → navigates up two directories.

ls

Description: Lists files and directories in the current location.

Use Case:

  • ls -l → shows details like permissions, size, and modification date.
  • ls -a → shows hidden files (those beginning with .).

pwd

Description: Prints the current working directory (shows your exact location in the filesystem).

Use Case:

  • pwd → returns something like /home/username/Documents.

tree

Description: Displays directories and files in a tree-like structure.

Use Case:

  • tree → shows the folder and subfolder structure from your current location.
  • tree -f → shows the full file path for each item.

mkdir folder_name

Description: Creates a new directory (folder).

Use Case:

  • mkdir projects → creates a folder named projects.

nano file-name.txt

Description: Opens or creates a file in the Nano terminal text editor.

Use Case:

  • nano notes.txt → opens notes.txt for editing inside Nano.

gedit file-name.txt

Description: Opens or creates a file in the Gedit graphical text editor.

Use Case:

  • gedit notes.txt → opens notes.txt in Gedit (if installed).

touch file.txt

Description: Creates a new empty file, or updates the timestamp of an existing one.

Use Case:

  • touch newfile.txt → creates an empty file called newfile.txt.

cp file-name.txt destination/

Description: Copies a file to another location.

Use Case:

  • cp notes.txt /home/username/Documents/ → copies notes.txt into the Documents folder.

mv file-name.txt destination/

Description: Moves (or renames) a file.

Use Case:

  • mv notes.txt /home/username/Documents/ → moves notes.txt into the Documents folder.
  • mv oldname.txt newname.txt → renames oldname.txt to newname.txt.

cat file-name.txt

Description: Displays the contents of a file directly in the terminal.

Use Case:

  • cat notes.txt → prints the contents of notes.txt to the screen.

rm file-name.txt

Description: Deletes a file.

Use Case:

  • rm oldfile.txt → removes the file oldfile.txt.
    Be careful: deleted files cannot be recovered easily.

rmdir folder_name

Description: Removes an empty directory.

Use Case:

  • rmdir testfolder → removes the folder testfolder (only if it’s empty).

clear

Description: Clears the terminal screen.

Use Case:

  • clear → gives you a clean terminal window.

exit

Description: Closes the terminal session.

Use Case:

  • exit → logs out of the terminal and closes the window.

Previous
Previous

Windows PowerShell | Scripts for Tech Support

Next
Next

Outlook Email | Tips & Tricks