next up previous contents
Next: Commands to set the Up: File and Directory Manipulation Previous: Commands to manipulate a

Commands to manipulate a file

Creating a file: We are mainly interested in creating C program files also called as C source files. These files contain the C source code in the form of ASCII text and have a .c extension. We create these files using the editor program. The simplest editors are 'pico' and 'vi'.

The command pico myfile.c will open a file that may or may not exist. If it already exists then we can make changes to it and save it either under the same name or under a different name.

By using a C compiler 'cc', we can compile our source file 'myfile.c' and generate. This file is created by the compiler program, by taking out C source file as input. The procedure to compile C programs is described in a later section. Unlike in DOS executable file in IRIX need not have the extension .exe. We can execute a file by simply giving its name on the command prompt.

For example, suppose we have an executable named myfile, then we can execute it by simply giving myfile.

Moving a file: The command is mv. It is the same command that was used in moving directories.

Removing a file: The command is rm -i file_name.

Copying a file: The command is cp file_name1 file_name2.



Sushil Prasad
Fri Oct 9 10:28:36 EDT 1998