Top 50 Linux Commands You MUST Know

Posted by

The Top 50 Linux Commands Every Regular User Needs to Know

  1. ls– The Linux command that is most commonly used to list folders
  2. pwd – Print the Linux working directory command.
  3. cd – Using a Linux command to browse directories
  4. mkdir – Linux command for creating directories
  5. mv – In Linux, move or rename files.
  6. cp – Similar usage as mv but for copying files in Linux
  7. rm – Delete folders or files
  8. touch – Make empty or blank files.
  9. ln – Make shortcuts, or symbolic links, to other files.
  10. cat – Show the contents of the file on the terminal
  11. clear – Clear the terminal display
  12. echo – Print any text that complies with the directive.
  13. less – Display paged outputs in the terminal using a Linux command
  14. man – View the manual pages for every command in Linux.
  15. uname – Use the Linux command to obtain system overview data.
  16. whoami – Get the active username
  17. tar – Linux command for file extraction and compression
  18. grep – Search for a string within an output
  19. head – Return the specified number of lines from the top
  20. tail – Return the designated amount of lines starting at the bottom.
  21. diff – Find the difference between two files
  22. cmp – enables you to determine whether two files are the same.
  23. comm – combines the capabilities of cmp and diff.
  24. sort – Sorting file content when generating an output using a Linux command
  25. export – In Linux, export environment variables
  26. zip – Zip files in Linux
  27. unzip – Unzip files in Linux
  28. ssh – Linux’s Secure Shell command
  29. service – Linux command for initiating and ceasing service
  30. ps – Display active processes
  31. kill and killall – Kill active processes by process ID or name
  32. df – Show details about the disc filesystem
  33. mount – In Linux, mount file systems
  34. chmod – Command to change file permissions
  35. chown – An instruction to give ownership of a file or folder
  36. ifconfig – See IP addresses and network interfaces displayed.
  37. traceroute – Trace all the network hops to reach the destination
  38. wget – Direct download files from the internet
  39. ufw – Firewall command
  40. iptables – the foundational firewall that all other firewall programmes communicate with
  41. apt, pacman, yum, rpm – package managers based on the operating system
  42. sudo – Command to escalate privileges in Linux
  43. cal – See an agenda with a command line
  44. alias – Make unique shortcuts for the commands you use frequently.
  45. dd – Majorly used for creating bootable USB sticks
  46. whereis – For a command, find its binary, source, and instructional pages.
  47. whatis – Find out the purpose of a command.
  48. top – View active processes live with their system usage
  49. useradd and usermod – Add new user or change existing users data
  50. passwd – Initiate or modify passwords for current users.

Let’s now examine each of these instructions in greater detail and go a little further into them. There are numerous articles already available for each of those specific commands. We will continue to update the page when new topics are discussed and provide links to all of the previously published articles for your convenience.

The ls command in Linux

To view a list of the files and folders in the current working directory, use the ls command. One of the most important Linux commands you will need to know is this one.

The pwd command in Linux

You may print the current working directory on your terminal by using the pwd command. It’s a really simple command that accomplishes the goal admirably.

Now, the entire directory should normally be displayed in your terminal prompt nevertheless. This command can be used to quickly view the directory you’re in, but, just in case it doesn’t. Using this command to locate the directory where the script has been saved is another way to use it while creating scripts.

The cd command in Linux

Navigating through directories is nearly a must when working in the terminal. One of the most crucial Linux commands you should be familiar with is cd, which will enable you to browse folders. Simply type directory followed by cd, as demonstrated below.

To access the /etc directory, I just entered cd /etc/, as you can see in the command above. We printed the current working directory using the pwd command.

The mkdir command in Linux

Directories can be created directly from the terminal with the mkdir command. The directory name is followed by mkdir in the normal syntax.

The cp and mv commands

The Windows copy-paste and cut-paste functions are comparable to the cp and mv commands. However, we also use the mv command to rename files and folders because Linux doesn’t actually have a tool for that.

Using the mv command in the same way that we did with the above command, we can create a copy of the file named Sample. I’ll remove the Sample-Copy file to show you what occurs.

In the aforementioned instance, it functioned as a rename because we were relocating the file within the same directory. Now, the file name is different.

The rm command in Linux

We removed the Sample-Copy file in the previous section. One essential Linux command you need to know is rm, which is used to remove files and folders.

A directory must have the -r argument added to it in order to be deleted. Directories cannot be deleted by the rm command without the -r parameter.

The touch command in Linux

The touch command will be utilised to generate a new file. A file will be created in the current directory if the touch keyword and the file name are used together.

The Linux ln command

We use the ln command to make a link to another file. If you intend to work as a Linux administrator, you should be familiar with this crucial command.

Using the -s argument to create a symbolic link, also known as a soft link, is part of the basic syntax.

The cat, echo, and less commands

We use the cat or echo commands to print anything to the terminal output or to produce the contents of a file. Examine their fundamental use now. I updated our previously made New-File with some text.

The aforementioned example demonstrates how the cat command, when applied to our “New-File,” prints the file’s contents. When we use the echo command, it prints whatever comes following the command at the same time.

When any command prints output that is too big for the screen and requires scrolling, the less command is used. Using the enter or space keys, we may traverse through the output by breaking it down with the less command.

Using the pipe operator (|) is a straightforward method to accomplish this.

The man command in Linux

One very helpful Linux command you should be familiar with is man. The packages we download to work with Linux sometimes include a large amount of functionality. It is difficult to know everything.

The man pages provide an incredibly effective method for learning about the features of almost any package available for download through your Linux distribution’s package managers.

The uname and whoami commands

Knowing some fundamental information is made possible with the uname and whoami commands, which is quite helpful when working on many systems. Generally speaking, you won’t need it as frequently as a network administrator if you’re working with a single machine.

Let’s examine the instructions’ output as well as possible applications.

I’ve given uname the parameter -a, which stands for “all.” This generates a printed copy of all the data. “Linux” is the only result you will receive if the parameter is left out.

The tar, zip, and unzip commands

The tar command in Linux is used to create and extract archived files in Linux. The tar command allows us to extract various archive files.

To create an archive, we use the -c parameter and to extract an archive, we use the -x parameter. Letā€™s see it working.

Using the New-File and New-File-Link, we generated the Compress.tar archive in the first line. We have extracted those files from the archive using the following command.

The instructions to zip and unzip are now available. These two commands are really simple to understand. These can be used without any restrictions and will function as intended. Take a look at the sample below.

The grep command in Linux

When searching for a certain string in an output, the grep command becomes useful. The necessary string can be extracted by pipetting (|) the output to the grep command.

# Basic Search
$ grep "example" test.txt

# Case Insensitive Search
$ grep -i "example" test.txt

# Search in Multiple Files
$ grep "example" test1.txt test2.txt

# Line Number of Matches
$ grep -n "example" test.txt
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x