600 Essential Linux Commands to Solve 99% of Everyday Tasks
This article compiles 600 practical Linux commands covering system information, shutdown, file and directory management, searching, mounting, disk usage, user and group handling, permissions, special attributes, compression, package management, networking, and common utilities, providing a comprehensive cheat‑sheet for everyday system administration.
1. Basic Commands
uname -m # Show processor architecture
uname -r # Show kernel version
dmidecode -q # Display hardware components
hdparm -i /dev/hda # List disk characteristics
hdparm -tT /dev/sda # Perform test reads on a disk
arch # Show processor architecture
cat /proc/cpuinfo # Show CPU info
cat /proc/interrupts # Show interrupts
cat /proc/meminfo # Check memory usage
cat /proc/swaps # Show active swap devices
cat /proc/version # Show kernel version
cat /proc/net/dev # Show network adapters and stats
cat /proc/mounts # Show mounted filesystems
lspci -tv # List PCI devices
lsusb -tv # Show USB devices
date # Show system date
cal 2007 # Show calendar for 2007
date 041217002007.00 # Set date and time (MMDDhhmmYY.ss)
clock -w # Save BIOS time2. Shutdown
shutdown -h now # Power off now (method 1)
init 0 # Power off (method 2)
telinit 0 # Power off (method 3)
shutdown -h HH:MM # Schedule shutdown
shutdown -c # Cancel scheduled shutdown
shutdown -r now # Reboot now
reboot # Reboot (method 2)
logout # Log out3. Files and Directories
cd /home # Change to /home
cd .. # Up one level
cd ../.. # Up two levels
cd ~user1 # Switch to user1's home
cd - # Return to previous directory
pwd # Print working directory
ls # List files
ls -F # List with type indicators
ls -l # Detailed list
ls -a # Show hidden files
ls *[0-9]* # Show names containing digits
tree # Tree view (method 1)
lstree # Tree view (method 2)
mkdir dir1 # Create directory dir1
mkdir dir1 dir2 # Create two directories
mkdir -p /tmp/dir1/dir2 # Create nested directories
rm -f file1 # Force delete file1
rmdir dir1 # Remove empty directory
rm -rf dir1 # Remove directory and its contents
mv dir1 new_dir # Rename/move directory
cp file1 file2 # Copy file
cp dir/* . # Copy all files from dir to current dir
cp -a /tmp/dir1 . # Archive copy preserving attributes
ln -s file1 lnk1 # Create symbolic link
ln file1 lnk1 # Create hard link
touch -t 0712250000 file1 # Set timestamp (YYMMDDhhmm)
file file1 # Show MIME type
iconv -l # List known encodings
iconv -f from -t to inputFile > outputFile # Convert encoding
find . -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "thumbs/{}" \; # Batch resize images4. File Search
find / -name file1 # Search from root
find / -user user1 # Search files owned by user1
find /home/user1 -name \*.bin # Search .bin files in a home directory
find /usr/bin -type f -atime +100 # Files not accessed in 100 days
find /usr/bin -type f -mtime -10 # Files modified in last 10 days
find / -name \*.rpm -exec chmod 755 '{}' \; # Find RPMs and set permissions
locate \*.ps # Locate .ps files (requires updatedb)
whereis halt # Locate binary, source, man page
which halt # Show full path of executable5. Mount a Filesystem
mount /dev/hda2 /mnt/hda2 # Mount hda2
umount /dev/hda2 # Unmount hda2
fuser -km /mnt/hda2 # Force unmount if busy
umount -n /mnt/hda2 # Unmount without writing /etc/mtab
mount /dev/fd0 /mnt/floppy # Mount floppy
mount /dev/cdrom /mnt/cdrom # Mount CD/DVD
mount -o loop file.iso /mnt/cdrom # Mount ISO image
mount -t vfat /dev/hda5 /mnt/hda5 # Mount FAT32
mount /dev/sda1 /mnt/usbdisk # Mount USB stick
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share # Mount Windows share6. Disk Space
df -h # Show mounted partitions
ls -lSr | more # List files sorted by size
du -sh dir1 # Summarize disk usage of dir1
du -sk * | sort -rn # Sort directories/files by size
rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort -k1,1n # List installed RPMs by size (Fedora/RedHat)
dpkg-query -W -f='${Installed-Size;10}t${Package}n' | sort -k1,1n # List installed DEBs by size (Debian/Ubuntu)7. Users and Groups
groupadd group_name # Create group
groupdel group_name # Delete group
groupmod -n new old # Rename group
useradd -c "Name Surname" -g admin -d /home/user1 -s /bin/bash user1 # Add user to admin group
useradd user1 # Add user
userdel -r user1 # Delete user and home directory
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 # Modify user
passwd # Change password
passwd user1 # Change user1's password (root only)
chage -E 2005-12-31 user1 # Set password expiry date
pwck # Verify /etc/passwd format
grpck # Verify /etc/group format
newgrp group_name # Switch primary group8. File Permissions
ls -lh # List with human‑readable sizes
chmod ugo+rwx directory1 # Grant rwx to user, group, others
chmod go-rwx directory1 # Remove rwx from group and others
chown user1 file1 # Change owner
chown -R user1 directory1 # Recursively change owner
chgrp group1 file1 # Change group
chown user1:group1 file1 # Change owner and group
find / -perm -u+s # List files with SUID bit
chmod u+s /bin/file1 # Set SUID on binary
chmod u-s /bin/file1 # Remove SUID
chmod g+s /home/public # Set SGID on directory
chmod o+t /home/public # Set sticky bit on directory
chmod +x file # Add execute permission for all
chmod -x file # Remove execute permission for all
chmod u+x file # Add execute for owner
chmod ug=wx file # Owner and group: write & execute only9. Special File Attributes
chattr +a file1 # Append‑only
chattr +c file1 # Auto‑compress
chattr +d file1 # Exclude from dump backups
chattr +i file1 # Immutable (cannot delete/modify)
chattr +s file1 # Secure deletion
chattr +S file1 # Synchronous updates
chattr +u file1 # Undelete support
lsattr # List special attributes10. Packing and Compression
bunzip2 file1.bz2
bzip2 file1
gunzip file1.gz
gzip file1
gzip -9 file1 # Maximum compression
rar a file1.rar test_file
rar a file1.rar file1 file2 dir1
rar x file1.rar
unrar x file1.rar
tar -cvf archive.tar file1
tar -tf archive.tar
tar -xvf archive.tar
tar -cvfj archive.tar.bz2 dir1
tar -cvfz archive.tar.gz dir1
zip file1.zip file1
zip -r file1.zip file1 file2 dir1
unzip file1.zip11. RPM Packages (Fedora/RedHat)
rpm -ivh package.rpm
rpm -U package.rpm # Upgrade without changing config
rpm -F package.rpm # Refresh already‑installed package
rpm -e package.rpm # Remove package
rpm -qa # List all installed RPMs
rpm -q package_name # Query a package
rpm -ql package_name # List files provided by package
rpm -V package_name # Verify package files
rpm --import /path/RPM-GPG-KEY # Import GPG key12. YUM Package Manager (Fedora/RedHat)
yum install package_name
yum localinstall package.rpm
yum update package_name
yum remove package_name
yum list
yum search package_name
yum clean all13. DEB Packages (Debian/Ubuntu)
dpkg -i package.deb
dpkg -r package_name
dpkg -l
apt-get install package_name
apt-get update
apt-get upgrade
apt-get remove package_name
apt-cache search keyword14. View File Contents
cat file1
tac file1
more file1
less file1
head -2 file1
tail -2 file1
tail -f /var/log/messages15. Text Processing
grep Aug /var/log/messages
sed 's/string1/string2/g' file.txt
sed '/^$/d' file.txt
tr '[:lower:]' '[:upper:]' <<< "example"
awk '{print $1}' file.txt
sort file.txt | uniq
comm -1 file1 file216. Character Set and File Format Conversion
dos2unix filedos.txt fileunix.txt
unix2dos fileunix.txt filedos.txt
recode ..HTML < page.txt > page.html
recode -l | more17. Filesystem Check
badblocks -v /dev/hda1
fsck /dev/hda1
e2fsck -j /dev/hda1 # For ext3
fsck.vfat /dev/hda118. Initialise a Filesystem
mkfs /dev/hda1
mke2fs /dev/hda1
mke2fs -j /dev/hda1 # ext3
mkfs -t vfat /dev/hda5
fdformat -n /dev/fd0
mkswap /dev/hda319. SWAP Filesystem
mkswap /dev/hda3
swapon /dev/hda3
swapon /dev/hda2 /dev/hdb320. Backup
dump -0aj -f /tmp/home0.bak /home
restore -if /tmp/home0.bak
rsync -rogpav --delete /home /tmp
rsync -az -e ssh user@host:/home /local
dd if=/dev/sda of=/tmp/file121. CD/DVD
cdrecord -v dev=/dev/cdrom cd.iso
mkisofs -J -R -V "Label CD" -o ./cd.iso data_cd
mount -o loop cd.iso /mnt/iso
dd if=/dev/hdc | md5sum22. Network (Ethernet & Wi‑Fi)
ifconfig eth0
ifup eth0
ifdown eth0
ifconfig eth0 192.168.1.1 netmask 255.255.255.0
dhclient eth0
route -n
route add -net 0/0 gw IP_Gateway
hostname
ping www.example.com
netstat -tup
tcpdump tcp port 80
iwlist scan
iwconfig eth123. List Directory Contents
ls -a
ls -l
ls -R
ls -ld24. Determine File Type
file filename25. Copy, Move, Delete Operations
cp source dest
cp -r src_dir dest_dir
mv old new
rm -f file
rm -r dir
rmdir dir26. Common System Commands – Display
date
hwclock
cal
uptime27. VIM Editor
:q # Quit Vim
i # Insert mode
Esc # Return to command mode
dd # Delete line
yy # Yank line
p # Paste after cursor
:u # Undo
:/pattern # Search28. RPM Package Management
rpm -ivh package.rpm # Install
rpm -e package_name # Remove (keeps modified configs)
rpm -Uvh package.rpm # Upgrade
rpm -q package_name # Query
rpm -ql package_name # List files installed by packageAll commands are presented exactly as they appear in the original article, providing a ready reference for Linux system administrators.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Linux Tech Enthusiast
Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
