Linux-Commands

Author

K19G

Published

August 7, 2025

Introduction

Welcome to the Linux Commands Reference guide! This comprehensive guide provides detailed documentation for essential Linux commands, including syntax, options, practical examples, and best practices.

Command Documentation Template

Each command is documented following this consistent template:

  1. Command Overview - Brief description of the command’s purpose
  2. Syntax - Basic command syntax and structure
  3. Common Options - Table of frequently used options
  4. Key Use Cases - Primary applications and scenarios
  5. Examples with Explanations - Practical examples with detailed explanations
  6. Understanding Output - Explanation of command output fields
  7. Common Usage Patterns - Typical usage scenarios and patterns
  8. Performance Analysis - Tips for performance monitoring and analysis
  9. Related Commands - Other relevant commands
  10. Additional Resources - References and further reading

Command Categories

1. Help and Documentation

  • man - Manual pages for commands
  • info - View command information
  • help - Display help for shell builtins
  • whatis - Display one-line command descriptions
  • apropos - Search manual page names and descriptions

2. File and Directory Management

  • ls - List directory contents
  • cd - Change directory
  • pwd - Print working directory
  • mkdir - Make directories
  • rmdir - Remove empty directories
  • cp - Copy files and directories
  • mv - Move/rename files
  • rm - Remove files or directories
  • touch - Create empty files/update timestamps
  • cat - Concatenate and display files
  • head - Output the first part of files
  • tail - Output the last part of files
  • less - View file contents interactively
  • more - View file contents page by page
  • tree - Display directory structure
  • find - Search for files
  • locate - Find files by name
  • which - Show full path of commands
  • whereis - Locate binary, source, and manual files

3. Archiving and Compression

  • tar - Archive files
  • gzip - Compress files
  • bzip2 - Block-sorting file compressor
  • zip/unzip - Package and compress files
  • cpio - Copy files to and from archives
  • dd - Convert and copy files
  • dump/restore - Backup and restore utilities

4. System Information

  • uname - Print system information
  • hostname - Show or set system host name
  • hostnamectl - Control system hostname
  • df - Report file system disk space usage
  • du - Estimate file space usage
  • free - Display memory usage
  • lsdev - Display information about installed hardware
  • lsmod - Show status of kernel modules
  • lspci - List PCI devices
  • lsusb - List USB devices
  • hwinfo - Hardware information tool
  • uptime - Show system running time

5. Process Management

  • ps - Report process status
  • top - Display system processes
  • htop - Interactive process viewer
  • kill - Terminate processes
  • killall - Kill processes by name
  • pkill - Signal processes based on name
  • pgrep - List processes based on name
  • nice - Run with modified scheduling priority
  • renice - Alter process priority
  • pidof - Find process ID of a program
  • pstree - Display process tree
  • chroot - Run command with special root directory

6. System Monitoring

  • atop - Advanced system and process monitor
  • iostat - Report CPU and I/O statistics
  • mpstat - Report processor related statistics
  • vmstat - Report virtual memory statistics
  • sar - Collect and report system activity
  • nfsstat - NFS statistics
  • lsof - List open files
  • traceroute - Print network route
  • w - Show who is logged in and what they’re doing

7. User and Group Management

  • useradd - Create new user
  • usermod - Modify user account
  • userdel - Delete user account
  • groupadd - Create new group
  • groupmod - Modify group definition
  • groupdel - Delete group
  • passwd - Change user password
  • chown - Change file owner and group
  • chmod - Change file permissions
  • id - Print user and group IDs
  • who - Show who is logged in
  • w - Show logged in users and activity
  • last - Show listing of last logged in users
  • su - Switch user
  • sudo - Execute command as another user

8. Networking

  • ping - Test network connectivity
  • ifconfig - Configure network interface
  • ip - Show/manipulate routing, devices, policy routing
  • netstat - Network statistics
  • ss - Socket statistics
  • route - Show/manipulate IP routing table
  • arp - Manipulate ARP cache
  • dig - DNS lookup utility
  • nslookup - Query DNS
  • host - DNS lookup utility
  • whois - Domain information groper
  • ssh - Secure shell client
  • scp - Secure copy
  • rsync - Remote file copy utility
  • ftp - File transfer protocol
  • wget - Network downloader
  • curl - Transfer data from/to server
  • tcpdump - Network packet analyzer
  • nmap - Network exploration tool
  • traceroute - Print the route packets trace
  • mtr - Network diagnostic tool

9. File System Management

  • mount - Mount a filesystem
  • umount - Unmount a filesystem
  • fsck - Check and repair filesystem
  • mkfs - Build a Linux filesystem
  • mke2fs - Create ext2/ext3/ext4 filesystem
  • df - Report filesystem disk space usage
  • du - Estimate file space usage
  • swapon/swapoff - Enable/disable swap space

10. System Runtime

  • shutdown - Bring system down
  • reboot - Restart system
  • poweroff - Power off system
  • init - Process control initialization
  • runlevel - Print previous and current runlevel
  • halt - Stop system

11. Scheduling

  • at - Execute commands at specified time
  • atq - List pending jobs
  • atrm - Remove jobs
  • batch - Execute commands when load permits
  • crontab - Schedule periodic background work

12. Logging

  • logger - Make entries in system log
  • klogd - Kernel log daemon
  • syslogd - System log daemon
  • sysklog - System and kernel log daemon

13. Hardware Management

  • lshw - List hardware
  • lspci - List PCI devices
  • lsusb - List USB devices
  • lshal - List HAL devices
  • eject - Eject removable media

14. Printing

  • lp - Print files
  • lpq - Show printer queue
  • lprm - Remove print jobs
  • lpstat - Print system status

15. Package Management

  • rpm - RPM Package Manager
  • yum - Package manager for RPM systems