Linux – Vim

Vim is a text editor that is included with Ubuntu that allows you to modify configuration files.

http://manpages.ubuntu.com/manpages/xenial/man1/vim.1.html

To Create a Text File

  • Simply type vim filename
  • Capitalization matters. test.txt, Test.txt, and TEST.TXT are different files.
  • File extension does not matter in Linux CLI, but makes it easier to know what files are.

To Edit Files

  • To open a file simply type vim filename
  • Type i to enter INSERT mode.
  • Hit esc key to exit INSERT mode
  • Type :q to exit file if you made no edits
  • Type :wq to save and quit
  • Type :q! to exit without saving changes
  • Protected configuration files will require the sudo command to open and edit: sudo vim group

To Find Words Within Files

  • Type / and then the word you are looking for: /bob
  • Press ENTER
  • Lowercase n searches for text instance down, uppercase N searches for the next instance up

Be the first to comment

Leave a Reply