command terminal Linux Commands MOC
The vim command is a text editor similar to nano. It is more difficult than nano but more powerful.
Usage
vim <file>
i goes into insert mode for typing
$ vim new-file-in-vim.txtImportant Subcommands
Go to normal mode (not insert mode) first
Esc,Ctrl+C: Normal mode for commandsi: Insert mode for typing:q: Quit:q!: Force quit:wq,:x: Save and quitgUU: Convert entire line to uppercasega,:as,:ascii: Display ascii character as hex:%!xxd: Show file in hexadecimal
Searching
/<search_term>: Search forwards?<search_term>: Search backwardsn: Next occurrence\<: Beginning of word in search term/\<Linux\>\>: End of word in search term/\<Linux\>\c: Ignore case, put after search term/Linux\c\C: Force case, put after search term/Linux\C*: Search forwards for word on cursor#: Search backwards for word on cursor\%x: Search by hex code/\%x61
Visual Mode
v: Visual mode for highlightingu: Switch highlight to lowercaseU: Switch highlight to uppercase~: Swap all case in highlight