I am new to the world of Linux and in the process of setting up a Linux environment. I stumbled across the tar command as I need to view the contents of a file prior to extracting it and by accident ran the command tar tvf as opposed to tar tvfz. Is there any difference in running either command apart from the the fact that the z option is for gzip files?
As you are new to Linux then it seems appropriate to point you at the help system which is the man command.
As to your question it appears that
tar
is smart enough to realise that you have passed it a compressed archive and will process it appropriately even without the z switch.Note that if you use
tvfz
it will fail because a file has to follow thef
switchso you should use
tvzf
There is no difference other than tar tvf will not be able to read a .tar.gz file, only a .tar file.