There are some real time scenarios where we have to create tar file of specific files and directories for backup purpose on daily basis. Let’s suppose we have to take backup of whole /opt folder on daily basis, this can be achieved by creating a cron job of tar command. Example is sh...
In this example we use the setfacl command to set a basic ACL for user1 on test1.txt, we then create a tar file containing this file with --acls. After removing the original test1.txt file, we extract it and run getfacl and confirm that the ACL we added is still there. [root@c...
The following command creates a tar archive using a directory, adding all files in it and sub directories as well. $ tar -cvf abc.tar ./new/ ./new/ ./new/cde.txt ./new/abc.txt The above example does not create a compressed archive. Just a plain archive, that puts multiple files ...
tar -cvf example.tar example/Copy Alternatively, the command will look similar to our example below if you use the longer way of writing options such as --create, --verbose, and --file=. tar --create --verbose --file=example.tar example/Copy The output from the above examples should...
This command creates an archive named project.tar that contains file1.txt, file2.txt, and dir1 in the current directory. Remember this isnot a compressed file. You can add -v option to list all the files being archived. Then the option would be -cvf. ...
The below example command will create atararchive filetecmint-14-09-12.tarfor a directory/home/tecmintin current working directory. See the example command in action. # tar -cvf tecmint-14-09-12.tar /home/tecmint//home/tecmint/ /home/tecmint/cleanfiles.sh ...
example tar/compress tar -cvf output.tar input_file_or_directory ... /* to create tar archive file */ tar -cvjf output.tar.bz2 input_file_or_directory ... /* to create highly compressed bzip2 file */ tar -cvzf output.tar.gz input_file_or_directory ... /* to create a compressed...
Most Command Used tar Commonads with Example Creating tar archive:Consider we have multiple files system.log under techplayon directory, we can tar them using following command tar -cvf <file_name.tar> <file_directory> tar -cvftechplayon.tartechplayon ...
[root@linux tmp]# tar -cvf - /etc | tar -xvf - # 这个动作有点像是 cp -r /etc /tmp 啦~依旧是有其有用途的! # 要注意的地方在於输出档变成 - 而输入档也变成 - ,又有一个 | 存在~ # 这分别代表 standard output, standard input 与管线命令啦!
1. Creating an archive using tar command Creating an uncompressed tar archive using option cvf This is the basic command to create a tar archive. $ tar cvf archive_name.tar dirname/ In the above command: c– create a new archive