A misplaced file, a full disk, or a stalled service can turn a simple Linux task into a frustrating search for answers. This guide to Linux commands shows you how to navigate the terminal, manage files, inspect processes, troubleshoot networks, and change permissions safely in 2026.
You do not need to memorize every option. Think of the terminal as a well-organized toolbox: each command performs one job, and combining a few tools solves larger problems. The examples below work on many common GNU/Linux distributions, including Ubuntu, Debian, Fedora, Rocky Linux, AlmaLinux, and openSUSE, although some options vary.
Linux commands: quick reference
| Command | Typical purpose |
|---|---|
ssh |
Connect securely to another Linux host |
mkdir, touch |
Create directories and files |
ls, pwd, cd |
Inspect and change locations |
rm, mv, cp |
Remove, move, and copy data |
nano, vi, vim |
Edit text files |
cat, grep, wc |
Read, search, and count text |
zip, unzip, tar |
Archive and compress files |
ps, top, kill |
Inspect and control processes |
systemctl |
Manage system services |
df, du |
Check filesystem and directory size |
chmod, chown, passwd |
Manage permissions and accounts |
ss, netstat, ip, wget |
Inspect networks and download files |
find, history |
Locate files and review commands |
Before changing anything, run pwd to confirm your location and ls to inspect the target. Use sudo only when the task genuinely requires administrator privileges. The man command opens local documentation, so man find is a useful reference when an option is unclear.
Shell navigation and file management
These Linux commands form the foundation of nearly every terminal session. Practice them in a test directory before working with production files or a remote server.
1. ssh: connect to a remote host
ssh, or Secure Shell, creates an encrypted terminal session with another computer. Replace the account and address with details supplied by your administrator or hosting provider.
ssh username@hostname
ssh [email protected]
Use exit or press Ctrl+D to close the session. If the connection fails, check the hostname, port, credentials, firewall, and remote SSH service. Never paste passwords into scripts or expose private keys.
2. mkdir and 3. touch: create directories and files
mkdir creates a directory, while touch creates an empty file or updates the timestamp of an existing file. The -p option creates missing parent directories.
mkdir -p project/config
touch notes.txt
The first command creates both project and its config directory when needed. The extra leading space before touch is not required; it is shown only to emphasize that each line is a separate command. Verify the result with ls -la project.
4. ls, 5. cd, and 6. pwd: understand your location
ls lists directory contents, cd changes your working directory, and pwd prints its full path. Together, they prevent a common beginner mistake: running a correct command in the wrong directory.
pwd
ls -lah
cd /var/log
cd ..
cd ~
cd -
The -l option gives a detailed listing, -a includes hidden files, and -h displays readable sizes. The shortcuts .., ~, and - mean parent directory, home directory, and previous directory.
7. cp, 8. mv, and 9. rm: copy, move, and remove
cp copies data, mv moves or renames it, and rm removes it. These are powerful file management tools, so inspect the destination before pressing Enter.
cp report.txt report-backup.txt
cp -r source-directory destination-directory
mv oldname.txt newname.txt
rm -i unwanted.txt
Use -i to request confirmation before removal or overwriting. Use -r for a directory tree only after checking its complete path. Avoid rm -rf unless you fully understand the target; Linux usually has no simple undo or recycle bin for that operation.
10. nano, vi, and vim: edit text files
Terminal editors let you change configuration files without a graphical desktop. nano is usually the gentlest starting point, while Vim is common on servers.
nano settings.conf
vim settings.conf
In Nano, press Ctrl+O to save and Ctrl+X to exit. In Vim, press Esc, type :wq, and press Enter to save and exit. Type :q! to leave without saving. Back up a service configuration before editing it.
Text processing and command-line workflows
Text processing turns logs and configuration files into useful answers. A pipe, written as |, sends one command’s output to another command, much like passing a document from one colleague to the next.
11. cat: read or combine short files
cat prints text and can combine files. It works well for short files; use less when a file is too long to read comfortably in one screen.
cat settings.conf
cat file1.txt file2.txt > combined.txt
cat notes.txt >> archive.txt
A single > replaces the destination, while >> appends to it. Always check the filename before redirecting output.
12. grep: search for text
grep searches files for matching text. It is especially useful for logs, application settings, and service troubleshooting.
grep -n 'error' application.log
grep -ri 'server_name' /etc/nginx
The -n option shows line numbers, -i ignores letter case, and -r searches through directories. No output usually means that the pattern did not match or that you lack permission to read the file.
13. wc: count lines, words, or characters
wc counts content in a file or command stream. For example, you can count matching log entries by sending grep output to wc.
wc -l access.log
grep '404' access.log | wc -l
wc -w document.txt
The options count lines, words, and characters. This workflow is a practical example of combining small tools instead of searching for one command that does everything.
Archives and downloads
14. zip and 15. unzip: exchange ZIP files
ZIP archives are convenient when sharing files between Linux, Windows, and macOS. List the contents before extracting an archive from an unknown source.
zip -r project.zip project-directory
unzip -l project.zip
unzip project.zip
The -l option lists files without extracting them. Reviewing that list can reveal unexpected paths or filenames before they affect your working directory.
16. tar: package files and directories
tar creates an archive, and options such as -z add gzip compression. Remember that an archive packages files; compression reduces the space they occupy.
tar -czf project.tar.gz project-directory
tar -tzf project.tar.gz
tar -xzf project.tar.gz
The commands create, list, and extract a gzip-compressed archive. List an archive first when its origin is uncertain, and extract it into a temporary directory if you need to inspect it safely.
17. wget: download a resource
wget downloads content from a URL. Prefer HTTPS and verify the source before running any downloaded program.
wget -O saved-file.tar.gz https://example.org/archive.tar.gz
A successful download only means that data arrived; it does not prove that the file is authentic or safe. Check vendor documentation and available integrity information before installation.
Process management and Linux services
18. ps and 19. top: inspect activity
ps provides a snapshot of running processes, while top offers a continuously updating view of CPU and memory activity.
ps aux
top
Look for the process ID, or PID, before taking action. In top, press q to quit. High resource use is a symptom, not proof that a process should be stopped; identify the application and check its logs first.
20. kill: send a process signal
kill sends a signal to a process by PID. Start with a normal termination request so the application has a chance to save data and close cleanly.
kill -TERM 1234
kill -KILL 1234
Use the forceful KILL signal only when normal termination fails. Confirm the PID immediately before acting because terminating the wrong process can interrupt users or corrupt work.
21. systemctl: manage services
systemctl manages services on systems that use systemd. It can show status, start or stop a service, restart it, and control whether it starts automatically.
systemctl status service-name
sudo systemctl restart service-name
sudo systemctl enable service-name
journalctl -u service-name
Restarting a production service may cause an interruption. Save configuration changes, check the status afterward, and review the service journal if it does not start normally.
Disk space and network troubleshooting
22. df and 23. du: find storage problems
df reports free space on mounted filesystems, while du estimates the space used by directories. Use both when a server reports that storage is running low.
df -h
du -sh /var/log
du -h --max-depth=1 /home
For example, if df -h shows that /var is nearly full, du can reveal whether logs, caches, or another directory uses most of the space. Do not delete unfamiliar system files just to recover capacity.
24. netstat and 25. ss: inspect network sockets
netstat may be available on older systems, but many current distributions provide ss for socket information.
ss -tuln
netstat -tunpl
These commands can help answer whether a service is listening on the expected port. A listening socket does not guarantee that an external client can connect; also check the service configuration, host firewall, cloud rules, and network path.
26. ip and wget: check interfaces and retrieve files
The ip command is the modern tool for viewing addresses and routes. It is generally preferred over the older ifconfig command.
ip address
ip route
If an interface has no expected address, investigate DHCP, the network manager, the virtual network, or the physical connection. Test one layer at a time instead of changing several settings at once.
File permissions and account security
27. chmod: change access permissions
chmod controls read, write, and execute access for the owner, group, and other users. Numeric permissions use 4 for read, 2 for write, and 1 for execute.
chmod 644 file.txt
chmod 755 script.sh
With 644, the owner can read and write while everyone else can read. With 755, the owner can execute and modify the file, while the group and others can read and execute it. Avoid making sensitive files writable by everyone.
28. chown: change ownership
chown changes a file’s owner and group. Recursive ownership changes deserve special care because one mistake can affect a whole application directory.
sudo chown user:group file.txt
sudo chown -R user:group project-directory
Confirm the result with ls -l. Incorrect ownership may prevent a service from reading its configuration or may expose private data.
29. passwd: change an account password
passwd changes the current account password. Administrators may be allowed to change another account’s password according to local policy.
passwd
sudo passwd username
Follow your organization’s password and multifactor authentication rules. Never place a password in a command line, script, ticket, or shell history.
Finding files and reviewing command history
30. find: locate files safely
find searches a directory tree by name, type, age, size, permissions, and other conditions. Start with a narrow path and review results before adding an action.
find /var/log -name '*.log'
find /home -type f -name 'report.txt'
find . -type f -mtime -7
For example, the last command finds regular files changed within the past seven days under the current directory. Be cautious with -delete; run the search without it first and verify every result.
31. history: review previous commands
history displays commands saved by your shell. It can help you repeat a safe command or understand what changed during a session.
history
history 20
!!
History can contain tokens, passwords entered by mistake, or sensitive paths. Treat it as a convenience rather than a formal change record, and remove sensitive entries according to your shell’s documentation.
Practical Linux commands checklist for 2026
Imagine that a small web application is slow and users report errors. A safe investigation might follow this order:
- Connect with
ssh, then runpwdandwhoamito confirm the host and account. - Check storage with
df -h, then identify large directories withdu. - Inspect activity with
topand identify likely processes withps aux. - Search recent logs with
grep -n 'error' application.log. - Check the service with
systemctl status service-nameand review its journal. - Inspect listening ports with
ss -tulnbefore changing firewall or service settings.
This example shows why order matters. Read-only checks come first, changes come later, and each result narrows the next question. If you must edit a configuration, copy it first, validate the syntax when the application supports validation, and keep a tested rollback plan.
Common mistakes to avoid
- Running a command in the wrong directory because you skipped
pwd. - Using
sudoautomatically instead of understanding why elevated access is needed. - Using recursive deletion, ownership, or permission changes without reviewing the path.
- Restarting a service before saving its configuration and checking the expected impact.
- Copying a download command from an unknown source and executing the result immediately.
- Assuming no output means failure; many successful commands are deliberately quiet.
Practice in a virtual machine, container, or test directory whenever possible. Read the local manual page, use absolute paths for high-risk tasks, and check the exit status and output after important changes.
Frequently asked questions about Linux commands
What Linux commands should a beginner learn first?
Start with pwd, ls, cd, mkdir, cp, mv, and rm because they teach safe navigation and file handling. Add grep, find, df, and ps as you begin troubleshooting.
How can I practice Linux commands without damaging a server?
Use a disposable virtual machine, container, or directory owned by your account. Begin with read-only commands, make backups before changes, and avoid sudo and recursive options until you understand their effect.
Why does a Linux command say permission denied?
The account may not have permission to read, write, or execute the target, or a parent directory may block access. Inspect the path with ls -l, confirm the account, and use administrator access only when policy allows it.
Where can I learn more about a Linux command?
Use the local manual page, such as man systemctl or man find, and check documentation for your distribution. Options can differ between implementations, so examples from another system may not work exactly the same way.
Conclusion: build confidence one command at a time
These Linux commands cover the everyday work of navigating files, reading logs, managing archives, checking processes, monitoring storage, troubleshooting networks, and protecting access. The safest approach is deliberate: confirm your location, inspect the target, make the smallest useful change, and verify the result.
Your next step is simple: create a test directory and practice pwd, ls, mkdir, cp, grep, and find without using administrator privileges. For service monitoring and web-server administration, continue with these AdminHint guides:

