Linux commands are very important for Linux Beginners. These 20 important Linux Commands will be very useful for you.
In this article, I will show you the 10 basic Linux commands and 10 advanced commands that every beginner must know.
- pwd – Print Working Directory
- ls – List files and directories
- cd – Change directory
- mkdir – Make a new directory
- cp – Copy a file or directory
- mv – Move or rename a file or directory
- rm – Remove a file or directory
- rmdir – Remove an empty directory
- man – Display the manual for a command
- exit – Exit the shell
Advanced Linux commands:
- grep – Search for a pattern in a file
- find – Find files
- sort – Sort lines of text files
- uniq – Report or filter out repeated lines
- wc – Print byte, word, and line counts
- cut – Select portions of lines
- paste – Merge lines of files
- tr – Translate, delete, or squeeze characters
- dd – Copy and convert files
- tar – Store and extract files from a tarfile archive
These are just some of the basic commands that you need to know in order to get started with Linux. If you want to learn more, there are plenty of resources available online and in books. Just remember to keep practicing and you’ll be a Linux expert in no time!
Basic Linux Commands
1. ls
The “ls” command is used to list the contents of a directory. For example, the following command will list the contents of the current directory:
ls
You can also use the “ls” command to list the contents of a specific directory. For example, the following command will list the contents of the “/etc” directory:
ls /etc
2. cd
The “cd” command is used to change the current working directory. For example, the following command will change the current working directory to the “/etc” directory:
cd /etc
3. pwd
The “pwd” command is used to print the current working directory. For example, the following command will print the current working directory:
pwd
4. mkdir
The “mkdir” command is used to create a new directory. For example, the following command will create a new directory called “mydirectory”:
mkdir mydirectory
5. rmdir
The “rmdir” command is used to remove an empty directory. For example, the following command will remove the “mydirectory” directory:
rmdir mydirectory
6. cp
The “cp” command is used to copy files and directories. For example, the following command will copy the “/etc/passwd” file to the “/tmp” directory:
cp /etc/passwd /tmp
7. mv
The “mv” command is used to move files and directories. For example, the following command will move the “/etc/passwd” file to the “/tmp” directory:
mv /etc/passwd /tmp
8. rm
The “rm” command is used to delete files. For example, the following command will delete the “/tmp/passwd” file:
rm /tmp/passwd
9. man
The “man” command is used to display the manual pages for a command. For example, the following command will display the manual pages for the “ls” command:
man ls
10. grep
The “grep” command is used to search for a text pattern in a file. For example, the following command will search for the text pattern “hello” in the “/etc/passwd” file:
grep hello /etc/passwd
Advanced Linux Commands
1. chmod
The “chmod” command is used to change the permissions of a file. For example, the following command will give the user read and write permissions for the “/tmp/passwd” file:
chmod u+rw /tmp/passwd
2. chown
The “chown” command is used to change the owner of a file. For example, the following command will make the user “bob” the owner of the “/tmp/passwd” file:
chown bob /tmp/passwd
3. find
The “find” command is used to search for files. For example, the following command will search for all files in the “/tmp” directory:
find /tmp -type f
4. ps
The “ps” command is used to display information about the currently running processes. For example, the following command will display information about all running processes:
ps aux
5. top
The “top” command is used to display information about the currently running processes. For example, the following command will display information about all running processes:
top
6. kill
The “kill” command is used to kill a process. For example, the following command will kill the process with the ID “12345”:
kill 12345
7. ssh
The “ssh” command is used to connect to a remote machine using SSH. For example, the following command will connect to the machine with the IP address “192.168.1.100”:
ssh 192.168.1.100
8. scp
The “scp” command is used to copy files over SSH. For example, the following command will copy the “/etc/passwd” file from the local machine to the machine with the IP address “192.168.1.100”:
scp /etc/passwd 192.168.1.100:/tmp
9. wget
The “wget” command is used to download files from the web. For example, the following command will download the “/etc/passwd” file from the local machine to the machine with the IP address “192.168.1.100”:
wget http://192.168.1.100/passwd
10. curl
The “curl” command is used to download files from the web. For example, the following command will download the “/etc/passwd” file from the local machine to the machine with the IP address “192.168.1.100”:
curl http://192.168.1.100/passwd -o /tmp/passwd
These are just a few of the most commonly used Linux commands. There are many more that can be used to perform various tasks. Experiment with different commands and see what they do. Also, check out the man pages for each command (e.g., “man ls”) to learn more about them.