Skip to main content

Command Palette

Search for a command to run...

LINUX commands everyone should know.

Published
•3 min read•View as Markdown
LINUX commands everyone should know.
S

Frontend Developer.DevOps enthusiast.

NOTE: filename.txt | file1.txt | file2.txt | folder name. They are just used to describe the working of commands properly. You can use any random name of your wish.

  • pwd : It will print your working directory. It will tell you in which folder/directory you are currently present.
pwd
  • cd : It will change your directory. It will help you to move in and out of any directory/folder.
cd foldername
  • touch : It is used to create a new file in that directory.
touch filename.txt
  • mkdir : It is used to create a new folder/directory.
mkdir foldername
  • ls : It is used to print all the files and folders present in your directory.
ls
  • cat : It is used to print the content present in the file.
cat filename
  • echo : It will print the content present in your file. The first command will print hello siya vats as it is on the terminal. The second command will write I am learning LINUX commands inside filename.txt
echo "hello siya vats"
echo "I am learning LINUX commands" >> filename.txt
  • whoami : It will tell you the name of the user.
whoami
  • man : It will give you the description of a command and what is the purpose of that command.
man ls/mv/pwd/whoami/....etc
  • mv : It will move a file from one folder to another. It will move file1.txt inside the newfolder.
mv file1.txt newfolder
  • diff : It will compare two files line by line.
diff file1.txt file2.txt
  • ls -l : It will give the value of file permission to the user, guest, and others.
ls -l filename.txt
  • locate : It will locate all the files ending with .txt.
locate "*.txt"
  • find : It will show all the files even hidden files.

    -type d: show all directory

    -type f: show all files

find .-type d
find .-type f
  • rm : It will remove a file.

  • rm -f : It will remove any folder.

  • rm * : It will remove all files.

rm file1.txt
rm -f foldername
rm *
  • vim : It will give you a space to write anything in the file. To exit out of that space enter: ESC + : + x then press enter.
vim file1.txt
  • df : It will tell you the disk space usage.
df
  • head : It will only display the starting 10 lines of the file.
head file1.txt
  • tail : It will only display the ending 10 lines of a file.
tail file2.txt

Thank you for reading this article. Follow for more.