Linux is a powerful operating system that is pervasively used today, even though it might not be apparent to you. Data from TOP500 shows that Linux powers 100% of the world’s top 500 supercomputers, which is an astonishing statistic.
Linux is so ubiquitous that it is present in cell phones, cars, refrigerators, and Roku devices. The reason Linux is so popular is that it is one of the most reliable, secure, and robust operating systems available.
Quick Reference: Top 10 Linux Commands
Need a quick answer? Here are the most essential commands at a glance.
| Command | Function | Example |
|---|---|---|
| ls | List directory contents | ls -la |
| cd | Change directory | cd /var/log |
| pwd | Print working directory | pwd |
| mkdir | Make a new folder | mkdir photos |
| rm | Remove a file or directory | rm file.txt |
| cp | Copy a file | cp file1.txt file2.txt |
| mv | Move or rename a file | mv old.txt new.txt |
| touch | Create an empty file | touch newfile.txt |
| cat | Display file contents | cat notes.txt |
| sudo | Run as Super User (Admin) | sudo apt update |
Section 1: File Management Commands
These commands are the bread and butter of Linux. They allow you to navigate directories and manipulate files.
1. ls (List)
The ls command lists directory contents. It is similar to the dir command in Windows.
Syntax: ls [options] [directory]
ls -l: Displays details (permissions, size, owner).ls -a: Shows hidden files.
$ ls -la
2. cd (Change Directory)
The cd command changes your current location in the file system.
Syntax: cd [directory]
cd /var/log: Goes to a specific absolute path.cd ..: Goes back one level (to the parent directory).cd ~: Goes to your home directory.
$ cd /home/user/documents
3. pwd (Print Working Directory)
If you get lost, use the pwd command. It displays the full path of the current directory you are in.
Syntax: pwd
$ pwd
4. mkdir (Make Directory)
Use the mkdir command to create new folders. You can also use the rmdir command to remove empty directories.
Syntax: mkdir [directory_name]
$ mkdir my_new_project
5. touch (Create File)
The easiest way to create a new, empty file in your current working directory is using the touch command.
Syntax: touch [filename]
$ touch script.py
6. rm (Remove)
The rm command deletes files or directories.
Syntax: rm [options] [file_or_directory]
⚠️ Warning: Deleted files in Linux generally cannot be restored from a Recycle Bin. Be careful! Using rm -rf allows you to delete directories recursively and force-deletes files.
$ rm file1.txt
$ rm -r my_folder
7. cp (Copy)
The cp command copies a file from one location to another.
Syntax: cp [options] source destination
$ cp source_file.txt destination_copy.txt
8. mv (Move)
The mv command serves two purposes: moving files to a new location OR renaming files.
Syntax: mv [source] [destination]
# Moving a file
$ mv file.txt /home/user/documents/
# Renaming a file
$ mv old_name.txt new_name.txt
9. file Command
In Linux, files don't always need extensions (like .txt or .jpg). The file command analyzes the file header and tells you exactly what kind of file it is (text, executable, image, zip, etc.).
Syntax: file [filename]
$ file unknown_data
Output: unknown_data: PNG image data, 800 x 600, 8-bit/color RGB
10. zip and unzip
To compress files into a zip archive or extract them, use the zip command or the unzip command.
Syntax: zip [archive_name] [file1] [file2] or unzip [archive_name]
# Compressing
$ zip archive_name.zip file1.txt file2.txt
# Extracting
$ unzip archive_name.zip
Section 2: Viewing & Editing File Contents
11. cat (Concatenate)
The cat command is used to display the text contents of a file directly in the terminal.
Syntax: cat [filename]
$ cat config.txt
12. nano (Edit Files)
While cat displays files, the nano command lets you edit them. Nano is a beginner-friendly text editor included in most Linux distributions.
Syntax: nano [filename]
$ nano file.txt
(Press Ctrl+X to exit, and Y to save changes).
13. grep (Search Text)
One of the most powerful tools in Linux, the grep command searches for specific text strings inside files.
Syntax: grep [options] "pattern" [filename]
$ grep "error" /var/log/syslog
14. head and tail
When dealing with huge files, you don't want to open the whole thing. You can use the head command or the tail command to view exactly what you need.
Syntax: head [options] [filename] or tail [options] [filename]
- head: View the first 10 lines.
- tail: View the last 10 lines (great for checking logs).
$ tail -f /var/log/syslog
(The -f flag follows the file as it grows in real-time).
15. wc (Word Count)
Counts lines, words, and characters in a file.
Syntax: wc [options] [filename]
$ wc -l file.txt
Section 3: System, Users & Permissions
16. chmod (Change Mode)
Linux controls file access via permissions: Read (r), Write (w), and Execute (x). chmod lets you update these.
Syntax: chmod [permissions] [filename]
Common numeric codes:
- 777: Everyone can read, write, and execute (Insecure).
- 755: Owner can do all; others can only read/execute (Common for scripts).
- 644: Owner can read/write; others can only read (Common for documents).
$ chmod 755 script.sh
17. chown (Change Ownership)
Changes who owns the file.
Syntax: chown [user]:[group] [filename]
$ sudo chown user:group file.txt
18. su / sudo (Super User)
The sudo command allows a permitted user to execute a command as the superuser (Administrator). The su command logs you in as the root user.
Syntax: sudo [command] or su [username]
$ sudo apt update
19. top (System Monitor)
Want to see what is slowing down your computer? top (or the more modern htop) displays a real-time view of running processes, CPU usage, and RAM usage.
Syntax: top
$ top
20. apt (Package Manager)
Use apt (the modern replacement for apt-get) to install and update software on Ubuntu/Debian systems.
Syntax: sudo apt [command] [package_name]
$ sudo apt update
$ sudo apt install python3
21. kill
If a program freezes, use kill to stop it. You usually need the Process ID (PID) from the top command.
Syntax: kill [PID]
$ kill 12345
22. history
Forget a command you typed 5 minutes ago? This shows your entire command history.
Syntax: history
$ history
23. man (Manual)
The most important command of all. If you don't know how to use a tool, ask the manual.
Syntax: man [command_name]
$ man grep
Section 4: Networking & Internet
These commands help you check your internet connection and download files.
24. ping (Check Connection)
Use ping to check if you are connected to the internet or a specific server.
Syntax: ping [hostname_or_IP]
$ ping google.com
(Press Ctrl+C to stop the ping)
25. curl / wget (Download Files)
Use these to download files from the internet directly via the terminal.
Syntax: curl [options] [url] or wget [url]
- curl: Great for testing API endpoints or viewing raw page content.
- wget: Best for downloading actual files.
$ curl https://www.google.com
$ wget https://website.com/image.jpg
26. ip a (View IP Address)
The modern way to see your network interface details (IP address, MAC address). It replaces the older ifconfig.
Syntax: ip address show
$ ip a
Section 5: Piping, Sorting & Redirection
The real power of Linux comes from chaining commands together.
27. echo (Print Text)
Prints text to the terminal. Commonly used with redirection > to write to files.
Syntax: echo [text_or_variable]
$ echo "Hello World"
$ echo "New entry" > log.txt
28. | (Pipe)
The vertical bar | takes the output of the command on the left and feeds it as input to the command on the right.
Syntax: command1 | command2
$ cat large_file.txt | grep "error"
(Take the file contents AND THEN search for "error")
29. sort
The sort command sorts the contents of a text file alphabetically or numerically.
Syntax: sort [options] [filename]
$ sort names.txt
$ sort -r names.txt
30. uniq (Unique)
Removes duplicate lines. Often used combined with sort.
Syntax: uniq [options] [input]
$ sort names.txt | uniq
31. locate (Find Files)
The locate command is the fastest way to find files and directories. Unlike searching the whole drive, it looks through a pre-built database of files, making the search instantaneous.
Syntax: locate [options] [filename]
Note: If you just created a file and locate can't find it, run sudo updatedb to update the database.
# Find a file
$ locate report.txt
# Find files ignoring case (e.g., FILE, File, file)
$ locate -i report.txt
Bonus: Essential Terminal Shortcuts
Memorize these to look like a pro and double your speed. They're some of the most useful commands in Linux.
| Shortcut | Action |
|---|---|
| Tab | Auto-complete files or commands (Hit it often!) |
| Ctrl + C | Kill the current running process immediately. |
| Ctrl + L | Clear the screen (Same as typing clear). |
| Ctrl + R | Search your command history. Start typing to find a past command. |
| Up Arrow | Scroll through previous commands. |
| Ctrl + A | Jump cursor to the start of the line. |
| Ctrl + E | Jump cursor to the end of the line. |
Conclusion
We hope this Linux commands list will help you get started. These are just a few commands. There are many more that you’ll find yourself using over time, but this is a good starting point. The best way to learn Linux is by trying these commands yourself!
Related Course
Linux Administration: The Complete Linux Bootcamp for 2026
Frequently Asked Questions
1. How Do I Get a List of All Commands in Linux?
Type compgen -c to get a list of all commands that you can run. You’ll see the list of commands one after the other.
2. What is a Linux Shell/Terminal?
A Linux Shell, or terminal, is the command interpreter which lets you run operating system services and tasks. It is an interface for Unix systems that helps you run programs, among other things. It is a powerful feature, and in Linux, bash is the most commonly used shell.
3. How Do I Learn Basic Linux Commands?
Basic Linux commands are quite easy to grasp. Start with the file management commands listed above (ls, cd, mkdir) and practice creating and moving files. Once comfortable, move to permissions and system monitoring.