beautypg.com

The vi editor – Cyclades PC400 User Manual

Page 35

background image

Cyclades-PC400

35

Appendix A - Linux

Installation Manual

Other commands allow the user to change directories and see the contents of a directory.

pwd

Supplies the name of the current directory. While logged in, the user is always
"in" a directory. The default initial directory is the user's home directory,
/home/

ls [options]

directory_name

Lists the files and directories within

directory_name

. Some useful options are -l

for more detailed output and -a which shows hidden system files.

cd

directory_name

Changes the directory to the one specified

cat

file_name

Prints the contents of

file_name

to the screen.

Shortcuts:

. (a dot)

represents the current directory

.. (two dots)

represents one directory above the current directory (i.e. one directory closer to the base
directory).

The vi Editor

To edit a file using the vi editor, type

vi file_name

vi is a three-state line editor: it has a command mode, a line mode and an editing mode. If in doubt as to which
mode you are in, press the key which will bring you to the command mode.

Mode

What is done there

How to Get There

command mode

navigation within the open file

Press the key.

editing mode

text editing

See list of editing commands below.

line mode

file saving, opening, etc. exiting
from vi

From the command mode, type ":" (the
colon).

Entering the program, the user is automatically in the command mode. To navigate to the part of the file to be