- rar: More feature‑rich for archival integrity and file manipulation. Creation is proprietary and requires a license but it is fully free and open for extraction.
- 7z: Fully open‑source and free to use for both creation and extraction. It can sometimes have marginally better compression ratios.
Rar is preferable to 7z on Linux when you need features 7‑Zip does not provide, such as built‑in recovery records, archive‑level deduplication, more robust multi‑volume handling, stronger resilience against corruption, advanced filters and preservation of basic UNIX ownership and permissions. If you don't need those, or fully open source is a must, then 7z is a reasonable option.
Note: Both actually have pretty equal support for extraction by a third party. You will not realistically find a system that can open .7z but not .rar, or vice versa.