How do I password protect a file archive with 7zip on Linux?

May 5, 2025 3 answers
Asked by ~time permitting
I'm used to using 7zip on Windows, where I can easily drag and drop files into the program to password protect them. However, I'm not sure about the command-line instructions for doing this on a Linux system. Can someone guide me on how to encrypt an archive using 7zip via the command line?

Answers

76 loose buttons
Remember to check your specific Linux distribution's documentation if you run into any issues. Some details might vary depending on your setup. Also, don't hesitate to reach out with your distro name and any errors for more help!
Reply to this answer
thunder~watch
You can use the command `7z a -pYourPassword -mhe=on path/to/encrypted.7z path/to/archive` to create a password-protected archive. Just replace `YourPassword` with your desired password and adjust the paths accordingly.
Reply to this answer
+Reading glasses
If you're looking for simple examples, try using `tldr 7z`. This will give you a quick overview of the command and usage. Just note that it might not cover every feature, but itโ€™s perfect for basic tasks.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions