Home | Login and Logout | Basic Command Line Commands | File System | File Editing Through Terminal | Java Programs | Input/Output Redirection | Grep | Works Cited
Editing files through the linux terminal can be accomplished by using the vim editor. This is a text editor built into the linux machine.
To create a java file and open it in the vim editor, you can type "
(filename being the name of the file you want to create). The file will be created in your
current directory. If the file you want to edit already exists you must navigate to the
directory it is located in and open it the same way as creating it("
Once the file has been created the screen will look like the following image.
If the file already exists and has text within it, then the text will be displayed on the screen.
ikey while in the default mode will allow you to enter insert mode where you can insert and delete text like you would be able to in any other editor. You cannot use most other commands while in insert mode.
esckey will take you out of insert mode or any other mode you are in, allowing you to use other commands again.
xwill delete the character you are hovered over.
rand then any other key will replace the character you are hovered over with the letter key pressed
ddwill delete that number of lines starting on the one your cursor is in. Just typing
ddwill remove 1 line.
uwill undo your last edit made.
CTRL+rwill redo your last undo.
vwill open the visual mode, where you can use the arrow keys or h,j,k,l to highlight text. Highlighted text can be deleted using '
x' or copied using '
CTRL+c'. To paste code, you can navigate to where you'd like to paste to, right click, and select paste.
:help. This will display a full list of commands in vim.
Written by: Daniel Amusin, Derek DeCramer, Nikhil Thammadi