Linux Basic Commands

Basic commands of Linux was given below:
Directory means folder which contains n no of files. To practice these commands first go to the Linux operating system of flavor(version) Ubuntu's Terminal.
mkdir- make a directory. This command creates a directory.
mkdir Achyut
here Achyut is a directory or folder.
cd-change directory. It is used to change the directory.
cd Achyut
touch-This command is used to create an empty file. In this empty file, we can not write data inside the file. we can not save or edit this empty file.
cd Achyut
touch ex.txt
here ex.txt is an empty file that is created inside the Achyut directory.
ls- List of files. It shows a file list present in a directory.
cd Achyut
touch ex.txt
ls
output is-:ex.txt
pwd- It stands for present working Directory. This command gives information about which directory you are in.
cd Achyut
pwd
output is-:/home/dell/Downloads/Achyut
clear-it is used to clear the terminal or screen.
history-it shows the list of commands previously perform in the terminal.
To view what's written in a file.
command is-:cat <filename>
ex-:
vim ex2.txtdell@dell-Inspiron-3576:~/Downloads/Achyut$ cat ex2.txthi good morning.iam a good boy.here vim is a text editor. It creates the file and in this file, we can perform tasks like editing data, inserting data, and saving the data.
To change the access permissions of files.
the command is-: chmod u+r <file name>
ex-:
chmod u+r ex2.txtls -lin numerical method-:
chmod 400 ex2.txtr-------- 1 dell dell 32 Jul 18 11:41 ex2.txtthe numerical value of read is 4, write-2, execute-1, no permission -0.
here permission was given to the user to read that file.
chmod 777 ex2.txtls -l-
rwxrwxrwx 1 dell dell 32 Jul 18 11:41 ex2.txtall permission was given to the user, group, and others.
To check which commands you have run till now.
command is- history.
dell@dell-Inspiron-3576:~$ history1 cd Downloads/2 ls3 sudo dpkg -i google-chrome-stable_current_amd64.deb4 sudo apt install -fTo remove a directory/ Folder.
the command is- rm filename
ex-:
dell@dell-Inspiron-3576:~/Downloads/Achyut$ rm ex2.txtdell@dell-Inspiron-3576:~/Downloads/Achyut$ lshere the file was removed from the folder Achyut.
dell@dell-Inspiron-3576:~/Downloads$ rmdir Achyut/dell@dell-Inspiron-3576:~/Downloads$ lshere the directory or folder Achyut was removed.
To create a fruits.txt file and to view the content.
dell@dell-Inspiron-3576:~/Downloads/ad$ vim fruits.txtdell@dell-Inspiron-3576:~/Downloads/ad$ cat fruits.txtApplemangobananaTomatoAdd content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
dell@dell-Inspiron-3576:~/Downloads/ad$ vim devops.txtoutput is-
AppleMangoBananaCherryKiwiOrangeGuavaShow only the top three fruits from the file.
dell@dell-Inspiron-3576:~/Downloads/ad$ head -3 fruits.txtoutput is-
ApplemangobananaShow only the bottom three fruits from the file.
dell@dell-Inspiron-3576:~/Downloads/ad$ vim fruits.txtthis is data inside the fruits.txt
ApplemangobananaTomatoorangeShow only the bottom three fruits from the file-:
dell@dell-Inspiron-3576:~/Downloads/ad$ tail +3 fruits.txtoutput is-
bananaTomatoorangeTo create another file Colors.txt and to view the content.
dell@dell-Inspiron-3576:~/Downloads/ad$ vim Colors.txtdell@dell-Inspiron-3576:~/Downloads/ad$ cat Colors.txtAdd content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
dell@dell-Inspiron-3576:~/Downloads/ad$ vim Colors.txtdell@dell-Inspiron-3576:~/Downloads/ad$ cat Colors.txtOutput is-:
RedPinkWhiteBlackBlueOrangePurpleGreyTo find the difference between fruits.txt and Colors.txt files.
diff fruits.txt Colors.tx




