Basic Linux commands.

Abinash Panda
2 min readDec 31, 2019
  • “~” means home directory
  • “/” means root directory
  • “.” means current directory
  • “..” means previous directory

pwd

  • present working directory
pwd// output
/home/abinash/workspace

cd

  • change directory
// go to previous directory
cd ..
// go to root
cd /
// go to home
cd ~

mkdir

  • to create a new directory
mkdir app

rmdir

  • to delete a directory
// can only remove empty directory
rmdir app
// to remove non-empty directory
rmdir -rf app

touch

  • to create a new file
touch index.html

file

  • to know the file type
file index.html

mv

  • to move or rename a file/dir
// renaming a file from file1.txt to file2.txt
mv file1.text file2.txt
// moving file1.txt to home directory
mv file1.txt ~

man

  • to display the manual of that command
man vim

cp

  • to copy a file/dir
cp index.html ./

ls

  • display the files in that dir
// flag to display with hidden files
ls -a

rm

  • remove one or more files
rm index.html index.css

whoami

  • to know the current user

find

  • to find a file

cat

  • to print the file in terminal

whatis

  • to know about a command
whatis ssh

tree

nano

  • nano is a CLI text editor
// if file is not created it will create for you
nano index.html
  • ctrl + x to exit
  • ctrl + s to save

clear

  • to clear the screen

exit

  • to exit the terminal

--

--