This 50 powerful Linux commands cover everything you need to work confidently at the terminals, which are categorized into eight (8) different categories with examples that have been tested on RHEL, Rocky Linux, and Ubuntu . Additionally, each command example has working terminal output examples for your reference prior to executing the command.
Unless otherwise specified all 50 of the commands described above are included as a standard installation component of RHEL, Rocky Linux, Ubuntu, Debian, and most other popular Linux distributions. All commands that are labeled as sudo can only be executed with root-level access; attempting to execute these commands as a non-root user will result in an error message stating Permission Denied. Please see the Note Box located in Section VIII for further information regarding this topic.
Examples
Most Linux users only scratch the surface; these 50 commands unlock real power
If you are new to Linux we recommend starting with these ten (10) basic commands and become familiarized with them first. These ten (10) commands provide the ability to perform the majority of day-to-day operations directly within the terminal environment.
ls · cd · pwd · mkdir · cp · mv · cat · grep · sudo · ssh
Once you are comfortable with these ten (10), then proceed to complete the remaining seven (7) sections. If you would like a more gentle introduction to learning Linux commands then check out our Linux Commands for Beginners Guide.
File & Directory Management
These ten (10) commands allow you to interact with the file system and include: create and remove files, copy and move data, and search for anything on disk. You will use them every single time you open a terminal.
ls — List Files and Directories
The ls command which displays the contents of a directory. When combined with the -lah option it also displays: the size of the items contained within the directory in human readable format; their permissions; who owns them; what group they belong to; and when the item was modified. It also includes display of hidden files. For additional reading on how to properly utilize the ls command refer to our Basic ls Command Tutorial.
drwxr-xr-x 5 root root 4.0K Apr 10 09:14 .
drwxr-xr-x 18 root root 4.0K Apr 8 11:22 ..
-rw-r--r-- 1 root root 1.2K Mar 15 07:30 .bashrc
-rw-r--r-- 1 root root 512 Mar 15 07:30 .profile
drwxr-xr-x 3 root root 4.0K Apr 9 18:45 scripts
-rwxr-xr-x 1 root root 8.5K Apr 10 09:10 deploy.sh
The -a flag includes hidden files (those starting with a dot). Use ls -la when you suspect a hidden config file or directory is present.
cd — Change Directory
Using Absolute Paths and Relative Paths; The cd (change directory) command lets you move to different folders based on their absolute paths, relative paths, and shortcuts. Look to the cd command tips guide for more about how to navigate the folder structure with ease.
cd - takes you back to the previous directory. cd ~ or just cd takes you straight to your home directory. These two shortcuts save a lot of typing during long sessions.
pwd — Print Working Directory
The pwd command will give you the full absolute path of where you're currently located. This is useful when you want to paste a path into a script or config file and don't have to guess the path.
Use pwd -P to resolve symbolic links and print the actual physical path rather than the logical one.
mkdir — Create a New Directory
The mkdir command creates new directories. When combined with -p , the mkdir command creates all parts of the directory tree needed to create a specified directory structure in a single command. It also won’t throw an error if any part of the directory already exists. Therefore, it’s safe to run this command in scripts.
Create multiple directories at once with brace expansion: mkdir -p /opt/myapp/{config,logs,tmp} creates all three subdirectories in one go.
rm — Remove Files or Directories
The rm (remove) command will delete files and folders. With -r it will remove the entire directory tree recursively. Also, there is no recycle bin (trash), no “undo”, and no prompts asking if you’re sure unless you add -i.
rm -rf permanently deletes everything at the path you give it, no trash, no confirmation, no recovery. A typo like rm -rf / tmp/ (accidental space) can wipe your entire system in seconds.
Always double-check the exact path before pressing Enter. Use rm -i for interactive confirmation on anything critical. Consider trash-cli for day-to-day removal so you have a recovery option.
cp — Copy Files and Directories
The cp command will copy files and directories. Adding -r will make the cp command do a recursive copy. The -p option will preserve the original permissions, ownership, and timestamp(s) of the copied item(s). Use the file management commands guide to learn more about these patterns.
Use cp -rp when backing up a config directory before editing, it preserves all permissions and timestamps so you can restore the exact original state if something breaks.
mv — Move or Rename Files
The mv command can be used to rename files and/or to move them. Since renaming/moving a file in the same file system is essentially updating the directory entry associated with that file’s name rather than actually moving/copying the file’s data itself, renaming/moving a file within the same file system is immediate.
mv silently overwrites the destination if it already exists. Use mv -i for a confirmation prompt before overwriting, or mv -n to never overwrite an existing file.
find — Search for Files by Name, Type, or Age
The find command searches for files in your file system that meet the criteria you specify, file name, file type, file size, file owner, file permissions, or date modified. In addition to being very useful for removing older logs, it is also useful for finding config files. The find command guide has much more information regarding searching for files using various parameters.
/var/log/nginx/error.log
/var/log/auth.log
/tmp/app-debug.log
Chain find with -exec to act on every result: find /var/log -name "*.log" -mtime +30 -exec rm {} \; deletes all log files older than 30 days. Always test with -print first before you commit.
touch — Create an Empty File or Update Timestamp
The touch command will create an empty file if it doesn’t already exist. If it does exist, it will update its timestamps. Both functions are useful in scripts, creating placeholders and causing processes that depend upon the last-modified-date of a file to refresh the age of the file.
Use brace expansion to create multiple files at once: touch linuxteck_{jan,feb,mar}.txt creates three files in one command.
tree — Display Directory Structure as a Tree
The tree command displays your directory hierarchy graphically. By adding the -L you can limit how deep in the directory hierarchy the tree ommand will display. Without specifying this option, the tree command can generate hundreds of lines if you have a lot of subdirectories in your current working directory. To install tree if it isn’t installed yet, enter either of the two following commands: sudo apt install tree or sudo dnf install tree.
├── nginx
│ ├── nginx.conf
│ └── sites-enabled
├── ssh
│ ├── sshd_config
│ └── ssh_config
├── cron.d
│ └── dailyjobs
└── hosts
3 directories, 5 files
Use tree -L 2 -d to show only directories and skip files, helpful when you want to understand a project's folder structure without the noise of individual files.
File Viewing & Text Processing
All File Data is Stored as Text; Most Everything Is Stored As Text Files Under Linux. Configs, logs, scripts, and user databases are almost always stored as text files under Linux. And since you can read/search/filter/transform that text without having to open a GUI editor using the eight above-mentioned commands, they work very well together with pipes. For additional info, please refer to the text processing commands reference.
cat — Display File Contents
The cat (concatenate) command is probably one of the fastest ways to print out the contents of a small config or script to the terminal. However, since cat sends all of the file at once, use less if you are dealing with larger files. The cat command guide rovides additional usage examples of cat.
VERSION="22.04.3 LTS (Jammy Jellyfish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 22.04.3 LTS"
VERSION_ID="22.04"
HOME_URL="https://www.ubuntu.com/"
Use cat -n to display line numbers alongside the content, useful when referencing specific lines in a config file during troubleshooting.
less — Scroll Through Large Files
The less command allows you to read a file in a scrolling environment, which means you can view files such as log files, man pages, and long config files page-by-page. Within less, search for a specific string by typing / followed by your search term and press Enter. Then press n to move down to the next occurrence of what you searched for.
Press G to jump to the end, g to go back to the top, q to quit. Use less +F /var/log/syslog to follow a live log file, similar to tail -f but with the ability to scroll back through history.
head — View the First N Lines of a File
The head (view header) command prints the first few lines of a file or ten lines by default but you may specify any number of lines after -n. A common use-case would be viewing several lines of a log file to verify whether the format matches expectations before running a batch job against it.
Apr 10 08:01:12 webserver sshd[2241]: pam_unix(sshd:session): session opened for user deploy
Apr 10 08:05:33 webserver sudo: deploy : TTY=pts/0 ; PWD=/home/deploy ; USER=root ; COMMAND=/bin/systemctl restart nginx
Combine head and tail to extract a range of lines from the middle of a file: head -50 linuxteck.txt | tail -10 gives you lines 41 through 50.
tail — View Last N Lines and Follow Live Logs
The tail (view trailer) command views the last few lines of a file. The -f option will allow you to watch as data arrives in real-time, often useful when trying to reproduce problems while logging something in another window. For more ideas on tracking logs over time, please refer to the System Monitoring Cheat Sheet.
Use tail -f with grep to filter live output: tail -f /var/log/nginx/error.log | grep "502". You only see the lines you care about rather than every entry scrolling past.
grep — Search Text Using Patterns
The grep command searches files or command output for lines matching a pattern. The -i flag makes the search case-insensitive, -r recurses through directories, and -n shows line numbers next to each match.
Apr 10 09:13:44 webserver nginx[3312]: 2026/04/10 09:13:44 [error] 3312#3312: *1 connect() failed
Apr 10 09:15:01 webserver systemd[1]: Failed to start MySQL Database Server.
Use grep -v "pattern" to invert the match, showing only lines that do NOT contain the pattern. Useful for filtering health-check noise out of an access log so you can focus on real traffic.
awk — Text Processing and Column Extraction
The awk command processes structured text, treating each line as a row of fields separated by a delimiter. Default is whitespace, change it with -F. It is the fastest way to pull a specific column out of command output or a structured file like /etc/passwd.
daemon
bin
sys
sync
games
deploy
nginx
$1 refers to the first field, $2 the second, and so on. $NF always refers to the last field regardless of how many columns there are.
sed — Find and Replace in Files and Streams
The sed command reads text line by line and applies transformations. The most common use is find-and-replace: s/old/new/g. Add -i to edit a file in-place, extremely useful for config automation in scripts and Ansible playbooks. The sed commands guide covers more advanced patterns. If you find yourself running the same commands repeatedly, see our guide to the best open source automation tools for 2026 to take your workflows further.
Test without -i first to preview output on screen before touching the file. On GNU/Linux use sed -i.bak to save a backup of the original file automatically before making changes.
wc — Count Words, Lines, and Characters
The wc command counts lines, words, and characters in a file or stream. The -l flag counts only lines, the most common use case. Piping other commands into wc -l is a quick way to count almost anything.
ls /var/log | wc -l counts files in a directory. grep "Failed" /var/log/auth.log | wc -l counts failed login attempts. Both are common daily troubleshooting patterns.
File Permissions & Ownership
Linux permissions control who can read, write, and execute every file and directory. Getting them right is how you keep a server secure and prevent services from interfering with each other. The chmod command guide covers the full numeric and symbolic permission system.
chmod — Change File Permissions
The chmod command sets who can read, write, and execute a file. In numeric notation each digit represents owner, group, and others; 4 is read, 2 is write, 1 is execute. So 755 means the owner can do everything while group and others can only read and execute.
chmod changes permissions only; not ownership. Use chown or chgrp for that. Use chmod -R 755 /path/ to apply recursively to an entire directory tree.
chown — Change File Ownership
The chown command changes the owner and optionally the group of a file or directory. You need root or sudo to use it on files you do not own. The format is user:group, set both at once, or leave off the group to change only the owner.
chown -R nginx:nginx /var/www/mysite/ is one of the most common fixes for a "403 Forbidden" error, it sets the correct ownership so the web server can read the files it needs.
chgrp — Change Group Ownership
The chgrp command changes only the group ownership of a file, leaving the user owner unchanged. Useful in shared environments where multiple users work in the same project directory via a shared group.
Use chgrp -R developers /opt/project/ to apply the group change recursively. Verify with ls -la /opt/project/ and check the group column in the output.
umask — Set Default Permission Mask
The umask command controls what permissions are removed from newly created files and directories. A umask of 022 subtracts write from group and others, resulting in files created as 644 and directories as 755, the standard default on most Linux systems.
Run umask with no arguments to see the current setting. For tighter security, some teams use 027 to remove group write and all other permissions from new files.
System Information & Monitoring
When something goes wrong, the first thing you need is visibility. These 8 commands show you CPU, memory, disk, and uptime in seconds. The system monitoring cheat sheet and the best Linux monitoring tools guide cover more advanced options.
top — Real-Time Process Monitor
The top command is the built-in real-time process monitor on virtually every Linux system. It shows CPU, memory, load average, and a sorted list of running processes — usually the first place you check when a server is slow. See the top command guide for shortcuts and filtering options.
Tasks: 183 total, 1 running, 182 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.1 us, 1.2 sy, 0.0 ni, 95.4 id, 0.2 wa, 0.0 hi, 0.1 si
MiB Mem : 3929.8 total, 412.1 free, 1832.4 used, 1685.3 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 1914.5 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3311 nginx 20 0 123456 45678 8900 S 2.3 1.1 12:03.22 nginx
1234 mysql 20 0 876543 345678 12345 S 1.1 8.8 89:12.44 mysqld
While top is running: press P to sort by CPU, M to sort by memory, k to kill a process by PID, and q to quit.
htop — Interactive Process Viewer
The htop command is an improved, color-coded, mouse-enabled version of top. It shows per-core CPU bars, displays memory visually, and lets you scroll, filter, and kill processes interactively. Install with sudo apt install htop or sudo dnf install htop.
Press F6 to change sort column, F4 to filter by process name, F9 to send a signal, q to quit. See the useful Linux terminal commands guide for more.
ps — List Running Processes
The ps command gives a snapshot of running processes at the moment you run it. ps aux shows every process from all users including the command that started it. Pipe into grep to check if a service is running and get its PID. The ps command guide covers more filtering options.
nginx 3312 0.2 1.1 134567 45678 ? S 08:01 0:12 nginx: worker process
nginx 3313 0.2 1.1 134567 45678 ? S 08:01 0:12 nginx: worker process
The grep process itself appears in the results. Use the bracket trick to filter it out: ps aux | grep [n]ginx, the pattern does not match the grep command itself.
df — Show Disk Space Usage
The df command reports disk space used and available on each mounted filesystem. The -h flag shows sizes in GB/MB. Running out of disk space is one of the most common causes of sudden service failures, df -h belongs on every troubleshooting checklist. See the df command guide.
/dev/sda1 50G 32G 16G 67% /
/dev/sda2 100G 88G 12G 88% /var
tmpfs 2.0G 1.1M 2.0G 1% /run/shm
If a filesystem shows 88% or higher, use du -sh /* 2>/dev/null | sort -rh | head -20 to find the top 20 largest directories from root, usually points straight to the culprit.
du — Show Directory Disk Usage
The du command shows how much disk space a directory and its contents use. Where df shows filesystem totals, du drills down to individual directories. The -s flag shows a summary total, -h keeps sizes readable. See the du command guide.
Run du -sh /var/log/* | sort -rh to sort all subdirectories from largest to smallest, the fastest way to identify a bloated log directory.
free — Display Memory Usage
The free command shows how much RAM and swap is used and available. The "available" column is more meaningful than "free", Linux uses spare RAM for disk caching, and that cache is released immediately when a process needs it.
Mem: 3.8Gi 1.8Gi 412Mi 88Mi 1.6Gi 1.8Gi
Swap: 2.0Gi 0B 2.0Gi
If the system is using swap, RAM is under real pressure. Watch the "available" column, when it approaches zero, services start competing for memory and performance degrades fast.
uname — Show System and Kernel Information
The uname command reports the kernel version and system architecture. The -r flag shows just the kernel release, what you need most when checking compatibility or researching a kernel bug. Use -a to show everything at once.
Combine uname -r with cat /etc/os-release for the full picture, kernel version plus distro version covers everything needed for a bug report or known-issue search.
uptime — Show How Long the System Has Been Running
The uptime command prints system uptime, logged-in user count, and load averages for the last 1, 5, and 15 minutes. A load average roughly equal to the number of CPU cores means the system is fully utilized — higher means processes are waiting.
A load average at 2x or more your CPU core count that holds steady is a real bottleneck, move to top or htop to identify which processes are responsible.
Process Management
These 4 commands let you stop processes by ID or name, check what is running in the background, and keep long-running tasks alive after you disconnect. For more patterns, see the Linux process management cheat sheet.
kill — Send a Signal to a Process by PID
The kill command sends a signal to a process by PID. Signal -15 (SIGTERM) asks the process to shut down gracefully. Signal -9 (SIGKILL) forces immediate termination with no cleanup. Always try -15 first.
Find a process PID with ps aux | grep processname, the shorter pgrep processname, or pidof nginx for named processes.
pkill — Kill Processes by Name
The pkill command kills processes by name pattern, no need to look up a PID first. It sends the signal to all matching processes, which is handy when a service has multiple worker processes.
Run pgrep processname before pkill, it shows which PIDs would match without sending any signal, so you can confirm you are targeting the right processes.
jobs — List Background Jobs
The jobs command shows processes you have sent to the background using & or Ctrl+Z. Each job gets a number you can use with fg %1 to bring it to the foreground, or bg %1 to resume it in the background. The -l flag also shows each job's PID.
[2] - 4789 Stopped vi linuxteck.txt
Background jobs are tied to your current shell session, close the terminal and they stop. Use nohup or a process manager like tmux, screen, or systemd for jobs that must survive logout.
nohup — Run a Command Immune to Hangups
The nohup command makes a process ignore the SIGHUP signal sent when your SSH session ends, so it keeps running after you log out. Combine with & to send it to the background immediately. Output goes to nohup.out by default unless you redirect it.
Redirect to a named log file to avoid nohup.out piling up: nohup ./script.sh > /var/log/myjob.log 2>&1 &. The 2>&1 captures stderr into the same file so errors are not lost.
Networking
Networking commands are core sysadmin skills on Linux. These 8 commands cover connectivity testing, file transfers, port inspection, SSH access, and remote file synchronization. For a deeper look, see the Linux network administration guide and the 8 Linux networking commands guide.
ping — Test Network Connectivity
The ping command sends ICMP echo packets to a host and reports round-trip time. It is the quickest check for whether a host is reachable. The -c 4 flag limits the test to 4 packets so it stops automatically.
64 bytes from lga34s32-in-f14.1e100.net: icmp_seq=1 ttl=118 time=12.4 ms
64 bytes from lga34s32-in-f14.1e100.net: icmp_seq=2 ttl=118 time=11.9 ms
64 bytes from lga34s32-in-f14.1e100.net: icmp_seq=3 ttl=118 time=12.1 ms
64 bytes from lga34s32-in-f14.1e100.net: icmp_seq=4 ttl=118 time=12.3 ms
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 11.9/12.2/12.4/0.2 ms
If pinging a hostname fails but the IP responds, the problem is DNS resolution, not network connectivity. That distinction saves a lot of debugging time.
curl — Transfer Data from URLs
The curl command transfers data to or from a URL over HTTP, HTTPS, FTP, and more. Use it to test API endpoints, check HTTP response headers, and download files from the command line. The -I flag fetches headers only, great for quickly checking a server's status code. See the curl command guide for more patterns.
server: nginx
date: Thu, 10 Apr 2026 09:45:01 GMT
content-type: text/html; charset=UTF-8
x-powered-by: PHP/8.1.27
link: <https://www.linuxteck.com/wp-json/>; rel="https://api.w.org/"
Use curl -o linuxteck.txt https://example.com/file to save output to a named file. Use curl -L to follow redirects, without it, curl stops at the first redirect response.
wget — Download Files from the Web
The wget command downloads files from the web and saves them to disk automatically. It supports resuming interrupted downloads with -c and background downloads with -b, the go-to tool on headless servers with no browser.
Use wget -c URL to resume an interrupted download, particularly useful for large ISO images where restarting from the beginning wastes significant time and bandwidth.
ss — Show Listening Ports and Connections
The ss command is the modern replacement for netstat. The flags -tlnp show TCP listening ports with the process name and PID attached, the combination you will reach for most often. See the Linux network command cheat sheet for more examples.
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1022,fd=3))
LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=3311,fd=6))
LISTEN 0 511 0.0.0.0:443 0.0.0.0:* users:(("nginx",pid=3311,fd=8))
LISTEN 0 70 127.0.0.1:3306 0.0.0.0:* users:(("mysqld",pid=4123,fd=21))
If a service should be listening but you cannot connect, run ss -tlnp first. Port absent means the service is not running. Port present means the problem is likely a firewall rule.
ip — Show and Configure Network Interfaces
The ip command is the modern replacement for ifconfig. It shows and configures network interfaces, IP addresses, and routing tables. The most common use is ip addr show to see what addresses are assigned to each interface.
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.105/24 brd 192.168.1.255 scope global eth0
Use ip route show to view the routing table and confirm the default gateway. Changes made directly with the ip command do not persist across reboots, edit your network config files for permanent changes.
ssh — Connect to a Remote Machine Securely
The ssh command opens an encrypted terminal session to a remote Linux machine, how virtually all remote server management is done. Authenticate with a password or, much better, an SSH key pair. The SSH client commands guide and the install and secure SSH server guide cover key setup and hardening.
Use ~/.ssh/config to define server aliases. Instead of typing ssh -i ~/.ssh/mykey.pem user@203.0.113.45 -p 2222 every time, define a host block and just type ssh myserver.
scp — Copy Files Over SSH
The scp command copies files between machines over an encrypted SSH connection. The syntax mirrors cp with a user@host: prefix for the remote side. It uses the same authentication as SSH, password or key.
Use scp -r to copy an entire directory recursively. For large transfers or when you need resuming and bandwidth control, rsync is a better choice than scp.
rsync — Sync Files Locally or Over SSH
The rsync command synchronizes files and directories, transferring only what has changed. This makes it much faster than scp or cp for large directory trees where only a few files have been updated. The -avz flags enable archive mode, verbose output, and compression.
Always run rsync with --dry-run the first time on an important sync to see what would transfer before it happens. Add --delete only after verifying the dry run, it removes files at the destination that no longer exist at the source. See the Linux server backup solutions guide for more strategies.
Package Management
Package managers handle installing, updating, and removing software on Linux. Debian and Ubuntu use apt, RHEL and Fedora use dnf, and snap works across distributions. The Linux package management cheat sheet has a full comparison of flags across all package managers.
apt — Package Manager for Debian / Ubuntu
The apt command is the primary package manager on Debian-based systems. Always run sudo apt update first to refresh the package list before installing or upgrading, otherwise you may get outdated versions or errors about packages that cannot be found.
sudo apt upgrade upgrades all installed packages. sudo apt remove packagename removes a package but keeps config files. sudo apt purge packagename removes both. Use apt list --installed to see everything currently on the system.
dnf — Package Manager for RHEL / Fedora
The dnf command is the package manager for RHEL 8+, CentOS Stream, Rocky Linux, AlmaLinux, and Fedora. It replaced yum starting with RHEL 8, most syntax is identical. The DNF guide for beginners is a good next step for RPM-based systems.
Use dnf search packagename to find the correct package name before installing. dnf history shows a complete log of every package transaction so you can undo or review changes.
rpm — Query and Manage RPM Packages
The rpm command works directly with the RPM package database. While dnf handles dependencies and repositories, rpm is useful for querying what is installed, verifying package integrity, and installing individual .rpm files. The -qa flags list every package currently installed.
python3-pip-21.3.1-6.el8.x86_64
python3-setuptools-53.0.0-12.el8.noarch
python3-libs-3.9.18-3.el8.x86_64
Use rpm -qi packagename for detailed package info. Use rpm -ql packagename to list all files a package installed, useful for finding where a binary or config file was placed.
snap — Manage Snap Packages
The snap command manages self-contained, sandboxed application bundles that work across multiple Linux distributions. Snaps bundle their own dependencies, so the same package installs identically on Ubuntu, Fedora, Debian, and others without conflicts. The tradeoff is larger package size and potentially slower startup.
Use snap list to see installed snaps, snap find packagename to search the Snap Store, and sudo snap remove packagename to uninstall. snapd comes pre-installed on Ubuntu but may need adding on other distributions.
Users, Permissions & System Control
Managing users and running system-level operations requires elevated privileges. These commands are where mistakes can have serious consequences; read the notes carefully. The user management cheat sheet and the steps to configure sudo guide are worth reading alongside this section.
Commands that modify system-wide settings, install software, manage user accounts, or access restricted files require sudo. Running them as a regular user returns a Permission denied error. Commands like ls, grep, find, cat, ping, and curl run fine without elevated privileges for files and resources you already have access to.
As a general rule: if a command changes system state or touches files outside your home directory, it probably needs sudo. You will be prompted for your password the first time, subsequent commands in the same session use a short cached window.
sudo — Run Commands as Superuser
The sudo command runs a single command with root privileges without switching you to the root account permanently. It logs every privileged action, creating an audit trail. This is far safer than logging in as root and is the standard way to perform administrative tasks on modern Linux.
Use sudo -l to see what commands your user can run with sudo. Use sudo -i to start an interactive root shell for a series of privileged commands, exit when done so you are not in a root shell longer than needed.
useradd — Create a New User
The useradd command creates a new user account. The -m flag creates the home directory automatically and -s /bin/bash sets bash as the default shell. Without -m the user has no home directory, which causes login problems. Always set a password with passwd immediately after. See the create user guide for UID, group, and expiry options.
On Debian and Ubuntu, consider using adduser instead, it walks you through all options interactively and sets up the home directory automatically. On RHEL and CentOS, useradd -m is the standard approach.
passwd — Change User Password
The passwd command changes a user's password. Run without arguments to change your own. Run with a username as root or with sudo to change another user's password. A newly created user has a locked account until a password is set, passwd is always the step right after useradd.
Retype new password:
passwd: password updated successfully
Use sudo passwd -l username to lock an account without deleting it — the user can no longer log in with a password. Use sudo passwd -u username to unlock it again.
dd — Copy and Convert Raw Data / Disk Images
The dd command copies raw data at a low level between an input source (if=) and an output destination (of=). It is used for creating disk images, cloning drives, and writing bootable ISO images to USB drives. The bs=4M flag sets the block size which affects transfer speed.
Getting if= and of= backwards or pointing of= at the wrong device; overwrites the target disk completely and silently. There is no confirmation, no warning, and no recovery. A single typo can destroy a system.
Before running any dd command, use lsblk to confirm exact device names. Double-check both arguments. Never run dd in a hurry. When creating a backup image, always point of= to a file path, not a device.
Conclusion:
Thanks for reading! Hope this breakdown of 50 Linux commands saves you some time at the terminal. If you found it useful, share it with someone who is just getting started with Linux. Drop your questions or feedback in the comments below.
From your first terminal command to advanced sysadmin skills. Every guide here is written in plain English with real examples you can run right now.