Linux powers websites, cloud platforms, development environments, and servers worldwide. A Linux command is a text-based instruction entered into a terminal to perform a specific task. It can help you manage files, monitor processes, troubleshoot networks, and control VPS hosting environments.
Most commands contain a command name followed by optional settings and a target. You do not need to learn them all at once. A practical set of basic Linux commands can make everyday tasks faster, easier, and more accurate.
The quick list below organizes 50 commonly used Linux commands by function, making it easier to find the right tool for the task:
|
Category |
Commands |
| Navigation and files | ls, cd, pwd, mkdir, rm, cp, mv, touch, cat, less |
| Search and permissions | grep, find, chmod, chown, chgrp |
| Archives and remote access | tar, gzip, gunzip, ssh, scp |
| Downloads and processes | wget, curl, top, ps, kill |
| Storage and text | df, du, head, tail, ln, tac, sed, awk, cut, sort, uniq, diff |
| Help and administration | man, history, alias, su, sudo, apt, dnf, systemctl |
| Networks and secure access | ip, ping, traceroute, ss, ssh-keygen |
Now, let us explore what each command does and how you can use it through practical examples.
50 Essential Linux Commands with Examples
Each entry explains the purpose of the command and provides a practical example.
File and Directory Navigation Commands
1. ls: List files and directories
The ls command displays the files and directories available in a specific location.
Use: ls -la to view hidden files, permissions, ownership, and other details.
2. cd: Change the current directory
The cd command helps you move from one directory to another within the file system.
Use: cd /var/log to open a specific directory or cd .. to move up one level.
3. pwd: Display the current path
The pwd command displays the complete path of your current directory.
It helps you confirm your location before you run commands on files or folders.
4. mkdir: Create a directory
The mkdir command creates one or more directories in the selected location.
Use: mkdir -p projects/demo to create a directory along with any missing parent folders.
5. rm: Remove files and directories
The rm command permanently removes files or directories from the system.
Use: rm file.txt for a file or rm -r folder for a directory, but verify the path first.
File Creation and Management Commands
6. cp: Copy files and directories
The cp command creates a copy of a file or directory in another location.
Use: cp file.txt backup.txt for a file or cp -r website/ backup/ for a directory.
- Explain the cp command in Linux
- Clarify why cp is the standard copy command in Linux
- Cover -r, -i, and –a
7. mv: Move or rename files
The mv command transfers files or directories from one location to another.
It can also rename a file, as shown in mv draft.txt final.txt.
8. touch: Create an empty file
The touch command creates an empty file when the specified file does not exist.
It updates the access and modification timestamps when the file already exists.
9. cat: Display or combine file content
The cat command displays the content of one or more text files in the terminal.
It can also combine several files and direct the result into a new file.
10. less: Read long files interactively
The less command opens long text files in an interactive viewer.
It lets you move through the content, search for terms, and exit without changing the file.
Search, Ownership, and Permission Commands
11. grep: Search for text patterns
The grep command searches files or command output for specific words and patterns.
It displays the lines that match your search criteria and helps you filter large amounts of text.
- Explain the grep command in Linux
- Cover -i, -n, -R, and –v
12. find: Locate files and directories
The find command locates files and directories based on conditions such as name, type, size, or date.
Use: find /var/log -name “*.log” to locate log files within the /var/log directory.
13. chmod: Change access permissions
The chmod command changes read, write, and execute permissions for files or directories.
Use: chmod 755 script.sh to give the owner full access and others limited access.
14. chown: Change file ownership
The chown command changes the user or group that owns a file or directory.
Use: sudo chown user:developers app.conf to assign a new owner and group.
15. chgrp: Change group ownership
The chgrp command assigns a file or directory to a different user group.
Use: chgrp developers project.txt to give the developers group ownership of the file.
Archive, Compression, and Remote Access Commands
16. tar: Create or extract archives
The tar command combines multiple files and directories into one archive.
Use: tar -czf backup.tar.gz project/ to create a compressed archive of a project folder.
17. gzip: Compress files
The gzip command compresses individual files to reduce their storage size.
Use: gzip access.log to create a compressed file named access.log.gz.
18. gunzip: Decompress files
The gunzip command restores files that use the gzip compression format.
Use: gunzip access.log.gz to recover the original access.log file.
19. ssh: Access a remote system securely
The ssh command creates an encrypted connection between your computer and a remote system.
Use: ssh user@server.example.com to access a server through an authorized account.
20. scp: Copy files through SSH
The scp command securely copy files between local and remote systems through SSH.
Use: scp report.pdf user@server:/home/user/ to transfer a local file to a remote server.
Download and Process Management Commands
21. wget: Download files
The wget command downloads files from the internet through the terminal.
Use: wget https://example.com/file.zip to save a file in your current directory.
22. curl: Transfer data or test URLs
The curl command transfers data to or from a server through various network protocols.
Use: curl -I https://example.com to view the response headers from a website.
23. top: Monitor system resources
The top command provides a live view of active processes and system resource use.
Use: It helps you identify processes that consume large amounts of CPU or memory.
24. ps: View active processes
The ps command displays a snapshot of processes that currently run on the system.
Use: ps aux to view process IDs, users, resource use, and command details.
25. kill: Stop a process
The kill command sends a signal to stop or control a process through its process ID.
Use: kill 1234 first and reserve kill -9 1234 for a process that does not respond.
Storage and File Content Commands
26. df: Check file-system space
The df command displays the available and used space across mounted file systems.
Use: df -h to view storage values in readable units such as MB and GB.
27. du: Check file or directory size
The du command estimates the storage space used by files and directories.
Use: du -sh downloads/ to view the total size of a directory in readable units.
28. head: Display the first lines
The head command displays the first lines of a text file or command output.
Use: head -n 20 data.csv to view the first 20 lines of the file.
29. tail: Display the last lines
The tail command displays the final lines of a text file or command output.
Use: tail -f app.log to view new log entries as the application writes them.
30. ln: Create hard or symbolic links
The ln command creates hard links or symbolic links between file locations.
Use: ln -s /opt/app/current app-link to create a symbolic link to a directory.
Text Processing and Comparison Commands
31. tac: Display lines in reverse order
The tac command displays the lines of a file from last to first.
Use: tac events.txt when you want to see the most recent entry at the top.
32. sed: Find and replace text
The sed command searches, replaces, deletes, or transforms text from an input stream.
Use: sed ‘s/old/new/g’ file.txt to replace every instance of old in the displayed output.
33. awk: Process structured text
The awk command processes structured text according to fields, patterns, and rules.
Use: awk -F’,’ ‘{print $1}’ users.csv to display the first field from each row.
34. cut: Extract fields or columns
The cut command extracts selected characters, fields, or columns from each line.
Use: cut -d’:’ -f1 /etc/passwd to display the first field from the file.
35. sort: Sort text
The sort command arranges lines in alphabetical, numerical, or reverse order.
Use: sort -n scores.txt to arrange the values in the file by number.
36. uniq: Remove or count duplicate lines
The uniq command removes or counts duplicate lines that appear next to each other.
Use: sort names.txt | uniq -c to group and count repeated names.
37. diff: Compare files
The diff command compares two files and identifies their differences line by line.
Use: diff -u old.conf new.conf to produce a clear comparison of both files.
Command Help and User Access Commands
38. man: Open command documentation
The man command opens the manual page for another command or system feature.
Use: man grep to review the syntax, options, and documentation for grep.
39. history: Review previous commands
The history command displays commands previously entered in the current shell.
Use: history | grep ssh to locate earlier SSH commands without typing them again.
40. alias: Create command shortcuts
The alias command creates a shorter name for a command or command sequence.
Use: alias ll=’ls -la’ to replace a frequently used command with ll.
41. su: Switch user accounts
The su command opens a shell under another user account.
Use: su – username to switch accounts and load the target user’s environment.
42. sudo: Run authorized administrative commands
The sudo command runs an authorized command with elevated system privileges.
Use: sudo systemctl restart nginx when a task requires administrative access.
Package, Service, and Network Commands
43. apt: Manage Debian and Ubuntu packages
The apt command installs, updates, and removes packages on Debian and Ubuntu systems.
Use: sudo apt update to refresh the list of packages available from configured repositories.
44. dnf: Manage Fedora and Red Hat-family packages
The dnf command manages software packages on Fedora and modern Red Hat-family systems.
Use: sudo dnf install nginx to install Nginx and resolve its required dependencies.
45. systemctl: Control system services
The systemctl command starts, stops, restarts, enables, or checks systemd services.
Use: sudo systemctl enable –now nginx to start Nginx and activate it at startup.
46. ip: View network addresses and routes
The ip command displays or changes network interfaces, addresses, and routes.
Use: ip address to view network addresses or ip route to check the routing table.
47. ping: Test host connectivity
The ping command sends test packets to a host and measures its response time.
Use: ping -c 4 example.com to send four requests and review the results.
48. traceroute: Trace a network route
The traceroute command shows the network path that packets follow to a destination.
Use: traceroute example.com to identify intermediate routers and possible delays.
49. ss: View ports and network connections
The ss command displays network sockets, open ports, and active connections.
Use: ss -tulpn to inspect listening TCP and UDP ports with process details.
50. ssh-keygen: Create secure SSH keys
The ssh-keygen command creates public and private keys for secure SSH authentication.
Use: ssh-keygen -t ed25519 -C “user@example.com“ and keep the private key confidential.
Useful Linux Command Combinations
Pipes pass the output of one command to another. These examples solve common tasks:
- ps aux | grep nginx finds Nginx processes.
- du -sh * | sort -h sorts items by size.
- grep -Rni “failed” /var/log searches logs with line numbers.
- tail -f app.log | grep “ERROR” filters new error entries.
- The > operator replaces a file with command output, while >> appends the output.
Tips for Safe Command-Line Use
A few simple habits can prevent avoidable errors:
- Read the manual before you use unfamiliar options.
- Use tab completion to reduce path errors.
- Add -i to cp, mv, or rm when you need confirmation.
- Test risky commands with sample files first.
- Use sudo only when the task requires it.
- Back up important data before bulk changes.
How ZNetLive Supports Linux-Based Infrastructure
ZNetLive is a value-added technology services distributor that supports businesses with cloud infrastructure, hosting, cybersecurity, backup, and business applications. These services complement the practical server control that terminal skills provide.
Teams can choose infrastructure that fits their workload while they retain the flexibility to configure, monitor, and secure Linux environments. This combination helps them build a reliable foundation for websites, applications, and digital services.
Conclusion
You do not need to memorize all 50 commands at once. Start with ls, cd, cp, grep, and man, then expand your knowledge as new tasks arise. Always verify paths, permissions, and options before you make a system change.
The right commands provide control, but dependable infrastructure keeps that control useful. If your business needs a Linux-compatible hosting or cloud environment, explore ZNetLive’s technology services and identify an option that suits your workload.



