p7zip is command line port of 7-Zip for POSIX systems, including Linux.
apt install -y p7zip
Install with Homebrew.
brew install p7zip
To handle .rar
archives, you have to install rar
library.
brew install rar
Install with scoop
scoop install 7zip