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 namedprojects
.
nano file-name.txt
Description: Opens or creates a file in the Nano terminal text editor.
Use Case:
nano notes.txt
→ opensnotes.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
→ opensnotes.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 callednewfile.txt
.
cp file-name.txt destination/
Description: Copies a file to another location.
Use Case:
cp notes.txt /home/username/Documents/
→ copiesnotes.txt
into theDocuments
folder.
mv file-name.txt destination/
Description: Moves (or renames) a file.
Use Case:
mv notes.txt /home/username/Documents/
→ movesnotes.txt
into theDocuments
folder.mv oldname.txt newname.txt
→ renamesoldname.txt
tonewname.txt
.
cat file-name.txt
Description: Displays the contents of a file directly in the terminal.
Use Case:
cat notes.txt
→ prints the contents ofnotes.txt
to the screen.
rm file-name.txt
Description: Deletes a file.
Use Case:
rm oldfile.txt
→ removes the fileoldfile.txt
.
Be careful: deleted files cannot be recovered easily.
rmdir folder_name
Description: Removes an empty directory.
Use Case:
rmdir testfolder
→ removes the foldertestfolder
(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.