Advertisement
shokti

ubuntu - linux basic commands

Oct 24th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. LINUX BASIC COMMANDS:
  2.  
  3. change file/folder permission with chmod command:
  4. -add execute permission to group:
  5. sudo chmod g+x test.txt
  6. -remove read permission to everyone or all:
  7. sudo chmod a-r test.txt
  8. -add execute permission to other users:
  9. sudo chmod o+x test.txt
  10. -add write permission to user:
  11. sudo chmod u+w test.txt
  12. -add execute to other user and add read to group:
  13. sudo chmod g+r,o+x test.txt
  14. -set read/write permission for user:
  15. sudo chmod u=rw test.txt
  16. -set read/write/execute permission to everyone (rwx rwx rwx --> 421 421 421 --> user group other):
  17. sudo chmod 777 test.txt
  18. -set read/write/execute permission to /var/www folder and its subfolder (rwx rwx rwx --> 421 421 421 --> user group other):
  19. sudo chmod 777 -R /var/www
  20. -set read/write/execute to user, read to group, read to other (rwx rwx rwx --> 421 421 421 --> user group other):
  21. sudo chmod 644 test.txt
  22. -set read/write to user and no permission to group and other (rwx rwx rwx --> 421 421 421 --> user group other):
  23. sudo chmod 600 test.txt
  24. -set read/write/execute to user, read/execute to group, read/execute to other (rwx rwx rwx --> 421 421 421 --> user group other):
  25. sudo chmod 755 test.txt
  26.  
  27.  
  28. change file/folder ownership:
  29. -change index.html file owner:group to www-data:
  30. sudo chown www-data:www-data index.html
  31. -change /var/www folder and subfolder owner:group to www-data:
  32. sudo chown www-data:www-data -R /var/www
  33.  
  34.  
  35. find or search file/folder:
  36. sudo find / -name sources.list
  37.  
  38. / --> start location
  39. -name --> name switch
  40. sources.list --> name of the file/folder to search
  41.  
  42. add user:
  43. sudo useradd username_here
  44.  
  45. set user unix password:
  46. sudo passwd username_here
  47.  
  48. delete user including the home folder(-r switch):
  49. sudo userdel -r username_here
  50.  
  51. create group:
  52. sudo groupadd group_name_here
  53.  
  54. add a user to a group:
  55. sudo usermod -a -G group_1_name_here, group_2_name_here username_here
  56.  
  57. to check users group:
  58. sudo groups username_here
  59.  
  60. users/groups system file:
  61. /etc/group
  62. /etc/passwd
  63.  
  64. to check running program or process:
  65. -to check if ssh is running:
  66. sudo ps aux | grep ssh
  67.  
  68. -----------------------------------------------------------------------------------
  69.  
  70. to add ppa repository:
  71.  
  72. Make sure you already have install python-software-properties:
  73. sudo apt-get install python-software-properties
  74.  
  75. Add PPA repository to my Ubuntu:
  76. sudo add-apt-repository ppa:<repository-name>/<subdirectory>
  77.  
  78. to remove ppa repository:
  79.  
  80. install ppa-purge:
  81. sudo apt-get install ppa-purge
  82.  
  83. remove PPA repository:
  84. sudo ppa-purge ppa:<repository-name>/<subdirectory>
  85.  
  86. ------------------------------------------------------------------------------------
  87.  
  88. Create TAR:
  89. sudo tar -pcvzf archive_name.tar dirName/
  90.  
  91. -p --> permission
  92. -c --> create
  93. -v --> verbose
  94. -z --> compress or uncompress
  95. -f --> following is the archive filename
  96. -x --> extract
  97.  
  98. Extract TAR:
  99. sudo tar -pxvzf archive_name.tar
  100.  
  101. -------------------------------------------------------------------------------------------------
  102.  
  103. Create GZIP:
  104. (used to compress .tar file and is better then tar compress option. the filename becomes archive_name.tar.gz)
  105.  
  106. sudo gzip archive_name.tar
  107.  
  108. Extract GZIP:
  109. sudo gunzip archive_name.tar.gz
  110.  
  111. --------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement