Basic Linux Commands

Basic Linux Commands

hostname : To check the name of machine.

pwd : To check the present working directory.

cd directory_name : To change the directory.

cd ~ : To change directory to the home directory.

cd - : Go to the last working directory.

cd .. : To go back one step from the existing directory.

cd ../.. : To go back two step from the existing directory.

ls : To check the list of files and directory.

ls -l : To check the list of all the files and directory in long format with extra information.

ls -a : To check the all hidden files and directory.

ls .sh : To check list of all the files with .sh extension.

ls -i : To check the list of all the files with index number.

ls -d / : To check the list of all directory.

mkdir folder_name : To create new directory.

mkdir .folder_name : To create hidden directory.( . before file to make sure it is hidden file)

mkdir A1 A2 A3 A4 : To create multiple directory at the same time.

mkdir /home/user_name/NewFolder : To create new directory in a specific location.

mkdir -p B1/B2/B3 : To create nested directory.

cat file_name : To view the file content.

chmod 777 folder_name or file_name : To provide full access permission to file or directory.

history : To check which comment you have run till now on terminal.

rm file_name : To Remove directory.

vi file_name : To create file (e.g vi hello.txt - create hello.txt file and open)