Help Center

Knowledge Base

[Netmail Support]

Skip to end of metadata
Go to start of metadata

Editing and Viewing Files

This is a high-level view of several ways to edit and view files.


There are several uses for the cat command.

You can view but not edit the file.

cat file1

You can filter the output of the file to make it easier to view.

cat file1 | less

Combining the content of several files into one view or file.

cat file1 file2 file3 > file4

Creating a file.

cat > file1

The > sends the out put to the file indicated. The | sends the information from the file into the filter named there after.

More information can be found using the man page for cat by running the command:

man cat

Less and More

Less and More commands are used to display large files in a screen-by-screen view. The command can be used alone or in conjunction with other commands.

Lets the user view the file file1 one screen at a time.

less file1

Lets you view the cat file file4 one screen at a time.

cat file1 file2 file3 > file4 | more

less and more are interchangeable in the examples above


Do not use less or more with executable files

More information can be found using the man page for cat by running the command

man more
man less

Tail or Head

Tail shows the last few lines of a file. This is most useful when testing to see the last few lines of a log file. You will normally use this with a specification of the amount of lines at the end of the file that you want to see. The default number of lines is 10. Head shows the first lines of a file as opposed to the last.

If you need to specify a number of lines (in this case the last 15 lines will be displayed).

tail -n15 file1

If you want to view the first 10 lines of multiple documents, this might be of assistance to spot check or compare the first few lines of the three files indicated. The output will indicate the separation of files.

headfile1 file2 file3

More information can be found using the man page for cat by running the command:

man tail
info head


vi is a text editor that comes with the UNIX operating system. The vi editor has two modes of operation: Command mode and Insert mode. Command mode, which is the default mode when you enter vi, allows you to view and search documents. Insert mode is the mode in which you can edit and add text to a document.

  1. To enter Insert mode, hit the <i> key.
  2. To exit Insert mode, hit the <Esc> key. There are several commands in vi, therefore in this introduction to the editing tool, only the most basic commands have been included. You can find many more commands and additional information about the editor online.

Basics of creating and closing documents

To create a document in vi, where the file name does not currently exist.

vi file1

To open an existing file.

vi filename

To close the file without making changes. You will be prompted to add ! If it is necessary.

:q or :q!

To close the file and save changes made while in the document type.

:wq or :x

Cursor Movement

You can use the error keys to move through the document. They can only move one character or line at a time, so using the commands below can be very useful.

Moving the Cursor

You cannot use your mouse to navigate through the vi editor. You can, however, use your arrow keys and a few simple commands to easily move from navigating a doc into edit mode without taking your hands off the keyboard.

This moves the cursor down one line.


This moves the cursor up one line.


This moves the cursor left one character.


This moves the cursor right one character.


This moves you to start of your current line.


This moves you to the end of your current line.


This moves you to the start of the next word.


This moves you back to the start of the previous word.


This moves you to the first line in file.


This moves your cursor to the line n where n is any line number in the file.


This moves your cursor to the last line in file.


There are several other commands you can run to edit and navigate your way through vi. You can find several websites, including many colleges and universities, that have web pages dedicated to vi. You do not, however, need a large amount of knowledge to make the simple changes needed when using our products. You can create a file and practice to see which commands work best for you.