vim is a texteditor for linux. Hard to learn but amazing to use
Commands on CLI
open a document
vim /folder/file
Start vim with commands
vim +<command> /folder/file
open at specific line
# will open file on line 5
vim +5 /folder/file
start vim with the first occurence of a word (search in file)
vim +:/<searchterm> /folder/file
replace first occurence in file
vim +:s/<searchterm>/<replaceterm>/ /folder/file
replace all occurences in a file
vim +:s/<searchterm>/<replaceterm>/g /folder/file
Commands / usage inside veeam
when vim is started it is not in deiting mode. to get into editing mode press “i”. now you can type. to go back to command mode press “ESC”
to enter a command press “:” in command mode. This will show “:” in the lower left corner. also a possible way to start this is “/”
Here you can type different commands. commands can be combined
:w -> saves file
:q -> quit file
:wq -> save and quit
:q! -> force quit (ex. if changes been made and you want to discard it)
:s/search/replace/ -> search and replace term in file. will only replace first occurence
:s/search/replace/g -> g for global. will replace all occurences in file
:<linenumber> -> ex. :13 will jump to the 13th line in file
/term -> will search for “term” in the document and stop at the first occurence. to jump to the next found term press “n”
:set number -> this will show the line number at the beginning of the line
:set nonumber -> will disable the line numbers
Then vim has also commands which need no “:” or “/” to enter commands. just input them while file is open to do something
gg -> go to first line in file
GG -> fo to last line in file
p -> past line below cursor
P -> past line above cursor
dd -> removes line and takes it into clipboard
yy -> copy line to clipboard
u -> undo change
d2d -> remove the 2 lines below