tar Examples

The tar utility is a very useful tool to package several files or an entire directory tree into a single file. You can then email the tar file to someone else.

# display contents of a tar file

tar tvf myfile.tar

# copy files to a tar file

tar cvf myfile.tar *.sql  # Copies all *.sql files in the current directory into myfile.tar

# copy an entire directory tree to a tar file

tar cvf mydir.tar ./mydir

# extract files from a tar file to current dir

tar xvf myfile.tar

Engineering Network Services home page link College of Engineering home page link