If you got to start with the Linux, A thorough knowledge in Basic linux commands is must have. without much ado lets check out the various commands and tools to begin the journey of linux. If you still need to have more clear understanding of concept before starting here, refer to what is linux 

Basic linux commands

Linux offers a wide range of commands for both privileged and non-privileged use. Privileged or Super User commands are used for system management and are meant only for privileged users. Non-privileged commands can be run with regular user rights.

These commands are essential in order to work productively and manage the system efficiently.

Understanding the command syntax

The general command syntax is :

command option argument

You can use zero or more options and arguments in a command. Some commands have default options and arguments that they use when executed, and you do not need to mention them. Other commands require At least an Argument or option. An option, also called as switch or flag, modifies the behavior of the command, and an argument works as the target on which command is executed.

To make things simpler let’s follow few examples:

$ ls (no option, no argument; the default argument is the current directory name)
$ ls –l (one option, no argument; the default argument is the current directory name)
$ ls directory_name (no option, one argument)
$ ls –l directory_name (one option, one argument)

lets discuss it in detail

Files and directory listings

The ls (list) command is one the most important and easiest of Basic Linux commands and it displays a list of files and directories on the screen. It supports several options, given below-

Option Description

a    :Lists all files along with the hidden files. If a file or directory name                       starts  with a dot, it is considered hidden.
lh   :long listing with file sizes in human readable format, i.e, Bytes, KB MB               or GB.
l      :Displays long listing with detailed file information. Includes the file                   type, permissions, link count, owner, group, size, date and time of last               modification, and name of the file
ld    :Displays long listing of the specified directory.
R     :Lists contents of the given directory and all its sub-directories                              (recursive  listing).
lt     :Lists all files sorted by date and time with the latest file first.
ltr   :Lists all files sorted by date and time with the oldest file first.

For instance the option “-a” is included in this exmple :

#ls -a
#ls -a <dir name>

The angular bracket < > is not used, it is just to show the example content inside it.

Printing Working Directory

The pwd (print working directory) command shows the user’s current location in the directory tree.

The below command when executed by the testuser from its home directory shows-


Changing the directory

The cd (change directory) command is  used to navigate the directory tree. Run the following commands as testuser.
To change directory to /usr/ bin

$ cd /usr/ bin

To go back to the home directory, issue either of the following:

$ cd
$ cd ~

To go to the home directory of testuser :

$ cd ~testuser

where ~ is “tilde” symbol.

To go to the root directory, use the forward slash character:
$ cd /

To switch between current and previous directories, use the cd command with the dash character:

$ cd

To go one directory up to the parent directory, use dot twice:

$ cd ..

Showing the Terminal name

This command displays the terminal name we are currently logged on to:

$ tty

Displaying Currently Logged-In Users

The who command jumps to the /var/ run/ utmp file and presents the list of users currently logged on to the system:


Viewing User Login Name

The whoami (who am i) command displays the effective username of the person executing this command:

$ whoami

The logname (login name) command shows the name of the real user who originally logged in to the system:

$ logname

Displaying History of Successful User Login Attempts

The last command reports the history of successful user login attempts and system reboots.

To list all user login, logout, and system reboot records, use the last command without any arguments:


Viewing History of Failed User Login Attempts

Among the Basic linux commands the lastb command reports the history of unsuccessful user login attempts by reading the /var/ log/ btmp file.

To list all unsuccessful login attempts, type the lastb command without any arguments.

The last and lastb Basic linux commands should be executed with the root user account privilege.


Checking Recent User Logins

The lastlog command shows the recent user logins by accessing the /var/ log/ lastlog file. T


Command for system infomation

The uname command provides basic information about the system.
Without any options, this command displays the Operating System name only.

# uname

You can use the –a option to get details.

# uname –a


Linux host1. example.com 3.10.0-123. el7. x86_64 #1 SMP Mon May 5 11: 16: 57 EDT 2014 x86_64 x86_64 x86_64 GNU/ Linux

The information returned by the second command is:

Linux (Kernel name)
host1. example.com (Hostname of this system)
3.10.0-123. el7. x86_64 (Kernel release)
#1 SMP Mon May 5 11: 16: 57 EDT 2014 (Date and time of this kernel built)
x86_64 (Machine hardware)


These are few Basic linux commands. However, there are more and I will keep you tipped up in my forthcoming posts.


Also check out the website for ubuntu to have an broader overview.

Leave a Reply

Your email address will not be published. Required fields are marked *