With zip utility, you can protect a zip file with a password. There are two options to do that, of which the other one is highly insecure.
$ zip -p xyz123 myfile.zip myfile.txt
The p
stands for password which is entered as a next argument. As you can see, this command is stored in history so the password can be seen in plain text format afterward. This method is not recommended
$ zip -e myfile.zip myfile.txt
Enter password:
Verify password:
adding: myfile.txt (stored 0%)
The e
stands for encryption. The password is prompted interactively and it is not echoed. The password prompt is repeated to ensure there is no typing errors.
To unzip password protected zip file, just unzip the file normally and enter the password when prompted: Unzip File in Linux