• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

bsdtar command – Read and write tape archive files

by admin

FreeBSD uses a version of tar written from scratch to replace the older GNU tar, called bsdtar. bsdtar can behave completely consistently with GNU tar, and can also behave in strict accordance with POSIX tar. If you’re at all concerned about the differences between GNU tar, POSIX tar, and bsdtar, read man tar(1) for all the gory details. bsdtar is actually built on libarchive(3), a library that developers use to add support for backup archives into other programs. tar(1) can be dumb. If your filesystem is corrupt in any way, tar will back up what it thinks you asked for. It will then happily restore files that were damaged during the original backup, overwriting working-but-incorrect files with not-working-and-still-incorrect versions. These sorts of problems rarely happen, but tend to be unforgettable when they do.

Syntax:

$ bsdtar [parameter]

Command parameters:

  • -c – Create an archive
  • -f archive-filename – The name of the archive file
  • -t – List the contents of the file
  • -x – Extract the contents of the archive

Examples of bsdtar Command

1. List the file name and content of the archive:

# bsdtar -tf archive-filename

2. Extract the contents of the archive:

# bsdtar -xf archive-filename

3. Create an archive:

# bsdtar -cf archive-filename

4. Using tar, we can create an archive with -c, and we can compress it with gzip and -z. You also need to provide -f to save the resulting archive to a file. Otherwise, the archive will be outputted to Terminal.

# bsdtar -czf archive-filename.tar.gz archive-filename

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to disable BASH shell history
  2. lvresize command examples in Linux
  3. How to Read Audit Log in Linux
  4. gcov Command Examples in Linux
  5. lscpu: command not found
  6. findfs: command not found
  7. btrfs device Command Examples in Linux
  8. “mount.nfs: access denied by server while mounting” – how to resolve
  9. LVM and multipathing – sample LVM filter strings
  10. mke2fs Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright