How do I open, create, edit, and view a file in Linux?

LinuxThere are different commands that can be used to open, create, edit, or view a file in Linux. Below is a listing of each of these commands. Click on the link for each of these commands to get additional information about that command.

Note: Some variants of Linux may not include all of the commands below. For example, the pico command is often not included in many default installations.

View a file

cat
tail
head
pg

Open, create, and edit a file

The following commands are also capable of viewing a file.

pico
vi
ued
ed
vim

For users new to Linux or familiar with MS-DOS, we highly recommend using the pico command to create and edit text files. Below is an example of pico that could be used to create a file in Linux.

pico myfile.htm

In the above example, assuming the file "myfile.htm" does not exist, pico would open a blank edit page for myfile.htm. If this file did exist, pico would open any text that file contains.

Additional information

  • See the create, edit, and view definitions for other documents related links and information.