Tag: vi

Movement commands in vi

Move by one character h - Move cursor left j - Move cursor down k - Move cursor up l - Move cursor right Move by word w or W - Move forward by word, cursor is beginning of the word b or B - Move backward by word, cursor is beginning of the word … Continue reading Movement commands in vi

Commands to change cursor position in vi

h - Left l - Right k - Up j - Down w - Move forward to beginning of next word e - Move end of the word b - Move backward to beginning of the previous word 0 - First position on the line $ - Last position on the line ^ - First … Continue reading Commands to change cursor position in vi

How to change case of text in a file?

There are few ways to change case of text in a file from lower case to upper case or vice-versa. 1) Using dd, the conv option are ucase for upper case and lcase for lower case. $ cat test.dat sdfsf dsfsaf $ dd if=test.dat of=large_file conv=ucase 0+1 records in. 0+1 records out. $ cat large_file … Continue reading How to change case of text in a file?

Useful commands in vi to save/quit

There are few commands one can use to save a file n To save and quit: <esc>:wq To save (if modified) and then quit, if not modified then does not save quit: <esc>:x (by jwood@opsource.net) To save (if modified) and then quit, if not modified then does not save quit: <esc>ZZ (by boomslaang@hotmail.com) To save … Continue reading Useful commands in vi to save/quit

Useful commands in vi to delete

Useful commands in vi: To delete lines One at a time: <esc>dd n lines at a time: <esc>ndd - where n is the number of lines to be deleted, eg: 3dd would delete 3 lines To delete all blank lines (lines that don't have spaces in between): <esc>:g/^$/d To delete all blank lines that have … Continue reading Useful commands in vi to delete