Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Vim/Vi to encrypt and decrypt files in Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to use Vim/Vi to encrypt and decrypt files in Linux system. Xiaobian thinks it is quite practical, so share it with you to learn. I hope you can gain something after reading this article. Let's not say much. Let's take a look at it together with Xiaobian.

When writing code or articles, we always want some files to be invisible to others, but if you deliberately use the interface, it seems a bit excessive. Using VIM to encrypt files is a good choice.

I. Encrypted files

Create files or open files with vim

After editing the vi test.txt or vim test.txt file, type

:X //Note the capital X, then Enter and you'll be prompted twice for the password

At this point, the file has been encrypted, but the last important step is missing, which is to enter the save or save exit command again on the command line.

:w or:wq So far, the file encryption is complete, you can open the file to test it.

Of course, enter the password can be opened normally, if you do not enter the password or enter the wrong password, then:

The same is true for viewing files using other commands, and even copying files to other computers requires the correct password to open.

Therefore, if you forget the password, then this file is not open even if the king!

In win 10, use bash to edit files with vi or vim and encrypt them with the same effect as linux.

II. Declassified documents

To decrypt a file, you need to be able to open the file correctly with vi or vim, and then type

:set key= then: :wq or, enter command

:X or:wq! At this point, the file has been decrypted normally, and the file will be opened next time.

Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

The above is how to use Vim/Vi to encrypt and decrypt files in Linux system. Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report