Linux Commands | The Complete Comprehensive List
Here at IOFLOOD, a solid understanding of Linux commands is crucial for maintaining the health of our customer’s dedicated servers. Drawing from our years of experience in managing servers and linux systems, we have crafted this complete Linux commands list. Our hope is that these insights can prove a useful resource for our customers as well as other Linux users.
In this Linux Commands Reference Guide, each command is presented in organized tables, accompanied by a brief explanation and a sample usage syntax. For those looking to dive deeper, many commands also include links to related articles covering installation and usage. These extra resources will be invaluable for mastering the usage of each command.
Whether you’re looking to troubleshoot a problem, optimize your workflow, or explore new options, this reference is your compass in the Linux universe. Let’s get started and unlock the full potential of Linux!
Table of Contents
System Information and Management
In this section, you’ll find Linux commands that help you retrieve information about processes, environment variables, system configuration, hardware details, and system uptime and allow you to monitor and manage system resources.
Command | Explanation | Example Usage |
---|---|---|
apropos (Installation) | Searches the man pages. | apropos keyword |
arch (Installation) | Displays the machine architecture. | arch |
chroot (Installation) | Changes the root directory. | sudo chroot /new/root |
env (Installation) | Displays, sets, or removes environment variables. | env |
free (Installation) | Displays the total amount of free and used memory in the system. | free -m |
history | Displays the command history. | history |
hostname (Installation) | Shows or sets the system’s host name. | hostname |
i3 (Installation) | A tiling window manager, completely written from scratch. | i3 |
lsblk (Installation) | Lists information about block devices. | lsblk |
lspci (Installation) | Lists all PCI devices. | lspci |
man (Installation) | Displays the manual for a command. | man ls |
modprobe (Installation) | Adds or removes modules from the Linux kernel. | modprobe module_name |
neofetch (Installation) | Displays system information in an aesthetic way. | neofetch |
reboot (Installation) | Restarts the system. | reboot |
stat (Installation) | Displays file or filesystem status. | stat filename |
strace (Installation) | Traces system calls and signals. | strace -p PID |
sysctl (Installation) | Configures kernel parameters at runtime. | sysctl -p |
systemctl (Installation) | Controls the systemd system and service manager. | systemctl status service_name |
systemd (Installation) | System and service manager for Linux. | systemd |
tee (Installation) | Reads from standard input and writes to standard output and files. | echo "Hello" | tee file.txt |
tty (Installation) | Prints the file name of the terminal connected to standard input. | tty |
uname (Installation) | Shows system information. | uname -a |
uptime (Installation) | Tells how long the system has been running. | uptime |
File and Directory Operations
In this section, you’ll discover fundamental Linux commands for working with files and directories. These commands will enable you to create, modify, manage, and navigate through files and directories efficiently.
Command | Explanation | Example Usage |
---|---|---|
cd | Changes the current directory. | cd /var/log |
chmod (Installation) | Changes the file mode (permissions). | chmod 755 script.sh |
cp (Installation) | Copies files and directories. | cp file.txt /tmp/ |
diff (Installation) | Compares files line by line. | diff file1 file2 |
dos2unix (Installation) | Converts text files from DOS to Unix format. | dos2unix file.txt |
file (Installation) | Determines file type. | file example.txt |
find (Installation) | Searches for files in a directory hierarchy. | find / -name "example.txt" |
gunzip (Installation) | Decompresses gzipped files. | gunzip file.gz |
gzip (Installation) | Compresses or decompresses files. | gzip file |
ln (Installation) | Creates a link to a file or directory. | ln -s /path/to/file /path/to/link |
locate (Installation) | Finds files by name quickly using a database. | locate example.txt |
logrotate (Installation) | Rotates, compresses, and mails system logs. | logrotate config_file |
ls (Installation) | Lists the contents of a directory. | ls -l /home/user |
lsof (Installation) | Lists open files and the processes that opened them. | lsof |
mkdir (Installation) | Creates a new directory. | mkdir /tmp/newdir |
mv (Installation) | Moves or renames files and directories. | mv file.txt /tmp/newname.txt |
rm (Installation) | Removes files or directories. | rm -rf /tmp/oldfiles |
rmdir (Installation) | Removes empty directories. | rmdir /tmp/emptydir |
tar (Installation) | Archives files into a tarball or extracts them. | tar -czvf archive.tar.gz /path/to/dir |
touch (Installation) | Creates a new empty file or updates the timestamp of an existing file. | touch /tmp/newfile.txt |
unrar (Installation) | Extracts files from RAR archives. | unrar x archive.rar |
unzip (Installation) | Extracts files from a zip archive. | unzip archive.zip |
whereis (Installation) | Locates the binary, source, and manual pages for a command. | whereis ls |
which | Locates the full path of shell commands. | which ls |
Package Management
In this section, you’ll explore key Linux commands that streamline the installation, update, and removal of software packages on your system and are integral to managing software packages efficiently. Whether you’re installing new applications, updating existing packages, or removing unwanted software, these commands provide the necessary tools to maintain a well-managed Linux system.
Command | Explanation | Example Usage |
---|---|---|
apt-get | Package management system for Debian/Ubuntu. | sudo apt-get update && sudo apt-get upgrade |
aptitude (Installation) | Alternative package manager for Debian/Ubuntu, with a UI and more features. | sudo aptitude search package_name |
dnf (Installation) | Fedora’s package manager since Fedora 22, replacing yum. | sudo dnf update |
dpkg (Installation) | Debian package manager, used to install, remove, and provide information about .deb packages. | dpkg -i package_file.deb |
git (Installation) | Distributed version control system used for source code management. | git clone https://github.com/u/repo.git |
rpm (Installation) | RPM Package Manager, used in Red Hat, Fedora, and others. | rpm -ivh package_file.rpm |
yum (Installation) | Package manager for Red Hat/Fedora before Fedora 22, manages RPM packages. | yum install package_name |
Networking
In the “Networking” section, you’ll explore Linux commands that deal with network monitoring, configuration, and troubleshooting. These commands are invaluable tools for managing network operations effectively on your Linux system, diagnosing network problems, or fetching data from remote servers.
Command | Explanation | Example Usage |
---|---|---|
arp (Installation) | Manipulates the ARP cache. | arp -a |
curl (Installation) | Transfers data from or to a server, using one of the supported protocols. | curl -O http://example.com/file |
dig (Installation) | Queries DNS servers for information. | dig example.com |
ethtool (Installation) | Displays or changes Ethernet card settings. | ethtool eth0 |
ftp (Installation) | Standard network protocol for transferring files. | ftp ftp.example.com |
host (Installation) | DNS lookup utility. | host example.com |
ifconfig (Installation) | Configures and displays network interface parameters. | ifconfig eth0 |
ip (Installation) | Manipulates and displays IP networking information. | ip addr show |
iptables (Installation) | Administration tool for IPv4 packet filtering and NAT. | iptables -L |
mtr (Installation) | Combines the functionality of the ‘traceroute’ and ‘ping’ programs. | mtr example.com |
nc or netcat (Installation) | Networking utility for reading from and writing to network connections. | nc example.com 80 or netcat example.com 80 |
ncat (Installation) | Improved re-implementation of the Unix netcat utility. | ncat example.com 80 |
netstat (Installation) | Displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. | netstat -tuln |
nmcli (Installation) | Command-line tool for controlling NetworkManager. | nmcli d |
nmap (Installation) | Network exploration tool and security / port scanner. | nmap -A example.com |
nmtui (Installation) | Text user interface for NetworkManager. | nmtui |
nslookup (Installation) | Queries Internet domain name servers. | nslookup example.com |
ping (Installation) | Sends ICMP ECHO_REQUEST packets to network hosts. | ping example.com |
route (Installation) | Shows or manipulates the IP routing table. | route -n |
scp (Installation) | Secure copy (remote file copy program). | scp localfile user@remote:/remotepath |
sftp (Installation) | Secure File Transfer Protocol. | sftp user@host |
ssh (Installation) | Secure Shell, a program to log into another computer over a network. | ssh [email protected] |
ss (Installation) | Utility to investigate sockets. | ss -tulw |
tcpdump (Installation) | Powerful command-line packet analyzer. | tcpdump -i eth0 |
telnet (Installation) | User command and TCP/IP protocol for accessing remote computers. | telnet example.com 23 |
traceroute (Installation) | Prints the route packets take to network host. | traceroute example.com |
wget (Installation) | Non-interactive network downloader. | wget http://example.com/file |
User and Group Management
In this section, you’ll explore Linux commands focused on managing users and groups, providing tools for user account administration and permissions management. These commands enable you to create new user accounts, modify user attributes, manage user privileges, create groups, and change group ownership of files and directories. and should generally offer essential utilities for user and group management tasks.
Command | Explanation | Example Usage |
---|---|---|
adduser (Installation) | Interactive script to add a new user. | adduser newusername |
chage (Installation) | Changes the number of days between password changes and the date of the last password change. | chage -d 0 username |
chgrp (Installation) | Changes group ownership. | chgrp newgroup file |
chown (Installation) | Changes file owner and group. | chown newowner:newgroup file |
groupadd (Installation) | Adds a new group to the system. | groupadd newgroup |
passwd (Installation) | Updates a user’s authentication tokens/password. | passwd username |
su (Installation) | Substitute user identity. | su - username |
sudo (Installation) | Executes a command as another user, according to the security policy. | sudo apt-get update |
useradd (Installation) | Low-level utility for adding users. | useradd -m newusername |
usermod (Installation) | Modifies a user account. | usermod -aG sudo newusername |
Process Management
In the “Process Management” section, you’ll discover Linux commands dedicated to managing processes, offering tools for controlling and monitoring running programs effectively. These commands, including atop, pkill, nohup, and kill, enable you to monitor process activity, terminate processes, run processes in the background, and schedule tasks. Whether you’re analyzing process performance, stopping specific processes, running processes in the background, or managing process termination, these commands provide essential utilities for process management tasks on your Linux system.
Command | Explanation | Example Usage |
---|---|---|
atop (Installation) | Advanced system and process monitor. | atop |
fg | Moves jobs to the foreground. | fg %jobnumber |
kill (Installation) | Sends a signal to a process, typically to stop the process. | kill PID |
killall (Installation) | Kills processes by name (as opposed to PID). | killall processname |
nohup (Installation) | Runs a command immune to hangups, with output to a non-tty. | nohup command & |
pgrep (Installation) | Looks up processes based on name and other attributes. | pgrep -u username |
pkill (Installation) | Sends signals to processes based on name and other attributes. | pkill processname |
ps (Installation) | Displays information about active processes. | ps aux |
Text Processing
In “Text Processing”, you’ll explore a collection of Linux commands designed for manipulating and processing text data, such as: awk
, uniq
, nano
, and more. Whether you need to extract specific fields, remove duplicate lines, sort data alphabetically or numerically, search for patterns, edit text files, or view text content, these commands will be your go-to.
Command | Explanation | Example Usage |
---|---|---|
awk (Installation) | Pattern scanning and processing language. | awk '/pattern/ {print $0}' file.txt |
cat (Installation) | Concatenates and displays files. | cat file.txt |
cut (Installation) | Removes sections from each line of files. | cut -d':' -f1 /etc/passwd |
echo (Installation) | Displays a line of text. | echo "Hello, World!" |
emacs (Installation) | Extensible, customizable text editor. | emacs file.txt |
grep (Installation) | Searches for patterns in files. | grep 'pattern' file.txt |
head (Installation) | Displays the first part of files. | head -n 5 file.txt |
less (Installation) | Similar to more , but allows backward movement in the file as well as forward movement. | less /var/log/syslog |
more (Installation) | Views file contents page by page. | more /var/log/syslog |
nano (Installation) | Easy to use text editor. | nano file.txt |
paste (Installation) | Merges lines of files. | paste file1.txt file2.txt |
sed (Installation) | Stream editor for filtering and transforming text. | sed 's/original/replacement/' file.txt |
sort (Installation) | Sorts lines of text files. | sort file.txt |
tail (Installation) | Displays the last part of files. | tail -n 5 file.txt |
uniq (Installation) | Reports or omits repeated lines. | uniq file.txt |
vim (Installation) | Highly configurable text editor. | vim file.txt |
wc (Installation) | Prints newline, word, and byte counts for each file. | wc -l file.txt |
Disk and File System Management
In this section, you’ll encounter Linux commands focused on managing disks and file systems, providing tools for storage management and partitioning. Whether you’re analyzing disk space usage, managing mounted filesystems, mounting external storage devices, or resizing partitions, these commands offer essential utilities for disk and file system management in Linux.
Command | Explanation | Example Usage |
---|---|---|
dd (Installation) | Converts and copies a file, can be used for creating disk images. | sudo dd if=/dev/sda of=/path/to/backup.img |
df | Displays the amount of disk space used and available on filesystems. | df -h |
du (Installation) | Estimates file space usage. | du -sh /path/to/directory |
fdisk (Installation) | Partition table manipulator for Linux. | sudo fdisk /dev/sda |
gparted (Installation) | GNOME partition editor for manipulating disk partitions graphically. | gparted (GUI application) |
lsblk (Installation) | Lists information about all available or specified block devices. | lsblk |
mkfs (Installation) | Builds a Linux filesystem on a device, usually a partition. | sudo mkfs.ext4 /dev/sda1 |
mount (Installation) | Mounts a filesystem on a directory. | sudo mount /dev/sda1 /mnt |
umount (Installation) | Unmounts a mounted filesystem. | sudo umount /mnt |
System Monitoring and Performance
In this section, you’ll explore Linux commands, including free, top, journalctl, and htop, that provide real-time insights into memory usage, CPU utilization, system processes, and system logs. These commands offer valuable tools for optimizing system performance and ensuring smooth operation on your Linux system.
Command | Explanation | Example Usage |
---|---|---|
dmesg (Installation) | Prints or controls the kernel ring buffer. | dmesg | grep USB |
free (Installation) | Displays the amount of free and used memory in the system. | free -m |
htop (Installation) | An interactive process viewer, considered an upgrade to top . | htop |
journalctl (Installation) | Queries and displays messages from the journal. | journalctl -p err -b |
sar (Installation) | Collects, reports, or saves system activity information. | sar -u 1 3 |
top (Installation) | Displays a dynamic real-time view of running processes. | top |
Scripting and Automation
In the “Scripting and Automation” section, you’ll delve into Linux commands great for scripting and automating tasks. Whether you’re creating custom aliases, processing command outputs, implementing conditional statements, scheduling cron jobs, or writing Bash scripts, these commands are indispensable for scripting and automation.
Command | Explanation | Example Usage |
---|---|---|
alias (Installation) | Creates an alias for a command | alias ll='ls -l' |
ansible | Automates cloud provisioning, configuration management, and application deployments. | ansible-playbook playbook.yml |
bash (Installation) | GNU Bourne-Again SHell, a sh-compatible command language interpreter. | bash script.sh |
case | Conditionally executes a block of commands. | case $var in pattern) commands ;; esac |
crontab (Installation) | Schedules scripts or commands to run at specified times and dates. | crontab -e |
expect (Installation) | Automates interactive applications according to a script. | expect script.exp |
for | Iterates over a list of items in shell scripts. | for i in {1..5}; do echo "Welcome $i"; done |
function | Defines a set of commands as a function. | function name { commands } |
if | Executes commands based on conditional execution. | if [ condition ]; then commands; fi |
make (Installation) | Automates the build process of projects. | make |
puppet-agent | Puppet Agent is responsible for managing the configuration of nodes (client machines) in a Puppet setup. | sudo puppet agent -t |
puppet-master | Puppet Master is the central server that stores and serves Puppet configurations to Puppet Agents. | sudo systemctl status puppet |
while | Executes commands as long as the condition is true. | while [ condition ]; do commands; done |
xargs (Installation) | Builds and execute command lines from standard input. | find . -type f -name '*.txt' | xargs grep 'searchstring' |
Security and Encryption
In this section, you’ll explore Linux commands for enhancing system security and implementing encryption measures. These commands are great tools for safeguarding your system from unauthorized access, encrypting communications, generating secure keys, or managing firewall settings.
Command | Explanation | Example Usage |
---|---|---|
fail2ban (Installation) | Scans log files and bans IPs that show malicious signs. | fail2ban-client status sshd |
firewalld (Installation) | A firewall management tool for dynamically managing a firewall with support for network/firewall zones. | firewall-cmd --state |
gpg (Installation) | GNU Privacy Guard, a tool for secure communication and data storage. | gpg --gen-key |
openssl (Installation) | Toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. | openssl genrsa -out private.key 2048 |
ssh-keygen (Installation) | Generates, manages, and converts authentication keys for ssh. | ssh-keygen -t rsa -b 4096 |
ufw (Installation) | Uncomplicated Firewall, a user-friendly front-end for managing iptables firewall rules. | ufw allow from 192.168.1.0/24 to any port 22 |
Miscellaneous Utilities
In this final section, you’ll encounter various Linux commands that offer a range of functionalities beyond specific categories. These commands provide diverse utilities for tasks like displaying messages, monitoring command output, managing terminal sessions, and manipulating date and time information.
Command | Explanation | Example Usage |
---|---|---|
bc (Installation) | An arbitrary precision calculator language. | echo "sqrt(25)" | bc -l |
date (Installation) | Displays or sets the system date and time. | date "+%Y-%m-%d %H:%M:%S" |
rsync (Installation) | Fast and versatile file copying tool that can synchronize files and directories between two locations over a network. | rsync -av source/ destination/ |
screen (Installation) | Allows you to manage multiple terminal sessions inside a single window. | screen -S session_name |
tmux (Installation) | A terminal multiplexer, it enables a number of terminals to be created, accessed, and controlled from a single screen. | tmux new -s session_name |
watch (Installation) | Executes a program periodically, showing output fullscreen. | watch -n 1 'date' |
Whether you’re a new Linux enthusiast or a seasoned professional, we hope that this guide empowers you with the knowledge and tools needed to navigate and manage your Linux environment with confidence. Keep exploring, experimenting, and learning, as the world of Linux commands is vast and continually evolving. Happy command line adventures!