Free Video Downloader

Fast and free all in one video downloader

For Example: https://www.youtube.com/watch?v=OLCJYT5y8Bo

1

Copy shareable video URL

2

Paste it into the field

3

Click to download button


How to Use Vim to Encrypt Text Files on Linux
December 30, 2022

How to Use Vim to Encrypt Text Files on Linux

Reading Time: 3 minutes

It’s easy to secure the contents of a text file on Linux by encrypting it with Vim.

Most of us keep important notes, login credentials, and other sensitive information in text files. However, it is unsafe to keep this information in plain text. One of the ways to protect sensitive information is to use encryption.

If you’re looking for a simple and quick way to encrypt a file in Linux, you can use the Vim editor. Vim has some built-in file-encryption features that let you secure sensitive information using different encryption methods. Only a person with the right key can then access the encrypted file.

Let’s see how you can use Vim to encrypt text files in Linux.

How to Encrypt a File Using Vim

To encrypt a file using Vim, first, open it in the editor using the following command:

 vim filename 

If a file with the specified filename doesn’t exist, Vim will create it. Now go to Insert mode by pressing the i key and add the text you want to include in the file.

To encrypt the file, press Esc to go to Command mode, type the following line, and hit Enter:

 :X 

Vim will ask you for the encryption key. You will have to enter the key twice.

To save the changes and quit Vim, type the following and hit Enter:

 :wq 

This will encrypt your text file. You can use the cat command to verify it:

 cat filename 

An alternate way to encrypt a file in Vim is to use the following command:

 vim -x filename  

It will prompt for an encryption key. Enter the key twice to avoid any typos. Then, edit your file and once you’re done, save and quit Vim.

Opening an Encrypted File With Vim

To open an encrypted file, you’ll need to provide the correct encryption key. If you do not enter the correct key, Vim will convert your content into some garbage content. Never save the file in such a situation otherwise your file will be overwritten by the garbage content.

How to Check the Encryption Method

To check the encryption method that Vim used to encrypt a particular file, use the following command:

 file encrypted_filename 

You can also check the encryption method from within the editor. To do so, open the encrypted file in Vim, then while in the Command mode, type the following and hit Enter:

 :setlocal cm? 

This will print the line showing the encryption method for the current file.

To view all the encryption methods available in Vim, type:

 :h cm 

This will open a help page displaying all the encryption methods along with a brief description of each.

Change File Encryption Method in Vim

To change the encryption method for an encrypted file, open it in Vim and enter the encryption key. Then in the Command mode, type the following command replacing encryption_method with blowfish2, blowfish, or zip:

 :setlocal cm=encryption_method 

For instance, to change the encryption method to blowfish, type:

 :setlocal cm=blowfish 

Then save the changes using:

 :w 

Change or Remove the Encryption Key

To change the encryption key of an encrypted file, open the file in Vim. Then, type the encryption key to access the content. While in the Command mode, type:

 :X 

It will ask you for the encryption key. Type a new key and then retype it to confirm.

To remove encryption, just hit Enter twice without typing any key. Once done, make sure you save the changes by typing:

 :w 

Keep Your Passwords in an Encrypted File

You can use Vim to encrypt/decrypt text files in Linux rather than using a separate encryption tool. You can also keep passwords in an encrypted file and use Vim as a password manager. However, note that encryption methods like zip and blowfish offered by Vim are not strong. It is recommended to use only blowfish2 which is a strong encryption method.

You don’t need to be an expert in Vim to encrypt your files, just learn some basics, and you are good to go.

Reference: https://www.makeuseof.com/encrypt-text-files-linux-with-vim/

MediaDownloader.net

-> Free Online Video Downloader, Download Any Video From YouTube, VK, Vimeo, Twitter, Twitch, Tumblr, Tiktok, Telegram, TED, Streamable, Soundcloud, Snapchat, Share, Rumble, Reddit, PuhuTV, Pinterest, Periscope, Ok.ru, MxTakatak, Mixcloud, Mashable, LinkedIn, Likee, Kwai, Izlesene, Instagram, Imgur, IMDB, Ifunny, Gaana, Flickr, Febspot, Facebook, ESPN, Douyin, Dailymotion, Buzzfeed, BluTV, Blogger, Bitchute, Bilibili, Bandcamp, Akıllı, 9GAG

Ref: makeuseof

Leave a Reply

Your email address will not be published. Required fields are marked *