What I'm looking for is essentially the pure commandline counterpart to
ark -ba <path> (on KDE), or
file-roller -h <path> (on GNOME/Unity).
Unfortunately, both ark and file-roller require X to be running. I'm aware that it is relatively simple to write a tool that detects archives based on their file extension, and then runs the appropiate program:
#!/bin/bash if [[ -f "$1" ]] ; then case $1 in *.tar.bz2) tar xjvf $1 ;; *.tar.gz) tar xzvf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) rar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xf $1 ;; *.tbz2) tar xjvf $1 ;; *.tgz) tar xzvf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted with this utility" ;; esac else echo "path '$1' does not exist or is not a file" fi
However, that doesn't take care of subdirectory detection (and in fact, many extraction programs do not even supply such an option).
So might there be a program that does exactly that?