Create, view, and extract an archive using the STAR command in Linux

Home > Search > Linux commands
  by

The star command can be used to create or extract an archive. Star is typically used to archive files in a system using SELinux.

 


Install star

Use apt-get or yum to install star.

[john.doe@server1 ~]# yum install star

 


Create an archive

The -c (create) and -f (file) optiions can be used to create a star archive. In this example, the contents of the /etc directory are stored in an archive named example.star. The star command is recursive, meaning that all files and folders below the parent folder will be included in the archive.

[john.doe@server1 ~]# star -c -f=/home/john.doe/example.star /etc

 

The -xattr and -H=exustar options are fairly common when creating a star archive. Exustar records Access Control Lists (ACLs), and xattr compares extended file attributes.

[john.doe@server1 ~]# star -xattr -H=exustar -c -f=/home/john.doe/example.star /etc

 


View the contents of an archive

Tbhe -t (table of contents) option can be used to view the contents of an archive. In this example, the example.star archive contains the contents of the /etc directory.

[john.doe@server1 ~]# star -t -f=/home/john.doe/example.star
abrt
adjtime
akonadi
aliases
aliases.db
. . .

 


Extract the contents of an archive

The -x (extract) option can be used to extract the contents of an archive. In this example, the contents of example. star are extracted to the present working directory

[john.doe@server1 ~]# star -x -f=/home/john.doe/example.star

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments