There are dozens of ways to do this...
Personally, i'd think the easyest way to encrypt a file/folder would be:
In case you're encrypting a folder, i'd personally create a tar.gz or a zip from that folder, so i'd end up with a file.
Then i'd use gpg: There are dozens of tutorials, instead of writing out all commands, i just googled and here's the first link:
https://www.howtogeek.com/427982/how-to-encrypt-and-decrypt-files-with-gpg-on-linux/