4

I am learning about the basics of Linux and archiving/compressing TAR files i have stumbled across tar -xvf and was wondering what it does. I have checked the man pages and know that x means extract and v means verbose but what does f do?

Samatha
  • 73

3 Answers3

9

As the man page says, -f or --file= defines the ARCHIVE file from which to extract. It's in the chapter 'Device selection and switching' (line #561 in my version).

muclux
  • 5,324
6

-f option in tar means that the next argument is the name of the target tar file. So after the -f option you can't place another option, for example the following syntax is wrong:

tar -xvf --verbose file.tar # Incorrect

The following variants should be correct:

tar -xvf file.tar --verbose 
tar -xv --verbose -f file.tar
pa4080
  • 30,621
6

-xvf is the short (unix style) version of

--extract --verbose --file=

As a new tar user one useful option to learn is -t (--test) in place of -x, which lists to the screen without actually extracting it.

-tvf