Previous | Table of Contents | Next |
Each shell maintains an environment with a set of specifications that it gets from the user's initialization files (.profile for the Bourne and Korn shells or .cshrc and .login for the C shell) or from environment variables set interactively from a shell. These environment variables can specify information such as the user's home directory, login name, default printer, location for e-mail messages, and path for accessing the OpenWindows environment. This section describes how to find environment variable settings (env). See Chapter 8, "Understanding Shells," for more information.
To find a user's environment variable settings, type env and press Return. A list of the environment variables and their settings is displayed. See Chapter 1, "Introducing Solaris System Administration," for a list of the default environment variables and for information on how to set them.
This example shows the environment variable settings for user ignatz:
oak% env HOME=/ PATH=.:/home/ignatz:/usr/bin: /home/ignatz/bin:/bin:/home/bin: /etc:/usr/etc LOGNAME=ignatz HZ=1ØØ TZ=PST8PDT TERM=sun SHELL=/bin/csh MAIL=/var/mail/ignatz PWD=/ MANSECTS=1:1m:1c:1f:1s:1b:2:3:3 c:3i:3n:3m:3k:3g:3e:3x11:3xt:3w: 3b :9:4:5:7:8 oak%
This section describes how to create and edit files using these commands: cat, touch, cp, mv, Text Editor, and vi.
Use the cat command to create short files or to append a small amount of text to an existing file. Follow these steps to create files using the cat command:
Follow these steps to append text to an existing file:
To view the contents of the file, type cat filename and press Return. The contents of the file are displayed. If the file is too long to fit in the terminal window, it'll fly by and show you the lines at the end of the file that fit in the window or on the screen.
The following example creates a file named kookaburra with the first verse of the kookaburra song, displays the contents of the file, appends the second verse to the file, and displays the contents again:
castle% cat > kookaburra Kookaburra sits in the old gum tree Merry merry king of the bush is he Laugh kookaburra, laugh kookaburra Gay your life must be. ^D castle% cat kookaburra Kookaburra sits in the old gum tree Merry merry king of the bush is he Laugh kookaburra, laugh kookaburra Gay your life must be. castle% cat >> kookaburra Kookaburra sits in the old gum tree Eating all the gumdrops he can see Stop kookaburra, stop kookaburra Leave some there for me. ^D castle% cat kookaburra Kookaburra sits in the old gum tree Merry merry king of the bush is he Laugh kookaburra, laugh kookaburra Gay your life must be. Kookaburra sits in the old gum tree Eating all the gumdrops he can see Stop kookaburra, stop kookaburra Leave some there for me. castle%
The touch command sets the access and modification times for each file to the current time. If a file does not exist, an empty one is created. You can use the touch command to create an empty file to check permissions and ownership or to create a file to which you will add text at a later time.
To create an empty file, type touch filename and press Return. A new empty file is created. If the file exists, then its modification time is updated to the current date and time.
The following example uses the ls command to determine that there is not a file named junk, creates the file, and uses the ls command to verify that the empty file is created:
oak% ls -l junk junk: No such file or directory oak% touch junk oak% ls -l junk -rw-r--r-- 1 irving staff Ø Sep 11 15:Ø6 junk oak%
You can create a new file by copying or renaming an existing file.
To copy an existing file, type cp old-filename new-filename and press Return. You have made a copy of the file, retaining the original one:
oak% cp quest oldquest oak%
To move (and rename) an existing file, type mv old-filename new-filename and press Return. You have changed the name of the file and removed the old one.
oak% mv quest /tmp/quest.old oak%
You can use the OpenWindows Text Editor to create and edit files. You may, however, have problems using Text Editor to edit files that have root permissions.
To start Text Editor from the OpenWindows workspace from the Workspace menu, choose Programs. Then choose Text Editor from the Programs menu. To start Text Editor from a command line, type /usr/openwin/bin/textedit & and press Return. A Text Editor window is displayed. Use the commands from the Edit menu or the Cut, Copy, Paste, and Undo keys from the keyboard to make editing changes.
If you are running CDE you can use the CDE Text Editor to create and edit files. To start Text Editor from the CDE front panel, click on the Personal Applications menu and click on Text Editor. To start the CDE Text Editor from the command line, type /usr/dt/bin/dtpad& and press Return. A Text Editor window is displayed. Use the commands from the Edit menu or the Cut, Copy, Paste, and Undo keys from the keyboard to make editing changes.
Previous | Table of Contents | Next |