Linux Commands List with Usage Examples

Linux commands are typed in a terminal to work with files, directories, processes, packages, users, networking, disk space, and system information. This page gives a practical Linux commands list for beginners and system administrators, with short descriptions and command-line examples.

To learn the full options for any command on your system, use man, info, or the command’s built-in help option. Manual pages are usually the most reliable reference because command behavior can vary slightly by Linux distribution and installed version.

</>
Copy
man ls
info coreutils 'ls invocation'
ls --help

How to Read Linux Command Syntax

A Linux command usually has a command name, options, and arguments. Options change the behavior of the command, while arguments tell the command what file, directory, user, host, or pattern to work on.

</>
Copy
command -option argument
command --long-option argument

For example, in the command below, ls is the command, -l is an option, and /var/log is the directory argument.

</>
Copy
ls -l /var/log

Linux File and Directory Commands

These Linux terminal commands are used for moving around the file system, listing files, creating directories, copying files, renaming files, and removing files.

CommandDescriptionUsage
catDisplays file contents or joins files and prints them to standard output.cat content.txt
cdChanges the current working directory.cd /home/local/
cpCopies files or directories. The copied file is independent of the original file.cp file.txt /home/user/
fileShows the type of a file, such as text, image, executable, or compressed archive.file script.sh
findSearches for files and directories under a given path using names, types, sizes, times, and other expressions.find . -iname "HelloWorld.java"
lnCreates hard links or symbolic links between files.ln -s /var/www/html site
locateSearches an indexed file-name database and returns matching paths. It may require an updated database.locate "*.mp3"
lsLists files and directories.ls -la
mkdirCreates one or more directories.mkdir NewDirectory
mvMoves or renames files and directories.mv file.txt /home/user/samples/
pwdPrints the full path of the current working directory.pwd
rmRemoves files. By default, it does not remove directories unless recursive options are used.rm textfile.txt
rmdirRemoves empty directories.rmdir NewDirectory
touchCreates an empty file or updates file access and modification times.touch file.txt
treeDisplays directories and files in a tree-like layout when the command is installed.tree /etc

Linux Text Viewing and Text Processing Commands

Use these Linux commands to view text files, search inside files, sort lines, compare files, count text, and transform text streams.

CommandDescriptionUsage
awkScans and processes text by fields and patterns. It is commonly used in reports and shell scripts.awk '{print $1}' access.log
cutExtracts selected columns or fields from each line of input.cut -d ':' -f1 /etc/passwd
diffCompares files line by line and shows the differences.diff old.txt new.txt
echoWrites text to standard output.echo 'HELLO'
grepSearches for lines that match a pattern.grep -r "arjun" *
headDisplays the first lines of a file.head -n 20 app.log
lessOpens a text file for scrolling and searching without editing the file.less /var/log/syslog
moreDisplays file contents page by page.more README.txt
sedEdits text streams. It is commonly used for substitutions and line-based transformations.sed 's/error/warning/g' app.log
sortSorts lines from a file or standard input.sort sample.txt
tailDisplays the last lines of a file. With -f, it follows new lines as they are written.tail -f /var/log/syslog
uniqFilters adjacent duplicate lines, often used after sort.sort names.txt | uniq
wcCounts lines, words, and bytes in files or input.wc -l users.txt

Linux Permission, Ownership, and User Commands

Linux permissions control who can read, write, or execute a file. These commands are important when managing scripts, shared directories, web files, and administrative tasks.

CommandDescriptionUsage
chmodChanges file or directory permissions.chmod 755 content.txt
chownChanges the owner and group of files or directories.sudo chown user:www-data index.html
groupsShows the groups for a user.groups arjun
idPrints user ID, group ID, and group membership information.id
passwdChanges a user’s password.passwd
suSwitches to another user account or starts a root shell when allowed.su -
sudoRuns a command as another user, commonly as the superuser, according to system policy.sudo rm textfile.txt
umaskShows or sets default permission masks for newly created files and directories.umask
useraddAdds a new user account. Options may vary by distribution.sudo useradd demo
usermodModifies an existing user account, such as adding the user to a group.sudo usermod -aG sudo demo
whoamiPrints the current effective user name.whoami

Linux Disk Space and Storage Commands

These Linux commands help you check disk usage, mounted file systems, block devices, and storage-related information.

CommandDescriptionUsage
blkidPrints block device attributes such as UUID and file system type.sudo blkid
dfReports used and available disk space on mounted file systems.df -h
duReports disk usage for files and directories.du -sh /var/log
fdiskViews or manages disk partition tables. Administrative permissions are usually required.sudo fdisk -l
lsblkLists block devices in a readable tree format.lsblk
mountMounts a file system or displays currently mounted file systems.mount
umountUnmounts a mounted file system.sudo umount /mnt/usb

Linux Process and System Monitoring Commands

Use these commands to inspect running processes, memory usage, logged-in users, uptime, and system status.

CommandDescriptionUsage
freeDisplays memory usage and swap usage.free -h
htopInteractive process viewer when installed. It is commonly used as a more readable alternative to top.htop
killSends a signal to a process, commonly to terminate it.kill 1234
killallSends a signal to processes by command name.killall firefox
psDisplays information about running processes.ps aux
systemctlControls and inspects systemd services on distributions that use systemd.sudo systemctl status nginx
topDisplays an interactive real-time view of running processes and resource usage.top
uptimeShows how long the system has been running and the load average.uptime
wShows logged-in users and what they are doing.w

Linux Networking Commands

Networking commands help you test connectivity, inspect IP addresses, download files, connect to remote systems, and troubleshoot ports.

CommandDescriptionUsage
curlTransfers data from or to a server. It is commonly used for HTTP requests and API testing.curl https://example.com
digQueries DNS records when the command is installed.dig example.com
hostnamePrints or sets the host name. With -I, it prints assigned IP addresses.hostname -I
ipShows and manages IP addresses, routes, and network interfaces.ip addr show
netstatDisplays network connections and listening ports on systems where the command is available.netstat -tulpn
pingSends ICMP echo requests to test whether a host is reachable.ping www.google.com
scpCopies files securely between local and remote systems over SSH.scp file.txt user@example.com:/tmp/
ssDisplays socket statistics and is commonly used to inspect listening ports.ss -tulpn
sshLogs in to a remote machine and runs commands over an encrypted connection.ssh user@example.com
tracerouteShows the network path to a host when the command is installed.traceroute example.com
wgetDownloads files from the web using HTTP, HTTPS, or FTP.wget https://example.com/file.zip

Linux Package Management Commands

Package commands depend on the Linux distribution. Debian and Ubuntu systems commonly use APT, Red Hat-based systems commonly use DNF or YUM, Arch Linux uses pacman, and SUSE uses zypper.

CommandDescriptionUsage
apt-getCommand-line tool for handling packages on Debian-based systems. It is often used in scripts.sudo apt-get install package_name
aptUser-friendly package command for Debian-based systems such as Ubuntu.sudo apt install package_name
dnfPackage manager used on many Fedora and Red Hat-based systems.sudo dnf install package_name
dpkgLow-level Debian package tool for installing, querying, and removing .deb packages.dpkg -l
pacmanPackage manager used on Arch Linux and related distributions.sudo pacman -S package_name
rpmLow-level package tool for RPM packages.rpm -qa
yumPackage manager used on older Red Hat-based systems and some compatible distributions.sudo yum install package_name
zypperPackage manager used on openSUSE and SUSE Linux Enterprise systems.sudo zypper install package_name

Linux Archive and Compression Commands

These Linux commands are used to create archives, extract files, and compress or decompress data.

CommandDescriptionUsage
gzipCompresses a file using gzip compression.gzip access.log
gunzipDecompresses a gzip-compressed file.gunzip access.log.gz
tarCreates and extracts archive files.tar -cvf images.tar /home/arjun/images/
unzipExtracts files from a ZIP archive.unzip archive.zip
zipCreates ZIP archive files.zip archive.zip file1.txt file2.txt

Linux Editors and Help Commands

Linux systems usually include text editors and help tools. Availability may differ by distribution and installation profile.

CommandDescriptionUsage
aliasCreates a shortcut for a command in the current shell session.alias ll='ls -la'
historyShows previously executed shell commands.history
manOpens online manual pages for commands and system interfaces.man grep
nanoOpens the GNU nano text editor, which is simple for quick edits.nano content.txt
typeShows how a command name is interpreted by the shell.type cd
viOpens the vi editor for editing plain text files.vi HelloWorld.java
whichPrints the path of an executable command found in the user’s PATH.which python3

Linux System Information and Shutdown Commands

These commands show operating system details, kernel information, date and time, and system power actions.

CommandDescriptionUsage
calDisplays a calendar when installed.cal
datePrints or sets the system date and time.date
dmesgPrints kernel ring buffer messages. It is often used for hardware and boot troubleshooting.sudo dmesg | less
envDisplays environment variables or runs a command with a modified environment.env
rebootRestarts the system when permitted.sudo reboot
shutdownHalts, powers off, or reboots the machine at a specified time.sudo shutdown -h now
unamePrints system and kernel information.uname -a

Common Linux Command Examples for Daily Use

The examples below combine common Linux commands in realistic terminal tasks.

</>
Copy
# Show the current directory and list files
pwd
ls -la

# Create a directory and copy a file into it
mkdir backups
cp notes.txt backups/

# Find large log files under /var/log
sudo find /var/log -type f -size +100M

# Check disk space in human-readable format
df -h

# Follow a log file as new lines are written
tail -f /var/log/syslog

Linux Command Safety Tips for Beginners

Some Linux commands can permanently change files or system settings. Be careful with commands that remove files, overwrite data, change permissions, or run with sudo.

  • Run pwd before destructive file commands so you know your current directory.
  • Use ls to confirm file names before using rm, mv, or cp.
  • Avoid using sudo unless administrative permission is really required.
  • Be careful with recursive commands such as rm -r, chmod -R, and chown -R.
  • Prefer testing commands on sample files before running them on important directories.

Linux Commands FAQ

What is the most useful Linux command for beginners?

The most useful beginner Linux commands are pwd, ls, cd, cat, cp, mv, rm, mkdir, man, and sudo. These commands cover navigation, file handling, help, and administrative execution.

How do I get help for a Linux command in the terminal?

Use man command_name, info command_name, or command_name --help. For example, run man grep to read the manual page for grep.

What is the difference between apt and apt-get?

apt is a user-friendly command-line package tool commonly used interactively on Debian-based systems. apt-get is an older command-line package tool that is still widely used, especially in scripts and documentation.

Which Linux command shows disk space?

Use df -h to show available and used disk space on mounted file systems. Use du -sh directory_name to check how much space a specific directory uses.

Which Linux command is used to search inside files?

Use grep to search inside files. For example, grep -r "error" /var/log searches recursively for the word error inside files under /var/log.

Editorial QA Checklist for This Linux Commands Reference

  • Verify that each command example uses a valid Linux terminal syntax.
  • Check distribution-specific commands such as apt, dnf, yum, pacman, and zypper before applying them on a real system.
  • Confirm that commands requiring administrative permission are clearly shown with sudo.
  • Review destructive examples involving rm, chmod, chown, shutdown, and reboot for safe wording.
  • Keep command descriptions short enough for quick scanning while still explaining the practical use.

Conclusion on Linux Commands

This Linux commands list covers the terminal commands most users need for file handling, text processing, permissions, storage, networking, packages, system monitoring, archives, editors, and system information. For exact options and distribution-specific behavior, check the manual page with man or the help output available on your Linux system.