The Linux Commands are very essential if you are working on Linux operating system. Linux is an incredibly powerful operating system that’s used everywhere from personal computers to servers. For those new to Linux, the command line might seem intimidating, but it’s an essential part of mastering this OS.
In this article, we’ll explore some of the best Linux commands for beginners. We’ll cover what each command does, how to use it, and provide simple examples to help you get started.
Before starting to learn commands, first question is arise in our minds.
Why we use Linux system?
Using a Linux system offers numerous advantages for various types of users, from developers to system administrators to casual users. Here are some compelling reasons why people choose to use Linux:
- Open Source and Free
- Security and Stability
- Customization and Flexibility
- Strong Community Support
- Powerful Command-Line Interface (CLI)
- Versatility and Compatibility
- Developers’ Choice
- Performance and Resource Efficiency
- Privacy and Control
- Educational Value
Command List
sudo | pwd | ls | cd | mkdir |
rmdir | cp | mv | rm | cat |
echo | man | find | grep | chmod |
kill | wget | curl | history | nano |
vim | locate | ps | crontab | touch |
1. sudo – Execute Commands with Superuser Privileges
What It Does:
The sudo
command allows users to run commands with superuser (root) privileges.
How to Use It:
Type sudo
followed by the command you want to run.
Example:
$ sudo apt update
This updates the package list using superuser privileges.
Additional Tip:
sudo su
switches to the root user.
2. pwd – Print Working Directory
What It Does:
The pwd
command stands for “print working directory.” It displays the current directory you are in.
How to Use It:
Simply type pwd
and press Enter.
Example:
$ pwd
/home/username
This tells you that you are in the /home/username
directory.
3. ls – List Directory Contents
What It Does:
The ls
command lists all the files and directories in the current directory.
How to Use It:
Type ls
and press Enter.
Example:
$ ls
Documents Downloads Pictures Videos
This shows you the folders named Documents, Downloads, Pictures, and Videos in your current directory.
Additional Options:
ls -l
gives you a detailed list, including file permissions and sizes.ls -a
shows hidden files and directories.
$ ls -la
total 32
drwxr-xr-x 5 username username 4096 Aug 24 12:34 .
drwxr-xr-x 3 username username 4096 Aug 24 12:00 ..
-rw-r--r-- 1 username username 54 Aug 24 12:34 file.txt
4. cd – Change Directory
What It Does:
The cd
command changes your current directory to another directory.
How to Use It:
Type cd
followed by the directory name or path.
Example:
$ cd Documents
$ pwd
/home/username/Documents
You’ve changed into the Documents directory.
Additional Tip:
cd ..
moves up one directory level.cd /
takes you to the root directory.
5. mkdir – Make Directory
What It Does:
The mkdir
command creates a new directory.
How to Use It:
Type mkdir
followed by the directory name you want to create.
Example:
$ mkdir new_folder
$ ls
Documents Downloads Pictures Videos new_folder
You’ve created a new directory named new_folder
. It is generally used when you work in project in any programming language.
6. rmdir – Remove Directory
What It Does:
The rmdir
command removes an empty directory.
How to Use It:
Type rmdir
followed by the directory name you want to remove.
Example:
$ rmdir new_folder
$ ls
Documents Downloads Pictures Videos
The new_folder
directory is now removed.
Note:
If the directory is not empty, you need to use rm -r
instead, but be careful as it will delete all contents within the directory.
7. cp – Copy Files and Directories
What It Does:
The cp
command copies files or directories from one location to another.
How to Use It:
Type cp
followed by the source file/directory and the destination.
Example:
$ cp file.txt /home/username/Downloads
This copies file.txt
to the Downloads directory.
To Copy Directories:
Use the -r
(recursive) option.
$ cp -r folder_name /home/username/Downloads
8. mv – Move or Rename Files and Directories
What It Does:
The mv
command moves or renames files and directories.
How to Use It:
Type mv
followed by the source and destination.
Example:
$ mv file.txt /home/username/Documents
This moves file.txt
to the Documents directory.
To Rename:
$ mv old_name.txt new_name.txt
9. rm – Remove Files
What It Does:
The rm
command removes files.
How to Use It:
Type rm
followed by the file name.
Example:
$ rm file.txt
This deletes file.txt
.
Additional Options:
- Use
rm -r
to remove directories and their contents. - Use
rm -i
to prompt for confirmation before deleting.
10. cat – Concatenate and Display File Content
What It Does:
The cat
command displays the contents of a file. It is widely used in linux commands.
How to Use It:
Type cat
followed by the file name.
Example:
$ cat file.txt
Hello, world!
This shows the content of file.txt
.

11. echo – Display a Line of Text
What It Does:
The echo
command prints text to the terminal.
How to Use It:
Type echo
followed by the text you want to display.
Example:
$ echo "Hello, Linux!"
Hello, Linux!
12. man – Manual Pages
What It Does:
The man
command displays the manual pages for other linux commands, providing detailed information on their usage.
How to Use It:
Type man
followed by the command name.
Example:
$ man ls
This shows the manual page for the ls
command.
13. find – Search for Files
What It Does:
The find
command searches for files and directories within a specified location.
How to Use It:
Type find
followed by the path and search criteria.
Example:
$ find /home/username -name file.txt
/home/username/Documents/file.txt
This searches for file.txt
starting from the /home/username
directory.
14. grep – Search Text in Files
What It Does:
The grep
command searches for a specified pattern in a file.
How to Use It:
Type grep
followed by the pattern and the file name.
Example:
$ grep "Hello" file.txt
Hello, world!
This searches for the word “Hello” in file.txt
.
15. chmod – Change File Permissions
What It Does:
The chmod
command changes the permissions of a file or directory.
How to Use It:
Type chmod
followed by the permissions and the file name.
Example:
$ chmod 755 script.sh
This sets the permissions of script.sh
to be readable, writable, and executable by the owner, and readable and executable by others. It very important in linux commands list.
16. kill – Terminate Processes
What It Does:
The kill
command sends a signal to terminate processes. In linux commands, it is frequently used when the system or program stuck.
How to Use It:
Type kill
followed by the process ID (PID).
Example:
$ kill 1234
This sends the default TERM
signal to process 1234.
Additional Options:
- Use
kill -9 <PID>
to forcefully terminate a process.
17. wget – Download Files from the Web
What It Does:
The wget
linux command is used to download files from the web.
How to Use It:
Type wget
followed by the URL.
Example:
$ wget https://example.com/file.zip
This downloads file.zip
from example.com
.
Additional Options:
-O <filename>
specifies a different output file name.
18. curl – Transfer Data from or to a Server
What It Does:
The curl
command transfers data to or from a server using various protocols.
How to Use It:
Type curl
followed by options and the URL.
Example:
$ curl -O https://example.com/file.zip
This downloads file.zip
from example.com
.
Additional Options:
-d <data>
sends data to the server.
19. history – Show Command History
What It Does:
The history
command displays a list of previously executed commands.
How to Use It:
Type history
and press Enter.
Example:
$ history
This shows a list of commands you’ve used recently.
Additional Options:
!<number>
re-executes the command at the specified history number.
20. nano – Simple Text Editor
What It Does:
The nano
command opens a simple text editor in the terminal.
How to Use It:
Type nano
followed by the file name.
Example:
$ nano myfile.txt
This opens myfile.txt
in the nano editor.
Additional Tip:
- Use
Ctrl + X
to exit,Y
to save changes, andN
to discard changes.
21. vim – Advanced Text Editor
What It Does:
The vim
command opens a powerful text editor with many features. In linux commands it is mostly used as an alternative of nano.
How to Use It:
Type vim
followed by the file name.
Example:
$ vim myfile.txt
This opens myfile.txt
in the vim editor.
Additional Tip:
- Use
:q
to quit,:wq
to save and quit, and:q!
to quit without saving.
22. locate – Find Files by Name
What It Does:
The locate
command quickly finds files by name using a prebuilt index.
How to Use It:
Type locate
followed by the file name or pattern.
Example:
$ locate file.txt
This finds paths that include file.txt
.
Additional Tip:
- Use
updatedb
to update the database before searching.
23. ps – Report Process Status
What It Does:
The ps
command provides information about the currently running processes.
How to Use It:
Type ps
followed by options.
Example:
$ ps aux
This lists all processes with detailed information.
Additional Options:
-e
shows all processes.
24. crontab – Schedule Tasks
What It Does:
The crontab
command manages scheduled tasks (cron jobs). This linux command mostly use when you are working in real world application.
How to Use It:
Type crontab -e
to edit the cron jobs.
Example:
$ crontab -e
This opens the cron table for editing.
Additional Tip:
- Each line represents a scheduled job with a time and command.
25. touch – files related command
What It Does:
The touch
is a versatile command for managing file timestamps and creating files, and it’s quite useful in various scripting and system administration tasks.
How to Use It:
Type touch
file_name.file_extension.
Example:
$ touch filename.txt
This creates the file.
Additional Options:
- you can create multiple files at once