Redirecting output to a file

The output of a process can be redirected to a file by typing the command followed by the output redirection operator and file name.

For example, to redirect the results of the who command to a file named users, type the following:

who > users
Note: If the users file already exists, it is deleted and replaced, unless the noclobber option of the set built-in ksh (Korn shell) or csh (C shell) command is specified.

To see the contents of the users file, type the following:

cat users

A list similar to the following is displayed:

denise    lft/0 May 13 08:05
marta     pts/1 May 13 08:10
endrica   pts/2 May 13 09:33