Well, when it comes to text file editing in a Linux terminal window, there really is nothing better than Vi. However, if I have a GUI, then UltraEdit is my clear favourite.
The advantage of learning Vi is that every Linux box has it and it runs in the terminal so is everywhere. The thing with Vi is remembering all the commands, master them and editing is quick and easy, forget them and life is a pain! Yes, I confess, sometimes it is just easier to edit the file via FTP. However there is a lot to be said for learning Vi, one good starting point is vi Tutorial, and another is Interactive Vim tutorial. What follows is the Vi commands that I use:
Keystroke | Action |
Shift G | Go to end of file |
:$ | Goto end of file |
:n | Goto line n |
Ctrl+f | Move forward 1 "page or screen" |
Ctrl+b | Move backward 1 "page or screen" |
Ctrl+d | Move forward ½ "page or screen" |
Ctrl+u | Move backward ½ "page or screen" |
:.= | Show current line number |
/aaa | Search for text aaa, following by n for next or N for previous |
?aaa | Search backwards for text aaa, following by n for next or N for previous |
:1,$!sort | Sort the file (done using external command) |
O | Open a new line above the cursor |
o | Open a new line below the cursor |
0 | Move to start of current line (zero) |
$ | Move to end of current line |
w | Move to next "word" |
A | Append to the end of the current line |
a | Append after the current character |
i | Insert before the current character |
Y | Yank, or copy the current line |
P | Put, or paste the yank'ed line |
x | Delete current character |
dd | Delete current line |
Shift D | Delete from cursor to end of line |
:wq | Save changes and exit |
:x | Exit, saving changed if any were made |
:q! | Exit and don't save changes |
:set nu | Show line numbers! |
:s/chars | Search for the entered chars |
:s/old/new | Search and replace on the current line |
:%s/old/new | Search and replace over the whole file |
There is a lot more, if you start using it a lot but that is more than enough to get you started and enable you to do the basic editing.