You are on page 1of 1

LINUX BASIC COMMANDS

Ser Purpose Command Line


1. Create a directory/folder mkdir DirectoryName (multiple: dir1 dir2)
2. Go to a directory cd DirectoryName
3. Present working directory pwd
4. Remove EMPTY dir rmdir DirectoryName
5. Back to home directory cd
6. One step back cd..
7. Create a new file touch FileName (file format optional- .txt, .doc, etc)
8. Copy file cp resource Directory/Filename (spc) destination Directory
9. Remove file rm FileName or FileName with path
10. View file content cat FileName (with extension)
11. First 10 lines of a file head FileName
12. Last 10 lines of a file tail FileName
13. Fast 20 lines of a file cat File1.txt | grep 20
14. Merge files cat File1.txt file.txt2 > MergedFileName.txt
15. View directory list dir or ls or ls -l
16. Copy directory with files cp NewDir -r target Dir
17. Move directory or file mv target File/Directory (space) destination Directory
18. View user list cat or who or users
19. User add sudo useradd NewUserName
20. Delete user sudo userdel UserName
21. Root access (#) sudo su
22. Back to normal user ($) exit
23. Host name hostname
24. Users currently logged in w
25. Password change sudo passwd UserName (current passwd and new passwd)
26. Download from internet wget link
27. View linux version uname or uname -a
28. Install software sudo apt install [packagename]
29. Uninstall software sudo apt remove [packagename]
30. Clear all clear
31. Back to # or $ to write Ctrl+C
32. View IP address ip addr
33. Ping ping youtube.com or ip
34. History history
35. Get the list of processes ps
36. Zip file gzip file1.txt
37. Unzip file gunzip file1.txt
38. Today’s date date
39. Reboot reboot
40. Shutdown PC init 0

You might also like