The Linux command line (CL) is a wonderful tool, that gives you power beyond normal point-and-click. With it you can unleash the full force of the open-source operating system for any purpose. Yet many new comers shy away from using it.
Though it can seem daunting and intimidating at first, looking more like a no-go area for noobs. But the more you come to know about and use it, you’ll realize that the CL is beginner-friendly and interesting to work with.
To begin this journey lets see some common and powerful commands that should be familiar with like the back of your hands.
This is one of the most used Linux command of all. The cd (change directory) command is used to transverse the file system – moving from one place (directory I mean) to another. On login in to Linux you’re taken to your home directory (/home/your_username) by default.
To change to another directory simply enter: cd directory_name.
You can see here that I navigated to the desktop.
And also you can to just specify an absolute directory path and fly to the location straight-away instead of some numerous steps of cd-ing.
Here instead of typing about three or four cd commands I used only one with the directory location.
To return to your home directory from anywhere, you can easily combine the cd command with the tilde (~) symbol like this: cd ~
To return to one directory-level up, combine cd with two dots (..): cd ..
The ls (list) command is used to list files in a directory.
Entering the command would return the list of all the files and (sub)directories in your present location. If combined with a directory path, the files and sub-directories in that path are returned.
There two very useful options that can be used with the ls command are:
– a → to list all files (including the hidden files and sub-directories).
– l → to list the details (like file/directory size, date and time of modification, permissions, creator) of files and sub-directories.
And they can be combined like this: ls -al
You can always combine the ls and cd commands to get to any directory of your choice on the file system.
The touch command is used to create a file. It can be used to create any type of file, by simply adding the extension of the file you want. If the extension is not added a normal text (.txt) is created – which is the default.
The mkdir (make directory) command, as it names signifies, is used to make directories. This is similar to to right-clicking with your mouse and choosing “New folder” in a graphics user interface (GUI). To use mkdir simply combine the command with the name of the directory you want to ceate: mkdir newDirectory.
This creates the “newDirectory” directory in your current location.
With this command you could check your current directory location (or absolute path) by simply typing the pwd in the terminal.
The clear command is used to clear the terminal screen. After entering commands with verbose output, you can give yourself a clean slate using the clear command.
There are many useful Linux commands you will come across, but these ones above would definitely make your use of the terminal more effective. So play with them and see the magic!
- Sovereign Tech Fund Invests €1M In GNOME’s Open-Source Project - November 19, 2023
- Google’s Bard AI: ChatGPT Rival or The Next Frontier in AI and NLP Technology - February 8, 2023
- Google Introduces KataOS, as a Security-based Open-source Operating System - December 22, 2022