Most Important Basic Linux Commands

In this blog, I am sharing an important basic Linux commands which are frequently used in our day to day work.

Here I have created four files (file1.txt, file2.txt, file3.txt and .file4.txt) inside workfolder to show an example for the below commands.

ls command

ls command is a basic command to see the list of files in the current directory


The ls command lists files and directories within the current working directory. Files listed in the grid format.


[[email protected] workfolder]$ ls
file1.txt file2.txt file3.txt

ls -lrt

Files listed order based on Last Modified Time (In Reverse Order).


[[email protected] workfolder]$ ls -ltr
total 0
-rw-rw-r--. 1 narayanatutorial narayanatutorial 0 Apr 16 15:25 file1.txt
-rw-rw-r--. 1 narayanatutorial narayanatutorial 0 Apr 16 15:37 file2.txt
-rw-rw-r--. 1 narayanatutorial narayanatutorial 0 Apr 16 15:43 file3.txt
[nar[email protected] workfolder]$

ls -a

By default ls command will not display hidden files which contains .(dot) in front of the file name. So by using this command we can see hidden files. Here .file4.txt is a hidden file.


[[email protected] workfolder]$ ls -a
. .. file1.txt file2.txt file3.txt .file4.txt

cd command

The cd command changes the current directory in Linux and can toggle between directories conveniently. cd is similar to the CD and CHDIR commands in MS-DOS.


[[email protected] ~]$ cd workfolder/

Here we can see the current directory path using pwd
[[email protected] workfolder]$ pwd
[[email protected] workfolder]$

pwd command

The pwd (print working directory) command displays the name of the current working directory.


[[email protected] workfolder]$ pwd
[[email protected] workfolder]$

clear command

The clear command clear the screen which is similar to cls command in the MS-DOS.

man command

If we don’t know options of the command or syntax of the command  then no need to worry. we have documented all commands options and syntax in . we can see more details of the each command by using the man command.

The man is short for manual. The  man allows a user to format and display the user manual built into Linux distributions which documents commands and other aspects of the system.


[[email protected] workfolder]$ man ls


LS(1) User Commands LS(1)

 ls - list directory contents

 ls [OPTION]... [FILE]...

 List information about the FILEs (the current directory by default).
 Sort entries alphabetically if none of -cftuvSUX nor --sort.

 Mandatory arguments to long options are mandatory for short options

 -a, --all
 do not ignore entries starting with .

 -A, --almost-all
 do not list implied . and ..

 with -l, print the author of each file

mkdir command

Creates a new directory. Here we have created workfolder-2 folder inside /home/narayanatutorial


[[email protected] ~]$ mkdir workfolder-2
[[email protected] ~]$ ls
Desktop Downloads Pictures Templates workfolder
Documents Music Public Videos workfolder-2
[[email protected] ~]$ pwd

rmdir command

Deletes the specified directory, provided it is already empty. Here we have deleted workfolder-2 inside /home/narayanatutorial

[[email protected] ~]$ rm -r workfolder-2/
[[email protected] ~]$ ls
Desktop Downloads Pictures Templates workfolder
Documents Music Public Videos
[[email protected] ~]$ pwd
[[email protected] ~]$

The Author


Hello! I am Narayanaswamy founder and admin of I have been working in IT industry more than 7 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting and Website Development. I am a self learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.


Add a Comment
  1. I have seen lot blogs and Information on othersites But in this Java Blog Information is very useful thanks for sharing it……..

Leave a Reply