Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

3 votes
1 answers
359 views
Extract a RAR file while automatically truncating long filenames
I have a lot of rar archives, and some of them contain files whose names are too long for the filesystem. When attempting to extract them using `unrar x`, I will get the error: Cannot create [extremely long filename].ext File name too long Using any archive utility currently available for Linux, is...
I have a lot of rar archives, and some of them contain files whose names are too long for the filesystem. When attempting to extract them using unrar x, I will get the error: Cannot create [extremely long filename].ext File name too long Using any archive utility currently available for Linux, is there one which can automatically shorten the extracted filename while preserving the extension? If an archive can be automatically edited pre-extraction to rectify this issue, that will suffice as well.
rer (31 rep)
Nov 23, 2024, 07:28 AM • Last activity: Nov 24, 2024, 05:41 AM
0 votes
0 answers
35 views
Trying to unrar specific files within a specific directory
I have a bash script that extracts files from a .rar file. I want to extract only `*.foo` and `mydirectory/*.bar`. I followed https://unix.stackexchange.com/questions/292754/unrar-specific-files-using-wildcards to get at the first group of files, but that doesn't work for second. I tried using `unra...
I have a bash script that extracts files from a .rar file. I want to extract only *.foo and mydirectory/*.bar. I followed https://unix.stackexchange.com/questions/292754/unrar-specific-files-using-wildcards to get at the first group of files, but that doesn't work for second. I tried using unrar -x blah.rar mydirectory/\*.bar (and just *), which got me nothing and unrar -x blah.rar mydirectory which just got me an empty directory named mydirectory/. Omitting the trailing slash got me nothing.
Frotz (121 rep)
Nov 21, 2024, 07:50 PM
8 votes
3 answers
45033 views
How can I extract a RAR file on Debian?
I've got a 20GB RAR file to extract with a password on Debian Linux Google Cloud VM. I first tried `sudo apt-get install unrar` but the following output was given: ``` Reading package lists... Done Building dependency tree Reading state information... Done Package unrar is not available, but is refe...
I've got a 20GB RAR file to extract with a password on Debian Linux Google Cloud VM. I first tried sudo apt-get install unrar but the following output was given:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package unrar is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'unrar' has no installation candidate
I found that this is likely to be because I don't have the multiverse activated, so I tried sudo add-apt-repository multiverse. This didn't work:
Error: 'multiverse' invalid
I eventually found a post saying that 'unrar free' could be installed. I installed it, and ran unrar-free -x -p Filename.rar. It is currently going through each file in the archive and giving the following output:
Extracting  Folder_name/image/0/1.jpg                                  Failed    
Extracting  Folder_name/image/0/10.jpg                                 Failed    
Extracting  Folder_name/image/0/100.jpg                                Failed    
Extracting  Folder_name/image/0/1000.bmp                               Failed
Apparently unrar-free is unable to extract archives in the RAR 3.0 format. I don't know how to tell which version of RAR this archive was compressed in. **How can I extract this RAR file?** I don't mind paying some money if it means faster extraction - I've got 140GB of RAR files to get through.
magmacollaris (93 rep)
Apr 10, 2021, 09:08 PM • Last activity: Aug 2, 2024, 05:31 AM
16 votes
7 answers
13421 views
Find recursively all archive files of diverse archive formats and search them for file name patterns
At best I would like to have a call like this: $searchtool /path/to/search/ -contained-file-name "*vacation*jpg" ... so that this tool + does a recursive scan of the given path + takes all files with supported archive formats which should at least be the "most common" like zip, rar, 7z, tar.bz, tar....
At best I would like to have a call like this: $searchtool /path/to/search/ -contained-file-name "*vacation*jpg" ... so that this tool + does a recursive scan of the given path + takes all files with supported archive formats which should at least be the "most common" like zip, rar, 7z, tar.bz, tar.gz ... + and scan the file list of the archive for the name pattern in question (here *vacation*jpg) I'm aware of how to use the find tool, tar, unzip and alike. I could combine these with a shell script but I'm looking for a simple solution that might be a shell one-liner or a dedicated tool (hints to GUI tools are welcome but my solution must be command line based).
mdo (271 rep)
Jul 5, 2012, 02:37 PM • Last activity: Jun 6, 2024, 07:11 PM
0 votes
1 answers
8026 views
Extract Rar File on CentOS 7?
`unrar` used to be available on EPEL repository. But now, it is gone. I noticed that CERT Forensics Tools [has it](https://centos.pkgs.org/7/forensics-x86_64/unrar-5.4.0-1.el7.x86_64.rpm.html) now, then I installed it, `unrar e [my file]` works but using Archive Manager (GUI) doesn't work with rar f...
unrar used to be available on EPEL repository. But now, it is gone. I noticed that CERT Forensics Tools [has it](https://centos.pkgs.org/7/forensics-x86_64/unrar-5.4.0-1.el7.x86_64.rpm.html) now, then I installed it, unrar e [my file] works but using Archive Manager (GUI) doesn't work with rar files. I also tried unar as [this article](https://www.thegeekdiary.com/how-to-extract-rar-files-in-centos-rhel-7-and-8/) suggested. Same issue. Any clue how to get it work with Archive Manager? Thanks!
HCSF (223 rep)
Feb 14, 2022, 08:27 AM • Last activity: May 9, 2024, 03:03 PM
175 votes
11 answers
589359 views
How to open rar file in linux?
I have a file with `.rar` extension, ex: `foo.rar` I want to extract content from that file, how do I extract it?
I have a file with .rar extension, ex: foo.rar I want to extract content from that file, how do I extract it?
shas (2788 rep)
Dec 1, 2015, 06:01 AM • Last activity: Mar 26, 2024, 09:23 AM
10 votes
1 answers
2162 views
What free tool does Nautilus use to extract RAR files?
I have noticed that Nautilus (GNOME Files) can extract some RAR files that cannot be extracted using free packages like unrar-free or file-roller via CLI, nor using GUI tools like Engrampa or Xarchiver. Don’t know why exactly. No passwords involved or anything unusual, just (what seems like) regular...
I have noticed that Nautilus (GNOME Files) can extract some RAR files that cannot be extracted using free packages like unrar-free or file-roller via CLI, nor using GUI tools like Engrampa or Xarchiver. Don’t know why exactly. No passwords involved or anything unusual, just (what seems like) regular RAR files. Maybe different formats? Anyway, I’d like to know what (if any) standalone tool does Nautilus use for extracting RAR files so I could do it myself on the command line. I only use Debian free repositories, so I guess it should be a free package... This is my first question, let me know if I should improve anything. Thanks!!
tagomago (103 rep)
Jan 2, 2024, 06:12 PM • Last activity: Jan 2, 2024, 06:22 PM
5 votes
2 answers
3593 views
How to convert from rar or tgz to squashfs without having to extract to temporary folder?
I enjoy using squashfs for compression because of the simplicity of mounting them as loop devices to access the files inside. I have a lot of rar, tgz and zip files that I would like to convert to squashfs. In [this answer][1], I saw that it is possible to use a pseudo file when compressing a disk i...
I enjoy using squashfs for compression because of the simplicity of mounting them as loop devices to access the files inside. I have a lot of rar, tgz and zip files that I would like to convert to squashfs. In this answer , I saw that it is possible to use a pseudo file when compressing a disk image to squashfs to avoid having to use a temporary file the size of the whole disk. mkdir empty-dir mksquashfs empty-dir squash.img -p 'sda_backup.img f 444 root root dd if=/dev/sda bs=4M' I would like to use pseudo files to convert from rar, tgz or zip to squashfs in the same way (on the fly), so I don't have to first extract the whole archive to disk and then compress to squashfs in a separate operation. Some of these archives contain thousands of individual files, some of which will have spaces or other special characters in their filenames. I looked at the README , and I think I would need to use the -pf option, but I'm not sure how to create the pseudo file on the fly (and also not have problems with filenames with spaces). I think I would need to use process substitution to create the list of files from the source archive. Ideally I would like to have a command that is able to convert any rar, tgz or zip without having to individually create the pseudo file for each archive, but if anyone can tell me how I can do it with one of those archive formats, then hopefully I can work it out for the others. Thanks everyone.
localhost (327 rep)
Jun 15, 2020, 12:56 AM • Last activity: Dec 27, 2023, 06:22 PM
-2 votes
2 answers
6141 views
How to install rar in Kali Linux
I am trying to install rar in Kali Linux to create a rar archive file. I have followed articles that says to use this command: `sudo apt install rar`. However, it returns with: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done Package rar is not ava...
I am trying to install rar in Kali Linux to create a rar archive file. I have followed articles that says to use this command: sudo apt install rar. However, it returns with:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package rar is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'rar' has no installation candidate
I also try to search rar with aptitude search rar | grep rar, but I can't find rar. I have also updated Kali Linux with sudo apt update EDIT: rar can now be installed on Kali Linux. See https://packages.debian.org/sid/rar .
horsey_guy (421 rep)
Aug 13, 2022, 04:23 PM • Last activity: Dec 9, 2023, 05:10 PM
19 votes
5 answers
8745 views
Is it possible to add error correction codes (BCH, RS or etc.) to a single file?
As far as I know, WinRAR archives may contain ECC (error correction codes), so if the archive is slightly damaged, then it can be fixed by itself. For example, I can first encode `archives.tar` to `archives.tar.ecc`, and then upload it to my server. If the file is slightly damaged after downloading...
As far as I know, WinRAR archives may contain ECC (error correction codes), so if the archive is slightly damaged, then it can be fixed by itself. For example, I can first encode archives.tar to archives.tar.ecc, and then upload it to my server. If the file is slightly damaged after downloading by the client, then it can be fixed automatically without downloading the file again by decoding archives.tar.ecc. I think it will be a great idea if the network connection is unstable. I wonder whether there is any (open-sourced) software run on Linux that can meet my needs. Any suggestions?
Kevin Dong (1179 rep)
Nov 30, 2014, 08:08 AM • Last activity: Mar 29, 2023, 04:54 PM
0 votes
1 answers
259 views
Zsh script to recursively unrar into a folder with the same name
Is it possible to use a zsh script to unrar all directories within another directory? As follows: dir |_dir1.rar |_dir2.rar |_dir3.rar I would like the command not to include the cd. I will cd into the folder before executing the zsh script. The script should extract all .rar directories into the sa...
Is it possible to use a zsh script to unrar all directories within another directory? As follows: dir |_dir1.rar |_dir2.rar |_dir3.rar I would like the command not to include the cd. I will cd into the folder before executing the zsh script. The script should extract all .rar directories into the same folder with the same original directory name. For example dir1.rar should extract to dir1 and so on. Hope this can be done.
linuxuser24569 (13 rep)
Mar 24, 2023, 01:05 AM • Last activity: Mar 24, 2023, 01:08 AM
0 votes
1 answers
2796 views
Unrar all .rar files in a directory to a folder with the same name
Here is an example of what I am trying to do: I have a folder (called 'dir') that contains the following: dir |_sub1.rar |_sub2.rar |_sub3.rar I will cd ~/ to dir and want to run a command that will extract all .rar files and place the contents into a folder with the same name. sub1.rar should be ex...
Here is an example of what I am trying to do: I have a folder (called 'dir') that contains the following: dir |_sub1.rar |_sub2.rar |_sub3.rar I will cd ~/ to dir and want to run a command that will extract all .rar files and place the contents into a folder with the same name. sub1.rar should be extracted to sub1, sub2.rar should be extracted to sub2, and so on.
linuxuser24569 (13 rep)
Mar 22, 2023, 04:35 AM • Last activity: Mar 22, 2023, 11:40 AM
1 votes
0 answers
117 views
Fedora: unrar creates huge binary files after extracting rar5 files
I'm running Fedora 35 and I'd need to extract a rar archive which contains log files (text). When using **unrar**, as a result a huge list of binary files are created: -rw-rw-r--. 1 francesco francesco 94568930677013 Sep 10 09:36 log10.log -rw-rw-r--. 1 francesco francesco 94568938371590 Sep 10 09:3...
I'm running Fedora 35 and I'd need to extract a rar archive which contains log files (text). When using **unrar**, as a result a huge list of binary files are created: -rw-rw-r--. 1 francesco francesco 94568930677013 Sep 10 09:36 log10.log -rw-rw-r--. 1 francesco francesco 94568938371590 Sep 10 09:36 log11.log -rw-rw-r--. 1 francesco francesco 94568940015859 Sep 10 09:36 log12.log -rw-rw-r--. 1 francesco francesco 94568937104517 Sep 10 09:36 log13.log . . . . . . Much the same result, when extracting from the Desktop (Cinnamon). This problem only happens on this OS (Fedora 35). When using a Windows machine I'm able to extract it. An user of this forum mentioned as workaround to use xextractor. However, I cannot see it available in Fedora default repos. Do you have any advice for that? Edit: I've tried using a Java program to unrar files and I get the following error which might be the explanation: exception.UnsupportedRarV5Exception I've updated the question accordingly
Carla (213 rep)
Sep 10, 2022, 07:48 AM • Last activity: Sep 10, 2022, 08:15 AM
0 votes
1 answers
202 views
unrar multiple files wity multiple files
I have 1000s of rar files and list of password in txt. i want to unrar all those files trying all passwords. Tried: ``` for file in "$(ls *.rar)"; do for f in "$(cat pass.txt)"; do unrar x -p"${f} "${file}; done; done ``` But not working. Tried it with unrar 7za but still fails
I have 1000s of rar files and list of password in txt. i want to unrar all those files trying all passwords. Tried:
for file in "$(ls *.rar)"; do for f in "$(cat pass.txt)"; do unrar x -p"${f} "${file}; done; done
But not working. Tried it with unrar 7za but still fails
Haru Suzuki (85 rep)
Mar 3, 2022, 11:26 PM • Last activity: Mar 4, 2022, 12:12 AM
7 votes
3 answers
6188 views
Unrar to folder with same name as archive
I have a lot of rar files - Folder/ --- Spain.rar --- Germany.rar --- Italy.rar All the files contains no root folder so it's just files. What I want to achieve when extracting is this structure: - Folder/ -- Spain/ ---- Spain_file1.txt ---- Spain_file2.txt -- Germany/ ---- Germany_file1.txt ---- Ge...
I have a lot of rar files - Folder/ --- Spain.rar --- Germany.rar --- Italy.rar All the files contains no root folder so it's just files. What I want to achieve when extracting is this structure: - Folder/ -- Spain/ ---- Spain_file1.txt ---- Spain_file2.txt -- Germany/ ---- Germany_file1.txt ---- Germany_file2.txt -- Italy/ ---- Italy_file1.txt ---- Italy_file2.txt So that a folder with the name of the archive is created and the archive is extracted to it. I found this bash example in another thread but it's not working for me, it's trying to create one folder with all the files as name. #!/bin/bash for archive in "$(find . -name '*.rar')"; do destination="${archive%.rar}" if [ ! -d "$destination" ] ; then mkdir "$destination"; fi unrar e "$archive" "$destination" done Any ideas how I can do this?
Dennis Wiencken (81 rep)
Oct 19, 2018, 10:52 AM • Last activity: Dec 12, 2021, 10:08 PM
1 votes
1 answers
548 views
Unrar specific .rar file from multipart list without automatically iterating through the list
I was wondering, since executing `unrar -x file.part01.rar 123.zip destinationPath` would automatically iterate through the list until the file `123.zip` is found, is there a way to stop that auto search for multivolume archives? For example, I have a set of 100parts of a multipart volume, it would...
I was wondering, since executing unrar -x file.part01.rar 123.zip destinationPath would automatically iterate through the list until the file 123.zip is found, is there a way to stop that auto search for multivolume archives? For example, I have a set of 100parts of a multipart volume, it would take some time to find the file if the file were to be located at part51. Instead, I would like to generate two processes that starts at part1 and the other starts at part50. If I were to execute unrar -x file.part50.rar 123.zip destinationPath, it skips part50 and starts over to the top. Second option, if possible, is there a way I can just execute unrar -x file.part50.rar 123.zip destinationPath and if file is not found exit/stop process and start a new command execution unrar -x file.part51.rar 123.zip destinationPath. Any suggestions or advice would be very much appreciated. Thank you.
Simply101Proxy (11 rep)
Oct 4, 2021, 05:37 PM • Last activity: Oct 4, 2021, 10:17 PM
0 votes
0 answers
625 views
Why unar extract old rar file?
There are 2 rar files in my scenario, their names are `1.rar` and `2.rar`. My purpose: `1.rar` extract to `folder1` and `2.rar` extract to `folder2`. First, I extract the `1.rar` file to `folder1` folder with `unar` (`unar -o folder1 x/1.rar`). Everything is good but if I extract the `2.rar` file to...
There are 2 rar files in my scenario, their names are 1.rar and 2.rar. My purpose: 1.rar extract to folder1 and 2.rar extract to folder2. First, I extract the 1.rar file to folder1 folder with unar (unar -o folder1 x/1.rar). Everything is good but if I extract the 2.rar file to folder2 (unar -o folder2 x/2.rar) then unpacking 1.rar's data into folder2. Why does it process previous rar file? OS: Centos 7. Scenario codes: [root@vm-app home]# unar -o folder1 x/1.rar x/1.rar: RAR 5 1/1 - Copy.txt (0 B)... OK. 1/1.txt (0 B)... OK. 1/ (dir)... OK. Successfully extracted to "folder1/1". [root@vm-app home]# unar -o folder2 x/2.rar x/2.rar: RAR 5 1/1 - Copy.txt (0 B)... OK. 1/1.txt (0 B)... OK. 1/ (dir)... OK. Successfully extracted to "folder2/1". [root@vm-app home]# ls folder1 1 [root@vm-app home]# ls folder2 1 [root@vm-app home]# rm -rf folder1 && rm -rf folder2 [root@vm-app home]# unar -o folder2 x/2.rar x/2.rar: RAR 5 1/1 - Copy.txt (0 B)... OK. 1/1.txt (0 B)... OK. 1/ (dir)... OK. Successfully extracted to "folder2/1". [root@vm-app home]# rm -rf folder2 [root@vm-app home]# rm x/1.rar rm: remove regular file ‘x/1.rar’? y [root@vm-app home]# unar -o folder2 x/2.rar x/2.rar: RAR 5 2/2 - Copy.txt (0 B)... OK. 2/2.txt (0 B)... OK. 2/ (dir)... OK. Successfully extracted to "folder2/2". [root@vm-app home]# ls folder2 2 [root@vm-app home]#
kursat sonmez (101 rep)
Mar 10, 2021, 07:58 AM • Last activity: Mar 10, 2021, 06:04 PM
0 votes
4 answers
3160 views
unrar'ing everything in subdirectories without getting into a loop
So I've been trying to unrar multiple `.rar` files in lots of different folders. Some are packed a little differently and looping is causing a problem. - folder 1 - file.part01.rar - file.part02.rar - ... - folder 2 - file.r01 - file.r02 - file.rar - folder 3 - file1.rar - file2.rar - ... after doin...
So I've been trying to unrar multiple .rar files in lots of different folders. Some are packed a little differently and looping is causing a problem. - folder 1 - file.part01.rar - file.part02.rar - ... - folder 2 - file.r01 - file.r02 - file.rar - folder 3 - file1.rar - file2.rar - ... after doing for f in *.rar; do unrar e $f;done or something similar, it gets into a loop and keeps unrar'ing files it's already done. This is because part01.rar & part02.rar both are rar files and satisfies the command. Is there anything I could do to stop this loop? I have over 50 folders so don't want to go through all of them individually.
csc (1 rep)
Nov 6, 2018, 03:59 PM • Last activity: Feb 24, 2021, 03:19 AM
12 votes
1 answers
39404 views
How to use p7zip to open RAR files?
This is a more specific question of [How to open rar file in linux (asked in 2015)][main] that had no detailed answer for p7zip to open RAR files at this time of writing. p7zip is essentially the 7-zip archive manager on Linux, except that does not include the graphical interface. p7zip should be ab...
This is a more specific question of How to open rar file in linux (asked in 2015) that had no detailed answer for p7zip to open RAR files at this time of writing. p7zip is essentially the 7-zip archive manager on Linux, except that does not include the graphical interface. p7zip should be able to open RAR files like 7-zip does, but some recently downloaded RAR files can not be opened using p7zip. The RAR file itself is not broken for sure. This question may cover the following sub-questions (without the question marks, as not to be confused with the main question), which are relevant to explain the how-to: * Does p7zip really support RAR format * Which package to install for p7zip to support RAR format, and which repository would provide the package * Which binary of 7z, 7za, or 7zr can open the RAR file * Can p7zip be used to open the RAR file via graphical interface * When using p7zip to open the RAR file, the command failed with message "Error: Can not open file as archive", then how to solve So how to use p7zip to open RAR files? > This is a **self-answer** question that has been written like a new question, which was created based on the discussion in this meta post . Should there be more than one answer, the most accurate and most complete answer will be accepted after some time (not immediately).
user125388
Jun 5, 2019, 03:11 AM • Last activity: Dec 12, 2020, 07:58 AM
0 votes
0 answers
4878 views
Error extracting a RAR archive: "is not RAR archive.No files to extract"
I have multiple huge RAR files that are separated into 6 parts.Some parts are completely downloaded,some not just yet.When I try to extract the fully downloaded archives,I get this: ``` $ unrar e whatever.rar ... whatever.rar is not RAR archive No files to extract ``` BTW `x` and even `t` switches d...
I have multiple huge RAR files that are separated into 6 parts.Some parts are completely downloaded,some not just yet.When I try to extract the fully downloaded archives,I get this:
$ unrar e whatever.rar
...
whatever.rar is not RAR archive
No files to extract
BTW x and even t switches don't work for me.The interesting fact is that the l switch can successfully list the contents:
$ unrar l whatever.rar

Archive: whatever.rar
Details: RAR 4, volume, recovery record, lock

 Attributes      Size     Date    Time   Name
----------- ---------  ---------- -----  ----
*   ..A.... 2097555771  2015-02-23 11:07  whatever/1
*   ..A.... 2097957006  2015-02-23 11:09  whatever/2
*   ..A.... 2097895618  2015-02-23 11:09  whatever/3
----------- ---------  ---------- -----  ----
           4195852624  volume 3          2
I've tried that using **Ark**.It says:
Loading the archive ‘whatever.rar’ failed with the following error:
Failed to find all archive volumes
Can it be because of the fact that not of all the archives(i.e parts) has been downloaded yet? Any help is much appreciated.
Parsa Mousavi (1130 rep)
Oct 7, 2020, 06:13 AM • Last activity: Oct 7, 2020, 11:47 AM
Showing page 1 of 20 total questions