Читать книгу Kali Linux Penetration Testing Bible - Gus Khawaja - Страница 41
Vim vs. Nano
ОглавлениеFor the terminal window, we have two popular text editors, vim and nano. Most of the time, you can tackle four tasks in text editors:
Open/create the text file
Make text changes
Search for text
Save and quit
Nano is easier than vim. It's up to you to choose any of them; it's a matter of preference.
To open/create a text file, use these commands:
$vim [ text filename ]
$nano [ text filename ]
Once the text file is opened, you will need to start making your changes:
In nano, you can just enter your text freely.
In vim, you need to press I on your keyboard to enter insert mode.
If you want to search for a specific word inside your file, use these commands:
In nano, press Ctrl+W.
In vim, it depends which mode you're in.If you're in insert text mode, then hit the Esc key and then press / followed by the word that you want to search for.If you're in normal mode, then just press / followed by the word that you want to search for.
Finally, it's time to save and quit your text editor:
In nano, press Ctrl+O to save, press the Enter key to execute the save task, and then press Ctrl+X to exit.
In vim, make sure that you are in normal mode first (if you're not, then press the Esc key to go back in normal mode) and then use :wq . The w is for “write,” and the q is to quit.