Rename the backup file with just username.tar.gz
Linux fstab File and how it works | Understanding fstab file system
Fstab is file system table your operating system. fstab file location:
/etc/fstab
In a Linux-based system, /etc/fstab file is one of the most important files. It contains all available disks, disk partitions and their options. You can open and see your fstab file system as follows
vi /etc/fstab
Check mount information of partition /dev/sdb1
lsblk -d -fs /dev/sdb1
If you add new hard disk or repartition an existing one, you’ll have to modify this file. And for every partition has been described on a separate line and each line contains six fields which provide information about its mount.
- Device is the first field represents disk or partition name. Most distributions specify partitions by their labels or UUIDs.
/dev/sda1
or
80b496fa-ce2d-4dcf-9afc-bcaa731a67f1
- Mount point is the second field represents directory where the partition or disk will be mounted. And the directory should be an empty directory.
/backup
- File system type the third field represents the file system type.
ext4
- Options is the fourth field represents the mount options. Here, we will use default options. Default mount options sets are:
- rw (read-write);
- suid (respect setuid and setgid bits);
- dev (interpret characters and block devices on the filesystem);
- exec (allow executing binaries and scripts);
- auto (mount the filesystem when the -a option of the mount command is used);
- nouser (make the filesystem not mountable by a standard user);
- async (perform I/O operations on the filesystem asynchronously).
defaults
- Backup operation is the fifth field and can be either 0 or 1. ‘1’, if the dump utility should back up a partition and ‘0’, if it shouldn’t.
1
- File system check order is the sixth field represents fsck checks order for device/partition errors at boot time. ‘0’ means that fsck should not check file system. Higher numbers represent the check order. The root partition have value ‘1’ and all others should have value from 2.
2
Check mount information of partition /dev/sdb1
lsblk -d -fs /dev/sdb1
View Directory Tree Structure In Linux
Install directory tree to see directory structure in linux, if not installed previously.
sudo yum install tree
- Run the tree command without any arguments
tree
- View all directories
tree -L 1 /
here, L indicates maximum depth of displaying directory tree
- List the files of the specific directory
tree /home
- To list hidden files of etc directory
tree -a /etc
- To view list in color format
tree -C /etc
- List only the directories using -d parameter
tree -d /home
Linux File Permissions | chmod command in numeric mode | chown
- View directory permission with ls command.
ls -l dirName
- View file permission with ls command.
ls -l fileName
- Some examples of how to use the chmod command in numeric mode:
chmod 644 fileName
- To recursively operate on all files and directories under the given directory, use the -R option:
chmod -R 755 dirName
- Recursive file own
chown -R vmail:vmail /var/vmail
Create, delete (remove) and rename directories in linux
- Create directory for example ‘newdir’
- Create on current working directory
mkdir newdir
This will create directory in your current location.
- Create directory in specific location. For example, /home
mkdir /home/newdir
- Create directory in root
mkdir ~/newdir
- Create directory into parent directory
mkdir -p /newdir
- Create on current working directory
- Remove (delete) directory for example olddir
- Delete an empty directory
rmdir olddir
- Delete both empty and non-empty directories.
- To delete an empty directory, use the -d option.
rm -d olddir
- To delete a non-empty directory, use the -r option.
rm -r olddir
- To delete an empty directory, use the -d option.
- Remove write-protected directory. Use the -f option
rm -rf olddir
- To remove multiple directories at once
rm -r olddir1 olddir2 olddir3
- If the directory contains lot of files, use -I option which will prompt only once before proceeding with the deletion.
rm -rI olddir
- Remove directories with find command
find
- Delete an empty directory
- Rename directory
mv /olddir /newdir
- Copy Directory copy vmail to home
cp -R /var/vmail /home
- Directory or file permission [Follow this]
- « Previous Page
- 1
- …
- 29
- 30
- 31
- 32
- 33
- …
- 43
- Next Page »