I have a tar.gz which have pdfs in it I want to open a specific pdf without extracting it Is this possible using terminal through some command (I know we can do it using GUI but I want to use terminal)
To list (not-open) files in archive without extracting, run following command:
To extract and open directly run following command:
For quick process: (extacted in
For extracting specific file,
Hope it is helpful. For advance function scripted command is useful by running script for specific purpose.
To do this in a single command line, you need a pdf viewer which can handle input from a pipe. The only viewer with this option I know is ImageMagicks's display. It is not very comfortable (larger files may take a while), but may be it is convenient for your purpose.
(Larger pdf files may take a while.)
Opening without extracting is not possible. GUI applications are extracting the files temporarily before opening them...
If you have one tar.gz file containing PDF files, and you wish to extract one or more files using command line, you can use:
You can also extract one file from a folder in the archive (the directory structure will be kept):
If you don't wish to keep the directory structure, you can use --strip-components followed by the level of the subfolder:
Please note that your archive file name must also be double-quoted if it contains spaces.
In the examples above, I'm supposing that you are in the folder containing the archive file and that you wish to extract there.
Before using tar command, you should use "cd" command to go to the folder in which you wish to extract the files. If the archive is located in another folder, simply put its absolute full path ["/home/myusername/Desktop/My Folder/My Other Archive.tar.gz"] (using a relative path may also be useful in some cases).
P.S.: If it was a simple text file (txt), "-O" parameter at the end of the command might have been what you were searching for, but since it is a PDF one, it is not very useful... According to TAq answer, "display" from ImageMagick is able to handle that PDF output the way you wish with a pipe.