Command Line Interface

What is CLI?

CLI means command line interface.It is a text based interface where we can input commands that is translated where the kernel can read and process the information we given.

CLI Commands

1.pwd

To know the present working directory i.e in which directory we are present it will show.

pwd

2.ls

To display list of files present in the present directory.

ls
ls -a
ls -l

3.mkdir

It is used to create directory with the name cli. It is created to store and oraganize the files.We can create one or more directories at a time

mkdir cli

4.touch

Touch is used to create the files . Here I created a file with name basics.txt. By using touch command we can create one or more files.

touch basics.txt

5.cd

  • To change directory , i.e if we want to shift to other directory from current one.

  • Second line is to come back from present or current directory.

  • Third line is directly to go to root directory.

      cd directoryname
      cd .. or cd ~ or cd -
      cd /
    

    6.cat

To see the contents of file

Second line to insert the text

Third one is not to override and to add new contents.

cat filename.txt
cat > filename.txt
cat >> filename.txt

7.find

To find the file where it is present

find -name filename.txt

8.chmod

To change the permissions of user or groups or all by using symbolic or absolute code.

chmod g+r
chmod 731

9.chown

To change files ownership

sudo chown :newgroup filename

10.grep

It is used to identify the words by highlighting and count the words etc.

grep -i word file.txt
grep -c word file.txt

11.sudo

To install or update anything we use sudo

sudo apt -install file

12.cp

To copy all files from one directory to another directory

cp -r directory1 directory2

13.sort

To see the sorted data

sort file.txt

14.more and less

more filename.txt
less filename.txt

15.rm and rmdir

rm-To remove the file

rmdir-To remove the directory

rm file.txt
rmdir directoryname

OS/Process

1.ps

It gives the information of processes.

ps

2.kill

To kill the running process

kill pid

3.top

To know the running processes

top

1.ping

To check the connections,all packets are received or not and to check internet connection.

ping google.com

2.nslookup

To find the ip address of required one.

nslookup google.com

3.ifconfig

display the configuration information

ifconfig

1.nano

To display and edit or add contents

namo filename.txt

2.sed

To display the range of data or to substitute data or to modify data

sed -n '100,200p' filename.txt

3.pipe operator |

To combine two or more commands.

cat filename.txt|grep -c anyname