Vi Text Editor
The Vi (and its successor Vim, for Vi improved) text editor for Unix, GNU-Linux, and Mac OS X systems is a way to edit text files, including configuration, PHP, or HTML documents, through the command line interface. This includes, of course, using SSH to connect to a server.
To use it with even a minimum of efficiency, though, you need to know a fair number of its cheat codes– err, keyboard shortcuts.
These are resources the Agaric Designe Collective found useful (when we started out, now of course we can type sonnets and ASCII art on the command line in our sleep).
vi file.txt
edits a file or creates a file and starts editing.
In command mode:
k One line up
j One line down
^ Beginning of current line
$ End of current line
dd Deletes current line
5dd Deletes five lines (pick your number)...
dw Deletes current word
7dw Delete seven words...
u Undoes last change
You can enter edit mode by pressing i
(note that you can do enough editing to obliterate your document in command mode, but i
lets you insert text).
These and more, and more detail, found at http://www.ms.washington.edu/help/editors/vi.html
and http://www.uic.edu/depts/accc/software/unixgeneral/vi101.html
Comments
To go to the end of the file
To go to the end of the file in vi, simply press the letter
G
And yes,
To use vim to delete to the end of a file,
dG
does it.
Post new comment