Unpack RAR, ZIP and 7z Archives on Your Service via SSH
Some downloads arrive packed in archives, often split into many parts. Unpack them right on your App Hosting service, instead of downloading the archives and unpacking them at home. The tools unrar, 7z, unzip and tar are installed on our App Hosting services. The steps were tested on our demo service with real multi-part RAR archives.
Connect over SSH first: SSH how to get connected.
1. Go to the Folder
cd ~/downloads/"Name of the folder" ls
Put names with spaces in quotes. Press Tab after the first letters of a name to complete it.
2. RAR Archives
A RAR in several parts is named …part01.rar, …part02.rar and so on, or ….rar, ….r00, ….r01. Always start with the first part; unrar finds the others in the same folder.
See what is inside, and test the archive without unpacking:
unrar l name.part01.rar unrar t name.part01.rar
All OK at the end of the test means that all parts are complete. Unpack into the current folder, keeping the folders of the archive:
unrar x name.part01.rar
Or into another folder (it is created if needed), replacing files that already exist:
unrar x -o+ name.part01.rar ~/downloads/unpacked/
In our test, a RAR in four parts was unpacked from the first part, all files OK. If a part is missing or damaged, unrar says so; download the torrent again or recheck it in your torrent client.
3. ZIP, 7z and Other Formats
unzip name.zip # ZIP into the current folder unzip name.zip -d ~/downloads/x # ZIP into a folder 7z x name.7z # 7z, also ZIP and RAR 7z x name.7z -o"$HOME/downloads/x" # into a folder, no space after -o tar xf name.tar.gz # tar, tar.gz, tar.xz
7z can also open ZIP and RAR archives. Use it when another tool refuses a file.
4. Large Archives
- Unpacking needs free space for the archive and the unpacked files: See How Much Space You Use on Your Service.
- A large archive takes a while. Start the command in
tmux, so that it continues if your SSH window closes: typetmux, run the command, and latertmux attachto look again. More in tmux: Keep a Command Running After You Close SSH. - Delete the archives after unpacking only when you no longer seed the torrent: the torrent client needs the archive files, not the unpacked ones.
Sonarr and Radarr can have archives unpacked automatically: on Dedicated services, use Unpackerr.