Introduction
If you are new to Linux, these are the first commands worth learning. They help you navigate the system, inspect files, and perform safe day-to-day file operations.
1) pwd - Print Working Directory
pwd shows your current location in the filesystem.
pwd
Example output:
/home/tony
Use this whenever you are unsure where you are before running file commands.
2) ls -la - List Files and Details
ls lists files and folders. -l shows long details (permissions, owner, size, date). -a includes hidden files (names starting with .).
ls -la
Useful for checking what exists in a folder and reviewing permissions.
3) cd - Change Directory
cd moves you into a different folder.
cd /etc
Useful variants:
cd ~ # go to your home directory
cd .. # go up one level
cd - # go back to previous directory
4) mkdir - Create Directory
Creates a new folder.
mkdir project-files
Create nested folders safely:
mkdir -p projects/netcollege/docs
5) cp - Copy Files or Folders
Copies files from one location to another.
cp notes.txt notes-backup.txt
Copy a folder recursively:
cp -r source-folder backup-folder
6) mv - Move or Rename
mv is used to move files/folders or rename them.
Rename:
mv old-name.txt new-name.txt
Move to another directory:
mv report.txt /home/tony/Documents/
7) rm - Remove Files or Folders
Deletes files and directories. This command is powerful and usually permanent.
Delete a file:
rm file.txt
Delete a directory and all its contents:
rm -r old-folder
Safer interactive mode:
rm -i file.txt
Always run ls first if you are not 100% sure what will be deleted.
Tip
Use man whenever you need command syntax and options.