Operations 36 min read

Essential Linux Command Cheat Sheet for System Administrators

A comprehensive reference of essential Linux commands covering system information, shutdown, file management, searching, mounting, disk usage, user and group handling, permissions, package management, backup, networking, and common utilities for effective system administration.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Essential Linux Command Cheat Sheet for System Administrators

Basic Commands

uname -m

– display processor architecture uname -r – display kernel version dmidecode -q – show hardware components cat /proc/cpuinfo – view CPU details cat /proc/meminfo – view memory usage cat /proc/interrupts – view interrupts lspci -tv – list PCI devices lsusb -tv – list USB devices date – show system date cal 2007 – display calendar for 2007

Shutdown and Reboot

shutdown -h now

– immediate shutdown init 0 – shutdown (runlevel 0) telinit 0 – shutdown (telinit) shutdown -h HH:MM & – schedule shutdown shutdown -c – cancel scheduled shutdown shutdown -r now – immediate reboot reboot – reboot logout – logout

File and Directory Operations

cd /home

– change to /home cd .. – go up one level pwd – print working directory ls – list files ls -l – detailed list ls -a – include hidden files tree – tree view of directories mkdir dir1 – create directory mkdir -p /tmp/dir1/dir2 – create nested directories rm -f file1 – force delete file rmdir dir1 – remove empty directory rm -rf dir1 – recursively delete directory mv dir1 new_dir – rename or move cp file1 file2 – copy file ln -s file1 link1 – create symbolic link ln file1 link1 – create hard link

File Search

find / -name file1

– search from root find /home/user1 -name \*.bin – search for *.bin locate \*.ps – fast locate (run updatedb first) whereis halt – locate binary/source/man which halt – show executable path

Mounting Filesystems

mount /dev/hda2 /mnt/hda2

– mount device umount /dev/hda2 – unmount device mount -o loop file.iso /mnt/iso – mount ISO image mount -t vfat /dev/hda5 /mnt/hda5 – mount FAT32

mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share

– mount Windows share

Disk Space Utilities

df -h

– show mounted partitions du -sh dir1 – estimate directory size rpm -qa | sort -k1,1n – list installed RPMs by size (Fedora/RedHat) dpkg-query -W | sort -k1,1n – list installed DEBs by size (Debian/Ubuntu)

User and Group Management

groupadd group_name

– create group useradd -c "Name" -g admin -d /home/user1 -s /bin/bash user1 – create user with details passwd user1 – change password usermod -g system -d /ftp/user1 -s /bin/nologin user1 – modify user groupdel group_name – delete group userdel -r user1 – delete user and home

File Permissions

chmod ugo+rwx directory1

– grant rwx to all chmod go-rwx directory1 – revoke from group/others chown user1 file1 – change owner chgrp group1 file1 – change group chmod u+s /bin/file1 – set SUID chmod g+s /home/public – set SGID on directory chmod o+t /home/public – set sticky bit

Special File Attributes

chattr +i file1

– make immutable chattr +a file1 – append‑only chattr +c file1 – enable compression lsattr – list attributes

Package Management (RPM, YUM, DEB, APT)

rpm -ivh package.rpm

– install RPM rpm -e package_name – erase RPM yum install package_name – install via YUM yum update package_name – update package dpkg -i package.deb – install DEB apt-get install package_name – install via APT

Backup and Synchronization

dump -0aj -f /tmp/home0.bak /home

– full backup restore -if /tmp/home0.bak – restore backup rsync -az -e ssh /home user@host:/tmp – sync over SSH dd if=/dev/sda of=/tmp/file1 – raw disk copy tar -cvf backup.tar /home/user – archive directory

Network Utilities

ifconfig eth0

– show interface config route -n – display routing table netstat -tup – list active connections tcpdump tcp port 80 – capture HTTP traffic ping www.example.com – test connectivity nslookup www.example.com – DNS lookup

Directory Listing and File Type

ls -a

– show all files ls -l – detailed list ls -R – recursive list file file1 – determine file type

Text Processing

grep pattern file

– search text sed 's/old/new/g' file – stream edit awk '{print $1}' file – field extraction sort file | uniq – unique sorted lines tr '[:lower:]' '[:upper:]' – case conversion

Character Conversion and File Format

dos2unix filedos.txt fileunix.txt

– DOS to UNIX unix2dos fileunix.txt filedos.txt – UNIX to DOS recode ..HTML < page.txt > page.html – convert to HTML

Filesystem Checks and Initialization

fsck /dev/hda1

– check/repair filesystem mkfs /dev/hda1 – create filesystem mke2fs -j /dev/hda1 – create ext3 with journaling badblocks -v /dev/hda1 – scan for bad blocks

Swap Management

mkswap /dev/hda3

– create swap area swapon /dev/hda3 – enable swap

VIM Editor Basics

vim file

– open file in VIM :q – quit i – insert mode Esc – return to command mode dd – delete line yy – yank (copy) line p – paste :wq – write and quit

Additional Utilities

tar -cvzf archive.tar.gz dir

– create compressed tarball gzip file – compress file unzip file.zip – extract zip dd if=/dev/hdc | md5sum – compute MD5 of device who – list logged‑in users dmesg – kernel ring buffer free -h – memory usage

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-lineUnixSystem Administration
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

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.