6 Commands you must know to be Productive on the terminal.

By | April 19, 2018

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.

#1: cd.

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.

cd command

IMAGE: FOSSNAIJA.COM

To change to another directory simply enter: cd directory_name.

cd command 2

IMAGE: FOSSNAIJA.COM

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.

cd command 3

IMAGE: FOSSNAIJA.COM

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 ..

#2: ls

The ls (list) command is used to list files in a directory.

ls command 1

IMAGE: FOSSNAIJA.COM

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

ls command 2

IMAGE: FOSSNAIJA.COM

You can always combine the ls and cd commands to get to any directory of your choice on the file system.

#3: touch

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.

For instance to create a JavaScript (.js) file in your current directory location, simply enter: touch helloWorld.js

touch command

IMAGE: FOSSNAIJA.COM

The “helloWorld” is the name of the file and the “.js” is the file extension (i.e. showing that it is a JavaScript file). Adding “.php” creates a PHP file; adding “.html” creates an HTML file and so on.

#4: mkdir

 

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.

mkdir command

IMAGE: FOSSNAIJA.COM

This creates the “newDirectory” directory in your current location.

#5: pwd

With this command you could check your current directory location (or absolute path) by simply typing the pwd in the terminal.

pwd command

IMAGE: FOSSNAIJA.COM

#6: clear

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.

Wonderful right?

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!

Happy Linux’NG!


NEVER MISS AN UPDATE




I agree to have my personal information transfered to MailChimp ( more information )

Join over 10,000 visitors to receive Open Source tips, trick, news, tutorials, programming and more.

We hate spam. Your email address will not be sold or shared with anyone else.

ALEXANDER OMOROKUNWA
MUST READ  Ubuntu’s Unity desktop environment may continue… as a third-party fork

Tell us what you think