Whether you’re an aspiring system administrator, developer, or just a Linux enthusiast, knowing the right commands can dramatically boost your productivity and confidence. In this post, we’ll cover essential Linux commands that are not only useful for daily tasks but are also frequently asked in interviews.
Each command comes with a description, example usage, and pro tips to help you master Linux from the command line.
System Information & Monitoring
Command
Description
Example
uname -a
Show system/kernel info
uname -a
hostname
Show/modify hostname
hostname
uptime
How long the system has been running
uptime
top
Real-time system monitoring
top
htop
Interactive process viewer (better top)
htop (needs install)
free
Show memory usage
free -h
df
Show disk usage
df -h
du -sh /folder
Folder size
du -sh /var/log
vmstat
System performance stats
vmstat 1
iostat
CPU and I/O usage
iostat (from sysstat package)
File and Directory Management
Command
Description
Example
ls
List files and directories
ls -l /home
cd
Change directory
cd /etc
pwd
Show current directory
pwd
mkdir
Create directory
mkdir projects
rmdir
Remove empty directory
rmdir temp
rm
Remove files or directories
rm -rf folder
cp
Copy files/directories
cp file.txt backup/
mv
Move/rename files
mv file.txt archive.txt
touch
Create an empty file
touch index.html
find
Search for files
find / -name “*.log”
locate
Fast search (uses a DB)
locate passwd
stat
Show file details
stat file.txt
File Viewing & Editing
Command
Description
Example
cat
Show file contents
cat file.txt
more / less
View large files page by page
less /var/log/syslog
head
Show first lines of file
head -n 10 file.txt
tail
Show last lines
tail -f /var/log/messages
nano
Terminal text editor
nano config.txt
vim
Advanced text editor
vim script.sh
User and Permission Management
Command
Description
Example
whoami
Show current user
whoami
id
Show UID, GID, groups
id
adduser
Add a user
adduser john
passwd
Change password
passwd john
usermod
Modify user
usermod -aG sudo john
deluser
Delete a user
deluser john
chmod
Change file permissions
chmod 755 script.sh
chown
Change file owner
chown root:root file
Package Management
For Debian/Ubuntu:
Command
Description
Example
apt update
Update package index
sudo apt update
apt upgrade
Upgrade all packages
sudo apt upgrade
apt install
Install a package
sudo apt install nginx
apt remove
Remove a package
sudo apt remove nginx
dpkg -i
Install .deb file
sudo dpkg -i package.deb
For Red Hat/CentOS:
Command
Description
Example
yum install
Install a package
sudo yum install httpd
dnf
Modern yum alternative
dnf install vim
rpm -ivh
Install rpm package
rpm -ivh package.rpm
Networking Commands
Command
Description
Example
ip a
Show IP address
ip a
ifconfig
(deprecated) Show interfaces
ifconfig
ping
Check connectivity
ping google.com
traceroute
Show route to host
traceroute google.com
netstat -tuln
List open ports
netstat -tuln
ss -tuln
Modern alternative to netstat
ss -tuln
curl
Fetch data from URL
curl https://example.com
wget
Download files
wget https://example.com/file.zip
scp
Secure file copy
scp file user@host:/path/
ssh
Remote login
ssh user@192.168.1.1
Process and Service Management
Command
Description
Example
ps aux
List all processes
ps aux
kill
Kill a process by PID
kill 1234
killall
Kill by name
killall firefox
systemctl
Manage services (systemd)
systemctl restart nginx
service
Manage older init.d services
service apache2 status
crontab -e
Edit scheduled tasks
crontab -e
Disk and Partitioning
Command
Description
Example
lsblk
List block devices
lsblk
fdisk -l
Partition table
sudo fdisk -l
mount
Mount a drive
mount /dev/sdb1 /mnt
umount
Unmount a drive
umount /mnt
mkfs.ext4
Format partition
mkfs.ext4 /dev/sdb1
blkid
Show device UUIDs
blkid
Final Thoughts
Mastering these Linux commands will:
Help you navigate and manage any Linux environment
Make you confident in interviews for SysAdmin, DevOps, and Support roles
Equip you with the skills to automate and troubleshoot tasks