Linux Commands
1. pwd (print working directory)--- directory in which you are currently located
in.
2. ls (list)---listing of everything in curren tdirectory
ls -a --- shows hidden files
ls -l --- long list of everything
ls -la --- everthing and everthing
3. cd (change directory) folder_name --- to enter the folder_name
cd with no argument is take me to home directory
cd with two shifts is autocomplete shortcut
4. cd .. --- retutn from the directory
5. cd / --- root directory
6. cp folder_name folder_name_copy --- makes a copy of folder_name with new file
called folder_name_copy.
7. rm folder_name_copy --- deletes folder_name_copy file
rm *file --- removes all files like file1 filea etc from the directory in
which it is currently in.
8. mkdir folder_name --- moves directory called folder_name
a. mkdir -p jesus/ loves ---- creates parent folder jesus along with a
subfolder loves.
9. rmdir folder_name --- used to remove empty directory called folder_name
10. rm -r folder_name --- used to remove folder called folder_name if it has file.
11. date --- shows date
12. cal --- shows calendar
13. Up and down arrow ---- used to navigate previous command history
14. echo “ Message” --- used to print Message
15. exit --- exiting from the command prompt
16. less file_name --- to open the file. Want to exit less press q.
less -N file_name --- will display number of lines
17. pushd /directory --- to go to a new directory from present directory
18. popd --- to return to the present directory
19. file .file_name ---tells you the file extension
20. locate file_name --- searches for file_name
21. which command --- searches whether the specific command is installed or not
22. history --- shows history for all commands
23. whatis command --- tells you the command description
24. apropos command ---
25. man command --- all the manual for the specific command
26. touch file_name --- create files or change time stamp of files
27. mv text_filename different_text_filename --- renames text_filename to
different_text_filename
mv text1 text2 --- moves contents of text1 to text2 but the name is same as
text1. Contents of text 2 is gone.
28. cat >> text
hi,
this is Tanmay
Press control d
this process just created a file named text and stored the above text.
Control D saved the file.
Cat text1 text2
This will conconate text1 and text2 file
cat text
Will read the file text and printout it out on the screen.
Cat > text
Hi
ctrl d
will remove previous enteries to text file and just add Hi.
29. nano text
will create a file nano and you can work with it like a notepad
30. ls -a > text
copies all contents of ls -a into a file called text
history > text
copies all contents of history into a file called text
31. sudo updatedb --- syncs up everthing for autofill
sudo -s --- working as root user
exit --- to get out of root user
su – tanmay
logging to user as tanmay
32. users --- command used to see who is logged into the system
33. id --- all the information about user
34. ctrl c --- kills command
35. killall