Learn the Linux command line - Chapter 1

Linux Command line tutorial - Chapter 1



ls - To listing the directory

ls -a  - To listing the directory and dispaly the file which are normally Hidden

ls directoryname - To dispaly the file inside a folder

mkdir ­ - To create the directory example: mkdir sagar

cd directory ­-  To enter inside the directory or change to named directory like: cd sagar

cd - Change the home directory



cd ~ - Direct come to home direcoty
 
cd .. - To go back into the last directory

pwd - To display the full path from start to current directory
Like:
/home/ununtu/sagar/linux

cp file1 file2 -  is the command which makes a copy of file1 in the current working directory and calls it file2.

mv file1 file2 moves (or renames) file1 to file2
 exmple: mv file.txt ../
to move the file in last folder

rm filename.txt - To remove the file

rmdir directoryname - To remove the directory

clear - Clear command to use for remove clear the terminal screen

cat science.txt - TO display the file content

 head file.txt  - it display the content of f ile only 10 line

head -5 file.txt - it will display only 5 line of a file from top

tail file.txt -  is vise versa of head command it will show last ten line of file

To Search a word from a file
type: less file.txt
now it will show the full text of file now press /(slash)
like: /developer
then it will highlight the word if it exist.

grep keyword file.txt - it will serach the keyword and show as highlight in red color while display the full line

grep -i keyword file.txt - it will seach the keyword in lower case and upper case

grep -i 'web developer' file.txt - it will seach the keyword in lower case and upper case and a phase keyword and it should be under enclosed single quotes

wc -w file.txt - To count the word in a file

wc -l file.txt - To Count the line in a file



cat science.txt - To display the file of content
 

Comments