Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LINUX BASIC COMMANDS:
- change file/folder permission with chmod command:
- -add execute permission to group:
- sudo chmod g+x test.txt
- -remove read permission to everyone or all:
- sudo chmod a-r test.txt
- -add execute permission to other users:
- sudo chmod o+x test.txt
- -add write permission to user:
- sudo chmod u+w test.txt
- -add execute to other user and add read to group:
- sudo chmod g+r,o+x test.txt
- -set read/write permission for user:
- sudo chmod u=rw test.txt
- -set read/write/execute permission to everyone (rwx rwx rwx --> 421 421 421 --> user group other):
- sudo chmod 777 test.txt
- -set read/write/execute permission to /var/www folder and its subfolder (rwx rwx rwx --> 421 421 421 --> user group other):
- sudo chmod 777 -R /var/www
- -set read/write/execute to user, read to group, read to other (rwx rwx rwx --> 421 421 421 --> user group other):
- sudo chmod 644 test.txt
- -set read/write to user and no permission to group and other (rwx rwx rwx --> 421 421 421 --> user group other):
- sudo chmod 600 test.txt
- -set read/write/execute to user, read/execute to group, read/execute to other (rwx rwx rwx --> 421 421 421 --> user group other):
- sudo chmod 755 test.txt
- change file/folder ownership:
- -change index.html file owner:group to www-data:
- sudo chown www-data:www-data index.html
- -change /var/www folder and subfolder owner:group to www-data:
- sudo chown www-data:www-data -R /var/www
- find or search file/folder:
- sudo find / -name sources.list
- / --> start location
- -name --> name switch
- sources.list --> name of the file/folder to search
- add user:
- sudo useradd username_here
- set user unix password:
- sudo passwd username_here
- delete user including the home folder(-r switch):
- sudo userdel -r username_here
- create group:
- sudo groupadd group_name_here
- add a user to a group:
- sudo usermod -a -G group_1_name_here, group_2_name_here username_here
- to check users group:
- sudo groups username_here
- users/groups system file:
- /etc/group
- /etc/passwd
- to check running program or process:
- -to check if ssh is running:
- sudo ps aux | grep ssh
- -----------------------------------------------------------------------------------
- to add ppa repository:
- Make sure you already have install python-software-properties:
- sudo apt-get install python-software-properties
- Add PPA repository to my Ubuntu:
- sudo add-apt-repository ppa:<repository-name>/<subdirectory>
- to remove ppa repository:
- install ppa-purge:
- sudo apt-get install ppa-purge
- remove PPA repository:
- sudo ppa-purge ppa:<repository-name>/<subdirectory>
- ------------------------------------------------------------------------------------
- Create TAR:
- sudo tar -pcvzf archive_name.tar dirName/
- -p --> permission
- -c --> create
- -v --> verbose
- -z --> compress or uncompress
- -f --> following is the archive filename
- -x --> extract
- Extract TAR:
- sudo tar -pxvzf archive_name.tar
- -------------------------------------------------------------------------------------------------
- Create GZIP:
- (used to compress .tar file and is better then tar compress option. the filename becomes archive_name.tar.gz)
- sudo gzip archive_name.tar
- Extract GZIP:
- sudo gunzip archive_name.tar.gz
- --------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement