- Permission and ownership
- r is for read permission = 4
- w is for write permission = 2
- x is for execute permission = 1
chown
- u is for user
- g is for group
- and o is for others
Ex:
chmod -R 755 directory-name
chmod u+x filename
chmod Examples
Give read, write and execute to everybody (user, group, and others)
read, write and execute = 4 + 2 + 1 = 7.
- Files & Foders Delete and Transfer
ex: rm file-name.tar.gz
scp
our-manchine <-- server
scp root@server-name:/root/dbbackup/latest001.tar.gz /home/user-name/Desktop/
our-manchine --> server
scp /home/user-name/Desktop/latest001.tar.gz root@server-name:/root/dbbackup/
- Database
ex: mysqldump -u dbuser -p dbname > dbname.sql
- Zip and Extract
Create archive folder1 and foder2 into one zip
tar -czPf folder-name.tar.gz folder1 folder2
Extract folder-name.tar.gz
tar -xvf folder-name.tar.gz
- Grep content
$ grep 'word' filename.txt
grep;
ex: grep 'word' filename.txt
- File View
head
ex: head -n 15 |tail -n 5 file.txt
tail
more
less
- Find File and Folder
find
locate
- Check File Folder Size
ex: du -h filename.tar.gz