Operations 39 min read

Master 600 Essential Linux Commands for System Operations

This comprehensive guide presents over 600 powerful Linux commands covering system information, file management, permissions, package handling, networking, backup, and more, offering clear examples and syntax to help administrators efficiently manage and troubleshoot Linux environments.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master 600 Essential Linux Commands for System Operations

This article provides a thorough collection of Linux command references, organized into numbered sections that cover basic system queries, shutdown/reboot, file and directory operations, file searching, mounting filesystems, disk space management, user and group administration, permission handling, packaging, software installation, content viewing, text processing, character conversion, filesystem analysis, initialization, swap management, backup strategies, optical media handling, networking, directory listings, file type identification, copying, VIM usage, and RPM package management.

1. Basic Commands

uname -m            # Show processor architecture
uname -r            # Show kernel version
arch                # Show processor architecture
cat /proc/cpuinfo   # Display CPU info
cat /proc/interrupts
cat /proc/meminfo
cat /proc/swaps
cat /proc/version
cat /proc/net/dev
cat /proc/mounts
lspci -tv
lsusb -tv
date
cal 2007
date 041217002007.00
clock -w

2. Shutdown

shutdown -h now          # Power off now
init 0
telinit 0
shutdown -h 22:30      # Schedule shutdown
shutdown -c            # Cancel scheduled shutdown
shutdown -r now        # Reboot now
reboot
logout

3. Files and Directories

cd /home
cd ..
cd ../..
cd ~
cd -
pwd
ls
ls -F
ls -l
ls -a
ls *[0-9]*
tree
mkdir dir1
mkdir dir1 dir2
mkdir -p /tmp/dir1/dir2
rm -f file1
rmdir dir1
rm -rf dir1
mv dir1 new_dir
cp file1 file2
cp dir/* .
cp -a /tmp/dir1 .
ln -s file1 link1
ln file1 link1
touch -t 0712250000 file1
file file1
iconv -l
iconv -f fromEncoding -t toEncoding inputFile > outputFile
find . -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "thumbs/{}" \;

4. File Search

find / -name file1
find / -user user1
find /home/user1 -name \*.bin
find /usr/bin -type f -atime +100
find /usr/bin -type f -mtime -10
find / -name \*.rpm -exec chmod 755 "{}" \;
locate \*.ps
whereis halt
which halt

5. Mount a Filesystem

mount /dev/hda2 /mnt/hda2
umount /dev/hda2
fuser -km /mnt/hda2
umount -n /mnt/hda2
mount /dev/fd0 /mnt/floppy
mount /dev/cdrom /mnt/cdrom
mount -o loop file.iso /mnt/cdrom
mount -t vfat /dev/hda5 /mnt/hda5
mount /dev/sda1 /mnt/usbdisk
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share

6. Disk Space

df -h
ls -lSr | more
du -sh dir1
du -sk * | sort -rn
rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort -k1,1n
dpkg-query -W -f='${Installed-Size}\t${Package}
' | sort -k1,1n

7. Users and Groups

groupadd group_name
groupdel group_name
groupmod -n new_group_name old_group_name
useradd -c "Name Surname" -g admin -d /home/user1 -s /bin/bash user1
useradd user1
userdel -r user1
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1
passwd
passwd user1
chage -E 2005-12-31 user1
pwck
grpck
newgrp group_name

8. File Permissions (+ to set, - to remove)

chattr +a file1
chattr +c file1
chattr +d file1
chattr +i file1
chattr +s file1
chattr +S file1
chattr +u file1
lsattr

9. Special File Attributes

chattr +a file1
chattr +c file1
chattr +d file1
chattr +i file1
chattr +s file1
chattr +S file1
chattr +u file1
lsattr

10. Packing and Compression

bunzip2 file1.bz2
bzip2 file1
gunzip file1.gz
gzip file1
gzip -9 file1
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 -cvf archive.tar file1 file2 dir1
tar -tf archive.tar
tar -xvf archive.tar
tar -xvf archive.tar -C /tmp
tar -cvfj archive.tar.bz2 dir1
tar -xvfj archive.tar.bz2
tar -cvfz archive.tar.gz dir1
tar -xvfz archive.tar.gz
zip file1.zip file1
zip -r file1.zip file1 file2 dir1
unzip file1.zip

11. RPM Packages

rpm -ivh package.rpm
rpm -ivh --nodeps package.rpm
rpm -U package.rpm
rpm -F package.rpm
rpm -e package_name.rpm
rpm -qa
rpm -qa | grep httpd
rpm -qi package_name
rpm -qg "System Environment/Daemons"
rpm -ql package_name
rpm -qc package_name
rpm -q package_name --whatrequires
rpm -q package_name --whatprovides
rpm -q package_name --scripts
rpm -q package_name --changelog
rpm -qf /etc/httpd/conf/httpd.conf
rpm -qp package.rpm -l
rpm --import /media/cdrom/RPM-GPG-KEY
rpm --checksig package.rpm
rpm -qa gpg-pubkey
rpm -V package_name
rpm -Va
rpm -Vp package.rpm
rpm2cpio package.rpm | cpio --extract --make-directories *bin*
rpm -ivh /usr/src/redhat/RPMS/$(arch)/package.rpm
rpmbuild --rebuild package_name.src.rpm

12. YUM Package Manager

yum install package_name
yum localinstall package_name.rpm
yum update package_name.rpm
yum update package_name
yum remove package_name
yum list
yum search package_name
yum clean packages
yum clean headers
yum clean all

13. DEB Packages

dpkg -i package.deb
dpkg -r package_name
dpkg -l
dpkg -l | grep httpd
dpkg -s package_name
dpkg -L package_name
dpkg --contents package.deb
dpkg -S /bin/ping
apt-get install package_name
apt-cdrom install package_name
apt-get update
apt-get upgrade
apt-get remove package_name
apt-get check
apt-get clean
apt-cache search searched-package

14. View File Content

cat file1
tac file1
more file1
less file1
head -2 file1
tail -2 file1
tail -f /var/log/messages

15. Text Processing

cat file1 file2 ... | command > file1_out.txt
cat file1 | command (sed|grep|awk) > result.txt
cat file1 | command >> result.txt
grep Aug /var/log/messages
grep ^Aug /var/log/messages
grep [0-9] /var/log/messages
grep Aug -R /var/log/*
sed 's/string1/string2/g' example.txt
sed '/^$/d' example.txt
sed '/ *#/d; /^$/d' example.txt
echo 'example' | tr '[:lower:]' '[:upper:]'
sed -e '1d' result.txt
sed -n '/string1/p' example.txt
sed -e 's/ *$//'
sed -e 's/string1//g' example.txt
sed -n '1,5p;5q' example.txt
sed -n '5p;5q' example.txt
sed -e 's/00*/0/g' example.txt
cat -n file1
cat example.txt | awk 'NR%2==1'
echo a b c | awk '{print $1}'
echo a b c | awk '{print $1,$3}'
paste file1 file2
paste -d '+' file1 file2
sort file1 file2
sort file1 file2 | uniq
sort file1 file2 | uniq -u
sort file1 file2 | uniq -d
comm -1 file1 file2
comm -2 file1 file2
comm -3 file1 file2

16. Character Set and File Format Conversion

dos2unix filedos.txt fileunix.txt
unix2dos fileunix.txt filedos.txt
recode ..HTML < page.txt > page.html
recode -l | more

17. Filesystem Analysis

badblocks -v /dev/hda1
fsck /dev/hda1
fsck.ext2 /dev/hda1
e2fsck /dev/hda1
e2fsck -j /dev/hda1
fsck.ext3 /dev/hda1
fsck.vfat /dev/hda1
fsck.msdos /dev/hda1
dosfsck /dev/hda1

18. Initialise a Filesystem

mkfs /dev/hda1
mke2fs /dev/hda1
mke2fs -j /dev/hda1
mkfs -t vfat 32 -F /dev/hda1
fdformat -n /dev/fd0
mkswap /dev/hda3

19. SWAP Filesystem

mkswap /dev/hda3
swapon /dev/hda3
swapon /dev/hda2 /dev/hdb3

20. Backup

dump -0aj -f /tmp/home0.bak /home
dump -1aj -f /tmp/home0.bak /home
restore -if /tmp/home0.bak
rsync -rogpav --delete /home /tmp
rsync -rogpav -e ssh --delete /home user@host:/tmp
rsync -az -e ssh --delete host:/home/public /home/local
rsync -az -e ssh --delete /home/local host:/home/public
dd bs=1M if=/dev/hda | gzip | ssh user@host 'dd of=hda.gz'
dd if=/dev/sda of=/tmp/file1
tar -Puf backup.tar /home/user
(cd /tmp/local && tar c .) | ssh -C user@host 'cd /home/share && tar x -p'
(tar c /home) | ssh -C user@host 'cd /home/backup-home && tar x -p'
 tar cf - . | (cd /tmp/backup ; tar xf - )
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2
dd if=/dev/hda of=/dev/fd0 bs=512 count=1
dd if=/dev/fd0 of=/dev/hda bs=512 count=1

21. Optical Media

cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force
mkisofs /dev/cdrom > cd.iso
mkisofs /dev/cdrom | gzip > cd_iso.gz
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd
cdrecord -v dev=/dev/cdrom cd.iso
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom
mount -o loop cd.iso /mnt/iso
cd-paranoia -B
cd-paranoia -- "-3"
cdrecord --scanbus
dd if=/dev/hdc | md5sum

22. Network (Ethernet and Wi‑Fi)

ifconfig eth0
ifup eth0
ifdown eth0
ifconfig eth0 192.168.1.1 netmask 255.255.255.0
ifconfig eth0 promisc
dhclient eth0
route -n
route add -net 0/0 gw IP_Gateway
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1
route del 0/0 gw IP_Gateway
echo "1" > /proc/sys/net/ipv4/ip_forward
hostname
host www.example.com
nslookup www.example.com
ip link
mii-tool eth0
ethtool eth0
netstat -tup
netstat -tupl
tcpdump tcp port 80
iwlist scan
iwconfig eth1
whois www.example.com

23. List Directory Contents

ls -a
ls -l
ls -R
ls -ld
pwd

24. Identify File Type

file filename

25. Copy Files and Directories

cp source dest
cp -r source_dir target_dir
cp -a source_dir .
cp -a dir1 dir2

26. System Common Commands

date
uptime
cal
cat
echo
head
tail
more
less
ls
who
w
dmesg
free

27. VIM

VIM is a powerful command‑line text editor. Use vim filename to open or create a file. Common commands include i (insert), dd (delete line), yy (yank), p (paste), u (undo), : (ex mode) with :w, :q, :wq, etc.

28. RPM Package Management Commands

# Install
rpm -ivh package.rpm
# Remove
rpm -e package_name
# Upgrade
rpm -Uvh package.rpm
# Update
rpm -Fvh package.rpm
# Query
rpm -q package_name
rpm -ql package_name
rpm -qi package_name

29. Conclusion

The author acknowledges possible errors and welcomes feedback.

Linuxbashcommand-linesystem-administration
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.