The Linux command line is a powerful tool with a wide range of functions. Users mostly use it to interact with their computers, and it gives them access to a variety of tools that can expedite and streamline their work. To fully utilise this capacity, you must be familiar with a few fundamental commands and shortcuts. Furthermore, grasping the fundamental commands of Linux is essential to making the most of all of its features.
I recently posed the question, "What is your favourite Linux command?" on X (previously Twitter). and I received a lot of responses.
After viewing most of the comments, I've selected a couple that might be significant which is also important to know
rm Command:
rm removes all the files from the current directory with a prompt. rm -RF removes all the files and directories recursively without a prompt
Example: rm test.txt
touch Command:
An empty file is created in the current directory by the touch command.
Example: touch test.txt
rmdir Command:
The rmdir command deletes an empty directory from the current working directory
Example: rmdir example_directory
cd Command:
It's used to navigate between directories or folders within a file system.To go directly to the root directory we use cd command alone.
Example: cd /home/user
ls Command:
This command is used to list files and directories in a directory. When used with the -lrh options, it provides a detailed list with specific formatting
-l: Produces a long listing format, showing additional information such as permissions, owner, group, size, and modification time.
-r: Lists files and directories in reverse order.
-h: Prints sizes in a human-readable format (e.g., kilobytes, megabytes, gigabytes).
Example: ls -lrh
cat Command:
Photo by Manja Vitolic on UnsplashThe cat command displays the contents of a text file.
Example: cat example.txt
pwd Command:
The pwd command displays the path of the current working directory.
Example: pwd
man Command:
Photo by Warren on UnsplashTo access the manual pages for a specific command, use the man command. It offers comprehensive details on the syntax, options, and operation of a command.
Example: man ls
sudo Command:
In Unix-like operating systems, the sudo command represents "superuser do." As determined by the security policy set up on the system, it permits a permitted user to run a command as the superuser (root) or as any other user.
Example: sudo nano /etc/hosts
Apart from these commands, there are a few more commands that you might not be aware of, so check out this video for further insights.
Thanks for reading, please give a like as a sort of encouragement and also share this post in socials which might benefit someone.
Connect ⬇️
Twitter / Instagram / Github / Youtube / Newsletter / Discord
Top comments (4)
The
touch
command is actually for updating the access and modification times of the specified file. The fact that a new file is created if it doesn't already exist is merely a useful side effect.Thanks for your input @jonrandy
Great article!
Thank you @yowise