Commands - Task performed by the command
1. clear - clear the screen
2. Pwd - present working directory
3. cd - change directories
4. cd / - to change your dir to root directory
5. cd .. - to go to parent directory
6. Cd ../../.. - to go to parent directory
7. cd dir1/dir2 - to go inside a directory if you have a path
8. ls- to check the content inside directory, means it will list the files/folders
9. Ls -l - to get a list view of the items
10. Ls -R - it will recursively show content with folders and inside folders
11. Ls -f - show difference between files and directories
12. Ls -a - to list the hidden files.
13. Mkdir dir1
14. Mkdir dir1 dir2 dir3 so on
15. Mkdir -p vishwas/vishwas2/vishwas3 - to create parent directories if they don't exist.
16. Touch 1.txt - to create a file with a certain name
17. Rm 1.txt - to remove the file
18. Rm -i 1.txt - prompts a question to delete the file
19. Rmdir dirname - simple delete the directory
20. Rmdir -p dir/dir2/dir3 - will delete non-empty directory
21. Nano file.txt - to open a text editor and save the file.
22. Vim file.txt - command mode - insert mode - i . esc to come out and to save shift+: wq or
q
23. Cp file1 file2
24. Cp file directory1
25. Cp dir1 dir2
26. Cp -b a.txt b.txt
27. Mv file1 file2
28. Mv file dir1
29. Mv -b a.txt b.txt
30. Sudo
31. Sudo apt-get install apache2
32. Sudo apt-get purge apache2
33. History
34. Man - opens up a manual for a command or package
35. Ls –help - –help will open a similar manual just like man
36. Nginx -v - to check version of package installed
37. Ls –version - to check version of command.
38. Find /home/ubuntu -name “*.txt” - searches for file with txt extension in the specified path
39. Echo “hello world”
40. Echo * - to print all the files/folders inside a directory
41. Echo “helloworld”>1.txt - to write into file, if file already having content, it will overwrite
42. Echo “helloworld”>>1.txt - to append the content
43. Echo -e “hello\nworld” - print words in a new line every time
44. Grep “is” 1.txt 2.txt - case sensitive
45. Grep -i “is” 1.txt 2.txt - without case sensitiveness
46. Diff 1.txt 2.txt - does the string matching, compares two files text line by line
47. Alias ec=”echo” - to make alias of commands * to make sure not provide space in
assignment
48. Chmod 400 file.txt - provides only read access to current user, no permission to group
uses, no permission to other users either
49.