less
command on Ubuntu allows to peek inside different kinds of archives from terminal. For example, all of these commands would show me the list of files in each of the four archives:
less archive.zip
less archive.tar.gz
less archive.tar.bz2
less archive.7z
On MacOS, I can use vim
for this. However, this is less convenient, because Vim requires four buttons to be pressed to exit it (:q
+ return) instead of one (q
).
Is there an equivalently fast way to see list of files in archives for MacOS?
Best Answer
Manually
unzip -v FILE.zip
tar tvzf FILE.tar.gz
bunzip2 -c FILE.tar.bz2 | tar tvf -
7z l FILE.7z
PS: For
.7z
you need to runbrew install p7zip
firstExtend
less
to work the same way it does under LinuxInstall
lesspipe
Add the following lines to
.bashrc
(or the profile of whatever shell you use)Source
.bashrc
or open a new terminal tab