Linux Command Cheat Sheet
76 views
A list of essential Linux commands every beginner should know. Mastering these commands will make you more confident and efficient when using any Linux system.

Linux Command Cheat Sheet
This guide explains the most important and basic Linux commands in a simple way. Learning these will help you become more comfortable, confident, and efficient using Linux.
π File and Directory Commands
-
ls
- Lists files and folders in the current folder.
-
ls -l
- Lists files with more details like size, date, and permissions.
-
ls -a
- Shows all files, including hidden ones (hidden files start with a dot
.
).
- Shows all files, including hidden ones (hidden files start with a dot
-
cd /path/to/directory
- Changes the current folder to another folder. Replace
/path/to/directory
with the folder you want to go to.
- Changes the current folder to another folder. Replace
-
pwd
- Shows the full path of the current folder.
-
mkdir folder_name
- Creates a new folder. Replace
folder_name
with your desired name.
- Creates a new folder. Replace
-
rmdir folder_name
- Deletes an empty folder.
-
rm file_name
- Deletes a file.
-
rm -r folder_name
- Deletes a folder and everything inside it.
-
touch file_name
- Creates a new empty file. If the file exists, it updates its time.
-
cat file_name
- Shows the content of the file.
-
more file_name
- Shows file content one page at a time.
-
less file_name
- Similar to
more
but with more features. You can scroll up and down.
- Similar to
-
cp source_file target_file
- Copies a file. Replace
source_file
with the file to copy andtarget_file
with the new name.
- Copies a file. Replace
-
mv old_name new_name
- Moves or renames a file or folder.
π SSH (Secure Shell)
-
ssh user@host
- Connects to another computer using your username and IP or hostname.
-
ssh -p port user@host
- Connects to another computer using a specific port.
-
ssh-keygen -t rsa
- Creates a secure key for logging into servers.
-
ssh-copy-id user@host
- Copies your key to another computer, so you donβt need to type the password each time.
π Searching
-
grep pattern file
- Searches for a word or phrase in a file.
-
grep -r pattern folder
- Searches for a word in all files inside a folder.
-
find folder -name name*
- Finds files that start with βnameβ in a folder.
-
locate file_name
- Quickly finds files by name (faster but might need
updatedb
).
- Quickly finds files by name (faster but might need
π§ Process Management
-
ps aux
- Shows all running programs.
-
ps aux | grep program_name
- Finds a specific program by name.
-
top
- Shows live info about running programs (like Task Manager).
-
kill PID
- Stops a program by its ID (PID = Process ID).
-
killall program_name
- Stops all programs with the same name.
-
bg
- Lists background jobs or continues a stopped job in the background.
-
fg
- Brings a background job to the front so you can interact with it.
π File Permissions
-
chmod +x file_name
- Makes a file executable (can be run like a program).
-
chmod 755 file_name
- Gives read, write, and run permissions to owner, and read + run to others.
-
chown user:group file_name
- Changes who owns the file and its group.
π Networking
-
ifconfig
- Shows your network settings and IP addresses.
-
ping host
- Checks if a computer or website is reachable.
-
traceroute host
- Shows the path your data takes to reach another computer.
-
netstat -tulnp
- Lists open network ports and the programs using them.
π¦ Archiving and Compression
-
tar cf archive.tar files
- Creates a
.tar
archive from files.
- Creates a
-
tar xf archive.tar
- Extracts files from a
.tar
archive.
- Extracts files from a
-
gzip file_name
- Compresses a file to save space (creates
.gz
).
- Compresses a file to save space (creates
-
gunzip file.gz
- Decompresses a
.gz
file.
- Decompresses a
π₯οΈ System Info and Management
-
uname -a
- Shows details about your system and Linux version.
-
df -h
- Shows free space on your hard drive (in GB or MB).
-
du -sh folder_name
- Shows the size of a folder.
-
free -m
- Shows how much memory (RAM) is used or free.
π§ Misc Commands
-
man command_name
- Opens the manual/help page for a command.
-
echo "text"
- Prints text on the screen.
-
date
- Shows the current date and time.
-
uptime
- Tells how long your computer has been on.
Use the
man
command to learn more about any of these commands. For example:man ls
Bye for now,see you soon