×



Linux command line is a powerful tool which is fast and effective. It lets you complete tasks faster that would otherwise take longer using the GUI. Being familiar with basic commands goes a long way. 

Generally, Linux is an entire family of open-source Unix operating systems, that are based on the Linux Kernel. This includes all of the most popular Linux based systems like Ubuntu, Fedora, Mint, Debian, and others. More accurately, they’re called distributions or distros.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux Commands queries.

In this context, we shall look into the most frequently used commands in Ubuntu Linux OS.



1. pwd (print working directory)

One of the simplest commands, pwd lets you print the path of the folder you are in, your current working directory.

Run the command:

$ pwd


2. cd (Change directory)

One of the most commonly used commands, cd lets you change directories. Let's say you want to go to the Downloads directory. It would be:

$ cd Downloads

If you want to go back to your previous directory, use:

$ cd -

To move up one directory, use:

$ cd ..

To go to your home directory, use:

$ cd ~


3. ls (Listing files)

This command is used to list the contents of a directory by default, it displays the content of your current working directory. The command is:

$ ls

If you want to see the contents of other directors, go to the directory's path to view them.

You can use different variations of the command to view specific information.

To view the contents of subdirectories, use:

$ ls –R

To view hidden files:

$ ls –a

To view details like file size, permissions, owners, etc., use:

$ ls –al


4. cat (concatenate)

This command lets you create files, view its contents, redirect input to files, and concatenate them.

Let's see how this works. The command is:

$ cat >> filename

Next, you enter your text and then hit CTRL+d to exit.

To view the contents of this file, use:

$ cat filename

Let's see how concatenation works. We will create another file first.

To combine both files, use:

$ cat {file1} {file2} > {newfile}

We have combined the files in catfile3.txt. To view the contents of catfile3.txt, use:

$ cat catfile3.txt


5. mkdir (make directory)

This command lets you create new directories. Run:

$ mkdir {directoryname}

To verify if the directory was created, use ls.

To create multiple directories, use:

$ mkdir {directoryname1 directoryname2 directoryname3}


6. rm

To delete a single file, use:

$ rm filename

To verify if it was deleted, use ls.

As you will notice, you don't have the option to confirm if you really want to delete the file. To change that, use:

$ rm –i {filename}

Here, you will be prompted to confirm, hit Enter.

To delete a directory, use:

$ rm -d {directory name}

To verify if the directory was deleted, use ls.

This command only deletes empty directories, if it has content, you cannot use it.

To delete such directories, use:

$ rm –r {directoryname}

To verify if the directory was deleted, use ls.


7. passwd (Change password)

You can change passwords using this command. Unless you are a root, you can only change your password.

The command for changing your own password is:

$ passwd

You will be asked to enter the following:

Current password:
New password:
Retype the new password:

You will have to re-enter your new password if it's the same as your current one.

Entering the wrong password causes the authentication to fail.


8. clear

If you want to clear the clutter on your terminal, use:

$ clear

It clears the terminal and gives you a clean space to work on.


9. history

To view all the commands you have used in the current terminal session, use:

$ history

By default, history shows you the past five hundred commands you have used.


10. man (manual)

This command is very helpful on getting help on commands you don’t understand. It gives details on the command, its options, errors, return values, versions, examples, etc.

Execute the command:

$ man {command}


[Need assistance in fixing Linux System Installation issues? We can help you. ]


Conclusion


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com