Linux System Administration Commands Reference
This article provides a comprehensive reference of common Linux system administration commands, covering system information, date handling, shutdown/reboot, file and directory manipulation, searching, mounting, disk usage, user/group management, permissions, compression, package management, backup, CD/DVD handling, and networking utilities.
System Information
Commands such as arch , uname -m , cat /proc/cpuinfo , lspci -tv , and lsusb -tv display processor architecture, kernel version, CPU details, PCI and USB devices.
Date and Time
Use cal 2007 to show a calendar, date 041217002007.00 to set date/time, and clock -w to write the system clock to BIOS.
Shutdown and Reboot
Shutdown commands include shutdown -h now , init 0 , telinit 0 , scheduled shutdowns with shutdown -h hh:mm , and reboot with shutdown -r now or reboot . Use logout to log out.
File and Directory Operations
Navigate with cd , list with ls , create directories using mkdir , remove files/directories with rm and rmdir , move/rename with mv , copy with cp , and create links using ln -s (soft) or ln (hard). Additional utilities: tree , lstree , touch , file , iconv .
File Search
Search files with find (e.g., find / -name file1 , find /home/user1 -name *.bin ) and locate with locate , whereis , which .
Mounting Filesystems
Mount and unmount devices using mount /dev/hda2 /mnt/hda2 , umount /dev/hda2 , with options for loop devices, ISO images, FAT32, SMB shares, etc.
Disk Space
Check mounted partitions with df -h , list files by size with ls -lSr | more , estimate directory usage with du -sh dir1 , and list package sizes using rpm -q -a --qf '%10{SIZE}t%{NAME}n' or dpkg-query -W -f='${Installed-Size;10}t${Package}n' .
User and Group Management
Create groups with groupadd , delete with groupdel , modify with groupmod . Manage users with useradd , userdel , usermod , change passwords with passwd , set expiration with chage -E , and verify files with pwck , grpck , newgrp .
File Permissions
Modify permissions using chmod ugo+rwx directory1 , remove with chmod go-rwx directory1 , change ownership with chown user1 file1 , and set group ownership with chgrp group1 file1 . Special bits (SUID, SGID, sticky) are handled with chmod u+s , chmod g+s , chmod o+t , etc.
Special File Attributes
Use chattr +i file1 to make a file immutable, chattr +a for append‑only, chattr +c for compression, and lsattr to view attributes.
Compression and Archiving
Compress/decompress with bzip2 , gzip , gunzip , rar , unrar . Create archives using tar -cvf archive.tar file1 , tar -czvf archive.tar.gz dir1 , tar -cjf archive.tar.bz2 dir1 , and extract with tar -xvf . Zip utilities: zip , unzip .
RPM Package Management (Fedora/RedHat)
Install with rpm -ivh package.rpm , update with rpm -U , query with rpm -qa , list files with rpm -ql package , verify with rpm -V package , and import GPG keys with rpm --import .
YUM Package Manager
Install, update, remove packages using yum install , yum update , yum remove , list packages with yum list , search with yum search , and clean caches with yum clean all .
DEB Package Management (Debian/Ubuntu)
Install with dpkg -i package.deb , remove with dpkg -r , list installed packages with dpkg -l , query files with dpkg -L , and locate providing package with dpkg -S /bin/ping .
APT Tools
Manage packages using apt-get install , apt-get update , apt-get upgrade , apt-get remove , and search with apt-cache search .
Viewing File Contents
Use cat , tac , more , less , head , tail , and tail -f for real‑time monitoring.
Text Processing
Combine files with cat , filter with grep , transform with sed (e.g., sed 's/string1/string2/g' ), and process columns with awk , paste , sort , uniq , comm .
Character Conversion
Convert line endings with dos2unix and unix2dos , and recode files using recode .
Filesystem Analysis
Check for bad blocks with badblocks -v /dev/hda1 and repair filesystems with fsck , e2fsck , fsck.ext2 , fsck.ext3 , fsck.vfat , etc.
Filesystem Creation
Create filesystems with mkfs /dev/hda1 , mke2fs -j /dev/hda1 , mkfs -t vfat 32 -F /dev/hda1 , format floppy with fdformat -n /dev/fd0 , and create swap with mkswap /dev/hda3 .
Swap Management
Enable swap using swapon /dev/hda3 and disable with swapoff .
Backup Utilities
Perform backups with dump and restore with restore , synchronize directories with rsync , create disk images with dd , and archive with tar combined with ssh for remote copies.
CD/DVD Operations
Burn discs with cdrecord , create ISO images with mkisofs , mount ISO files with mount -o loop , and extract audio tracks with cd-paranoia . Verify media using dd if=/dev/hdc | md5sum .
Network Utilities (Ethernet & Wi‑Fi)
Display and configure interfaces with ifconfig , bring interfaces up/down with ifup / ifdown , obtain DHCP leases with dhclient , manage routes with route , resolve names with host , nslookup , view interfaces with ip link show , and monitor traffic with netstat or tcpdump .
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
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.