Hardware and Kernel Insigths
uname -m # Display the system's CPU architecture
uname -r # Output the active kernel release string
dmidecode -q # Extract SMBIOS/DMI hardware component data
hdparm -I /dev/sda # Retrieve detailed characteristics of a storage device
hdparm -tT /dev/sda # Execute read-speed benchmarks on a disk
cat /proc/cpuinfo # Read processor specification details
cat /proc/interrupts # Monitor hardware interrupt requests
cat /proc/meminfo # Verify physical and virtual memory utilization
cat /proc/swaps # List active swap partitions
cat /proc/version # Output the kernel compilation version string
cat /proc/net/dev # Display network interface traffic statistics
cat /proc/mounts # Render the current mounted filesystem table
lspci -tv # Map PCI bus devices in a tree layout
lsusb -tv # Enumerate USB hubs and attached peripherals
Clock and Date Management
cal 2024 # Render a full calendar for the year 2024
date 123122002024.00 # Configure system clock - MonthDayHourMinuteYear.Seconds
hwclock --systohc # Synchronize hardware clock from system time
Session and Power Control
poweroff # Immediately halt the machine
init 0 # Transition to runlevel 0 to power down
shutdown -h 23:30 & # Schedule a system halt for 23:30 running in background
shutdown -c # Abort a pending scheduled shutdown
reboot # Restart the operating system immediately
init 6 # Transition to runlevel 6 to reboot
logout # Terminate the current terminal session
Directory Traversal and File Manipulation
cd /var/log # Switch working directory to system logs
cd .. # Step up one directory level
cd ../.. # Step up two directory levels
cd ~ # Return to the current user's home directory
cd ~postgres # Enter the postgres user's home directory
cd - # Jump back to the previous working directory
pwd # Print the absolute path of the current directory
ls -lah # List all files including hidden ones with human-readable sizes
ls -F # Append indicator symbols to listed entries
ls *[0-9]* # Filter listing to show entries containing numeric characters
tree # Render a recursive tree diagram of the current path
mkdir -p /opt/data/logs # Create a nested directory structure gracefully
rmdir empty_folder # Remove an empty directory
rm -rf old_data # Permanently delete a directory and its contents recursively
mv config.yaml backup.yaml # Move or rename a file/directory
cp source.bin dest.bin # Duplicate a single file
cp -r src_folder/ dest_folder/ # Copy an entire directory recursively
ln -s original.txt symlink.txt # Generate a symbolic link to a file
ln target.txt hardlink.txt # Generate a hard link to a file
touch -t 202412310000 report.log # Modify a file's timestamp (YYMMDDhhmm)
iconv -f UTF-8 -t ASCII input.txt > output.txt # Re-encode a file from UTF-8 to ASCII
Locating Files and Directroies
find /var -name "*.log" # Search the /var tree for all log files
find / -user admin # Locate all files belonging to the admin user
find /usr/bin -type f -atime +30 # Find binaries unaccessed for over 30 days
find /tmp -type f -mtime -1 # Discover files modified within the last 24 hours
find / -perm -4000 # Identify all files with the SUID permission set
locate "*.conf" # Quickly find configuration files (requires `updatedb`)
whereis nginx # Show source, binary, and man page locations for nginx
which python3 # Output the absolute path of the python3 executable
Mounting and Unmounting Storage Devices
mount /dev/sdb1 /mnt/usb_drive # Attach a partition to a mount point
umount /mnt/usb_drive # Detach a mounted filesystem
fuser -km /mnt/usb_drive # Terminate processes blocking a detach operation
mount -o loop disk_image.iso /mnt/iso # Mount an ISO image locally
mount -t ntfs /dev/sdc1 /mnt/windows_drive # Attach a Windows NTFS partition
mount -t cifs -o username=adm //server/share /mnt/share # Mount a remote Windows network share
Storage Capacity Analysis
df -h # Display available disk space on mounted volumes in human-readable format
du -sh /var # Estimate total space consumed by the /var directory
du -h --max-depth=1 | sort -hr # List subdirectory sizes sorted by largest first
dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n # Show installed Debian packages ranked by disk consumption
Identity and Group Administration
groupadd developers # Construct a new user group named developers
groupdel developers # Erase the developers group
groupmod -n devs developers # Rename the developers group to devs
useradd -m -g devs -s /bin/zsh alice # Create user alice with a home directory, assigned to devs group, using zsh shell
userdel -r alice # Remove user alice along with her home directory
passwd alice # Define or update the password for alice
chage -E 2025-12-31 alice # Set an expiration date for alice's account
newgrp devs # Temporarily switch primary group membership for new file creation
Access Control and Ownership Configuration
chmod 755 script.sh # Assign read/write/execute to owner, read/execute to group and others
chmod o-w shared_dir # Withdraw write permission from others on a directory
chown bob:devs config.yaml # Transfer file ownership to user bob and group devs
chown -R bob:devs /opt/app # Recursively change ownership of a directory tree
chmod u+s executable # Enable the SUID bit on an executable
chmod g+s shared_dir # Enable the SGID bit on a directory
chmod o+t shared_dir # Enable the Sticky bit to restrict file deletion to owners
Extended File Attributes
chattr +i core.conf # Lock file preventing any modifications or deletion (immutable)
chattr +a logs.txt # Restrict file to append-only writes
chattr +d backup.tar # Exclude file from dump backups
lsattr core.conf # Display the extended attributes assigned to a file
Archiving and Data Compression
bzip2 data.csv # Compress data.csv creating data.csv.bz2
bunzip2 data.csv.bz2 # Decompress a bzip2 archive
gzip -9 archive.txt # Apply maximum compression to archive.txt
gunzip archive.txt.gz # Decompress a gzip archive
tar -czvf backups.tar.gz /data/ # Generate a gzip-compressed tar archive of /data/
tar -xzvf backups.tar.gz # Extract a gzip-compressed tar archive into the current directory
tar -cjvf backups.tar.bz2 /data/ # Generate a bzip2-compressed tar archive
tar -xjvf backups.tar.bz2 -C /restore/ # Extract a bzip2 archive to a specific directory
zip -r project.zip src/ # Bundle src/ directory into a zip archive
unzip project.zip # Decompress a zip archive
Red Hat Package Management (RPM)
rpm -ivh nginx.rpm # Install an rpm package with verbose progress
rpm -Uvh nginx.rpm # Upgrade an existing rpm package
rpm -e nginx # Uninstall an rpm package
rpm -qa # List all installed rpm packages
rpm -qi nginx # Display detailed information about an installed package
rpm -ql nginx # Output files provided by an installed package
rpm -qf /etc/nginx/nginx.conf # Identify which package owns a specific file
rpm -V nginx # Validate installed package files against original metadata
Yellowdog Updater, Modified (YUM)
yum install nginx # Download and install a package from repositories
yum localinstall nginx.rpm # Install a local rpm file resolving dependencies via repos
yum update # Upgrade all installed packages to latest versions
yum remove nginx # Uninstall a specific package
yum search web-server # Query repositories for matching package names
yum clean all # Purge cached package data and headers
Debian Package Management (dpkg)
dpkg -i postgres.deb # Install a local Debian package
dpkg -r postgres # Remove an installed Debian package
dpkg -l # Enumerate all installed packages on the system
dpkg -l | grep database # Search installed packages for a keyword
dpkg -S /usr/bin/pg_dump # Determine which package provides a specific path
Advanced Package Tool (APT)
apt install curl # Fetch and install a package from remote repositories
apt update # Refresh the local package index from configured sources
apt upgrade # Apply available upgrades to all installed packages
apt remove curl # Delete a package from the system
apt search http-client # Scan repositories for packages matching a query
apt autoclean # Erase obsolete downloaded archive files
Inspecting File Contents
cat readme.md # Output entire file content to standard output
tac readme.md # Output file content reversing the line order
less readme.md # Open file in a scrollable viewer with backward navigation
head -n 50 readme.md # Display the first 50 lines of a file
tail -n 20 readme.md # Display the final 20 lines of a file
tail -f /var/log/syslog # Continuously stream appended log entries in real time
Text Filtering and Transformation
grep "Error" /var/log/syslog # Search file for lines containing the string Error
grep -E "^Exception" /var/log/app.log # Match lines starting with Exception
grep -R "timeout" /etc/ # Recursively search a directory for a string
sed 's/old_text/new_text/g' config.yaml # Replace all occurrences of a string globally in a file
sed '/^$/d' config.yaml # Strip all empty lines from a file
sed '/^\s*#/d' config.yaml # Remove commented and empty lines
awk '{print $2}' data.tsv # Extract the second column from a delimited file
awk 'NR%2==0' data.tsv # Filter and output only even-numbered lines
sort names.txt # Alphabetically sort lines in a file
sort names.txt | uniq # Sort and eliminate duplicate adjacent lines
comm -12 set_A.txt set_B.txt # Output lines present in both sorted files (intersection)
Encodign and Format Conversion
dos2unix win_script.sh unix_script.sh # Strip CR characters to convert Windows line endings to Unix
unix2dos unix_script.sh win_script.sh # Add CR characters to convert Unix line endings to Windows
recode ..HTML < draft.txt > draft.html # Transform a plain text document into HTML format
Filesystem Integrity Verification
badblocks -v /dev/sda1 # Scan a partition for damaged storage blocks
fsck /dev/sda1 # Run a generic filesystem consistency check
fsck.ext4 /dev/sda1 # Execute an ext4 specific filesystem repair utility
Storage Volume Formatting
mkfs.ext4 /dev/sdb1 # Format a partition with the ext4 filesystem
mkfs.xfs /dev/sdc1 # Format a partition with the XFS filesystem
mkfs.vfat -F 32 /dev/sdd1 # Construct a FAT32 filesystem on a partition
Swap Space Operations
mkswap /dev/sdb2 # Prepare a partition for use as swap space
swapon /dev/sdb2 # Activate a swap partition
swapon -s # Display current swap usage details
Data Synchronization and Backup Strategies
rsync -avz --delete /src/ /dest/ # Mirror source directory to destination preserving attributes
rsync -avz -e ssh /src/ user@host:/dest/ # Synchronize directory to a remote host via SSH
dd if=/dev/sda of=sda_backup.img bs=4M # Clone an entire block device to an image file
dd if=/dev/sda of=/dev/sdb bs=512 count=1 # Copy the Master Boot Record from one disk to another
tar -czvf etc_backup.tar.gz /etc/ # Create a compressed archive of the configuration directory
Network Interface Configuration and Diagnostics
ip addr show eth0 # Display IP addresses assigned to a specific interface
ip link set eth0 up # Bring a network interface online
ip link set eth0 down # Disable a network interface
ip addr add 10.0.0.5/24 dev eth0 # Assign a static IP address to an interface
ip route show # Output the current routing table
ip route add default via 10.0.0.1 # Define the default gateway
hostname # Print the system's hostname
nslookup domain.com # Resolve DNS records for a domain
ss -tupl # List all active TCP and UDP listening sockets
tcpdump port 443 # Capture network traffic traversing port 443