Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. # Linux Basic Commands #
  2.  
  3. - Update Linux built-in package
  4. - ``` sudo apt-get update ```
  5. - Install software
  6. - ``` sudo apt install package_name ```
  7. - Uninstall software
  8. - ``` sudo apt-get purge package_name ```
  9. - List of file & folder
  10. - ``` ls ``` or ``` ls -l ```
  11. - Change directory to root
  12. - ``` cd / ```
  13. - Change directory to previous folder
  14. - ``` cd .. ``` or ``` cd - ```
  15. - Change to super user (root)
  16. - ``` sudo su ```
  17. - Change to another user
  18. - ``` su user_name```
  19. - To check present working directory
  20. - ``` pwd ```
  21. - Create file single or multiple
  22. - ``` touch a.txt b.txt ``` ( It will create two file "a.txt" & "b.txt" in present working directory )
  23. - Create a new copy of "a.txt" as "a_backup.txt"
  24. - ``` cp a.txt a_backup.txt ``` ( We can also decleare directory with file name. Such as /home/a_backup.txt )
  25. - Create a new copy of "a" folder
  26. - ``` cp a -r a_backup ``` ( -r Recursively create copy of folder and it's file )
  27. - Delete "a.txt" file
  28. - ``` rm a.txt ```
  29. - Delete "a" folder
  30. - ``` rm -r a ``` ( -r Recursively delete folder and it's file )
  31. - ``` rm -rf a ``` ( f Forcefully delete folder )
  32. - Restore or move a file from another directory to current working directory
  33. - ``` mv /home/a_backup.txt a.txt ```
  34. - History check
  35. - ``` history ```
  36. - Storage memory check
  37. - ``` df -hT ```
  38. - Free ram check
  39. - ``` free -mh ```
  40. - Create new user for computer login
  41. - ``` adduser new_name ```
  42. - Check user list ( Need to be in root directory )
  43. - ``` cat /etc/passwd ```
  44. - Change password for given username ( If username will not given, it will change current username password )
  45. - ``` sudo passwd username ```
  46. - It will show the detail of a command
  47. - ``` man command_name ``` Example: ``` man cat ```
  48. - Delete user and it's file.
  49. - ``` sudo userdel -r username ``` ( -r Recursively used for deleting it's file )
  50. - Zipping a file
  51. - ``` zip to_desired_name.zip from_source_file_name ```
  52. - Unzip file
  53. - ``` unzip zip_filename```
  54. - Edit "a.txt" file from command line
  55. - ``` vim a.txt ```
  56. - Press I for insert or edit
  57. - Press ``` shift + : ```
  58. - Then type "wq" & press enter ( w = write & q = quit ) Changes will be saved
  59. - Then type "q!" ( Forcefully quit ) Changes will not be saved
  60. - To see currently running task
  61. - ``` top ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement