While Windows dominates the desktop world, Linux is the undisputed king of servers, cloud infrastructure, development environments, and cybersecurity tools. For any IT professional, proficiency in the Linux command line is not just a bonus—it's a fundamental requirement. This guide provides a categorized table of the most vital Linux commands you need to master to efficiently manage systems, troubleshoot issues, and automate tasks.
The Linux Command Line: Your Gateway to Control
The terminal might seem daunting at first, but it offers unparalleled power, precision, and the ability to automate complex tasks through scripting. Unlike graphical interfaces, the command line allows you to perform operations on multiple systems simultaneously via SSH, dig deep into system logs, and manipulate data with powerful text-processing tools.
Conventions Used:
$- Indicates a command that can be run by a regular user.#- Indicates a command that requires root (administrative) privileges. Typically used withsudo.Essential Linux Commands Reference Table
# Command Explanation Sample Usage System Information & Monitoring 1 unamePrints system information (kernel version, hardware name) uname -a2 uptimeShows how long the system has been running and load average uptime3 top/htopDynamic real-time view of running processes (system monitor) top,htop4 dfReports disk space usage on filesystems df -h5 duEstimates file and directory space usage du -sh /home/6 freeDisplays amount of free and used memory in the system free -h7 lsb_releaseDisplays Linux Standard Base and distribution information lsb_release -a8 lscpuDisplays information about the CPU architecture lscpu9 lsblkLists information about all available block devices lsblk10 lshwLists detailed information on hardware configuration sudo lshw -shortFile & Directory Operations 11 lsLists directory contents ls -la12 cdChanges the current working directory cd /var/log13 pwdPrints the path of the current working directory pwd14 mkdirCreates directories mkdir new_folder15 touchCreates an empty file or updates file timestamps touch newfile.txt16 cpCopies files and directories cp file.txt /backup/17 mvMoves or renames files and directories mv oldname.txt newname.txt18 rmRemoves files or directories rm file.txt,rm -r directory/19 catConcatenates and displays file content cat config.conf20 less/moreViews file content one page at a time less longfile.log21 headOutputs the first part of files head -n 20 logfile.log22 tailOutputs the last part of files; crucial for logs tail -f /var/log/syslog23 findSearches for files in a directory hierarchy find /home -name "*.conf"24 locateFinds files by name quickly (uses pre-built database) locate httpd.conf25 grepSearches for patterns in text; an IT powerhouse grep "ERROR" logfile.log26 awkPattern scanning and text processing language awk '{print $1}' file.txt27 sedStream editor for filtering and transforming text sed 's/foo/bar/g' file.txt28 chmodChanges file mode bits (permissions) chmod +x script.sh29 chownChanges file owner and group sudo chown user:group file30 tarArchives files without compression (Tape ARchive) tar -cvf archive.tar files/31 gzip/gunzipCompression and decompression tool gzip file.txt32 zip/unzipPackage and compress (archive) files zip archive.zip files/Networking 33 ipShows / manipulates routing, network devices, interfaces ip a,ip route34 ifconfigLegacy command to configure network interfaces (use ip)ifconfig35 pingTests reachability of a host on an IP network ping google.com36 traceroutePrints the route packets take to a network host traceroute example.com37 netstatDisplays network connections, routing tables, interface stats netstat -tulnp38 ssSocket statistics; modern replacement for netstatss -tuln39 digDNS lookup utility dig example.com40 nslookupQuery Internet name servers interactively nslookup example.com41 whoisClient for the whois directory service whois example.com42 wgetNon-interactive network downloader wget http://example.com/file.iso43 curlTransfer data from or to a server; supports many protocols curl -O http://example.com/file.txt44 sshSecure Shell; logs into a remote machine securely ssh user@hostname45 scpSecurely copies files between hosts over SSH scp file.txt user@host:/path/46 rsyncFast, versatile, remote file-copying tool rsync -avz /src/ user@host:/dest/47 ufwUncomplicated Firewall; simplifies iptablesmanagementsudo ufw allow 22/tcp48 iptablesAdministration tool for IPv4 packet filtering and NAT sudo iptables -L49 tcpdumpPowerful command-line packet analyzer sudo tcpdump -i eth050 nmapNetwork exploration and security auditing tool nmap -sV 192.168.1.1Process Management 51 psReports a snapshot of current processes ps aux52 killSends a signal to a process, usually to terminate it kill 123453 killallKills processes by name killall process_name54 pkillKills processes based on name and other attributes pkill -f "process_name"55 bg/fgPuts a job in the background / brings it to the foreground bg %1,fg %156 jobsLists active jobs jobs57 niceRuns a program with modified scheduling priority nice -n 10 command58 reniceAlters the priority of running processes renice -n 5 -p 123459 nohupRuns a command immune to hangups, output to nohup.out nohup long_running_script.sh &User & Permission Management 60 sudoExecute a command as the superuser or another user sudo apt update61 suSwitch user or become superuser su - username62 useradd/adduserCreates a new user account sudo useradd newuser63 usermodModifies a user account sudo usermod -aG sudo user64 passwdChanges user password passwd65 idPrints real and effective user and group IDs id66 groupsPrints the groups a user is in groups usernamePackage Management (Debian/Ubuntu) 67 aptHigh-level package management tool (Debian/Ubuntu) sudo apt update68 apt-getCLI tool for handling packages (older but still used) sudo apt-get install package69 dpkgLow-level package manager for Debian-based systems sudo dpkg -i package.debPackage Management (RHEL/CentOS/Fedora) 70 yumOlder package manager for RHEL/CentOS sudo yum install package71 dnfModern replacement for YUM (Fedora/RHEL8+) sudo dnf install package72 rpmLow-level package manager for RPM-based systems rpm -qi package_namePower & Scripting 73 echoDisplays a line of text echo "Hello World"74 whichLocates a command and displays the path to the binary which python75 whereisLocates the binary, source, and manual pages for a command whereis ls76 historyShows command history history77 aliasCreates shortcuts for longer commands alias ll='ls -alF'78 cron/crontabSchedules commands to run at specific times crontab -e79 systemctlControls the systemd system and service manager systemctl status nginx80 journalctlQueries and displays logs from journald (systemd) journalctl -u nginx -f
Add New Comment