Basic Linux Commands

It is very important to learn about Linux command line interface because this is the heart of Linux. We recommend you to go through this section while sitting in front of the computer

In this tutorial we will learn basic Linux commands with brief description.

`

 

_____________________________________________________________________

cd  (change directories)

We can use cd command for changing directories Suppose you are in the ‘asia’Directory and now you want to go its subdirectory named ‘pakistan’, you type‘cd pakistan’

 

Note: –This is the same command as we use in DOS (Windows CMD).

_____________________________________________________________________

ls (use to view list files and directories)

We use ls command to see a list of the files and directories located in current directory. Suppose you are in the named ‘websites’ and you type ls, a list will appear that shows the content of websites directory. see the screenshot below.

 

Note: – You may have used the ‘dir’ command on Windows.. well ls is like ‘dir’.

_____________________________________________________________________

ls –l  ( shows details list)

ls -l linux command

_____________________________________________________________________

ls –lt  (shows newest or last modified file and directory first)

_____________________________________________________________________

ls –a (shows hidden files and directories.)

if any file or directory name starts with “.” its represents hidden contents in linux operating system.

 

pwd (use to find the current location or current working directory)

After issuing pwd command you’ll see the complete path of the directory you are currently in. This command is very helpful when you forget which directory you’ve changed.

_____________________________________________________________________

cp –r  (copy files and direcotories)

cp -r /Source Of Copy /Destination Of Copied Data

Using “*” we can copy everything under /websites/ Directory.

_____________________________________________________________________

mv  (rename files and folders)

_____________________________________________________________________

rm -r   (delete files and folders)

_____________________________________________________________________

cat (read text files)

Using cat command we can read text file contents without opening it.

_____________________________________________________________________

grep ( grep searches inside files and then print out them on shell window)

Suppose i have huge name list save in this “NameList.txt” file. I want to search name “Haider” from this list then i use grep command to search specific word from this whole file Like This…

Command = grep haider NameList.txt

Similar Posts