Bootstrap FreeKB - Linux Commands - star (create, view, extract an archive)
Linux Commands - star (create, view, extract an archive)

Updated:   |  Linux Commands articles

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

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


September 07 2022 by Celyle
Where is the source depot for this command? Searching for "star" gets me a lot of noob documentation about shell wildcards. I didn't find a "star" package at packages.debian.org. Is there a "non-free" issue with this utility?

Add a Comment


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