Previous Table of Contents Next


Changing the Priority of a Process (nice)

You can use the nice command to raise or lower the priority of a command or a process. When you use the nice command without an argument, the default is to increase the nice number by four units, thus lowering the priority of the process.


NOTE:  You must be superuser to change the priority of a process by using the nice command.

Use the following command to lower the priority of a command by four units (the default):

/usr/bin/nice command-name

Use the following command to lower the priority of a command by increasing the nice number by ten units:

/usr/bin/nice +10 command-name


NOTE:  The plus sign (+) is optional for positive numbers. The minus sign (-) is required for negative numbers.

Use the following command to raise the priority of a command by lowering the nice number by 10 units:

/usr/bin/nice -10 command-name

Use the following command to raise the priority of a command by lowering the nice number by 10 units. The first minus sign is the option sign, and the second minus sign indicates a negative number:

/usr/bin/nice - -10 command-name

Troubleshooting Processes

The following list provides some tips for troubleshooting problems with processes:

  Look for several identical jobs owned by the same user. This situation may result from running a script that starts a lot of background jobs without waiting for any of the jobs to finish.
  Look for a process that has accumulated a large amount of CPU time in the TIME field. The process may be in an endless loop.
  Look for a process running with a priority that is too high. Type -s -c to display the CLS field with the scheduler class of each process. A process executing as a real-time (RT) process can monopolize the CPU. Alternatively, look for a timeshare (TS) process with a high nice value. A user with superuser privileges may have bumped up the priorities of this process. You can lower the priority by using the nice command.
  Look for a runaway process--one that progressively uses more and more CPU time. You can monitor the process by looking at the time when the process started (STIME) and by watching the accumulation of CPU time (TIME) for a while.

Reviewing Essential Administration Tools

The SunOS 5.x system software provides you with three kinds of administration tools:

  The usual collection of operating system commands.
  An administration tool (Admintool) with a graphical user interface.
  The unbundled Solstice AdminSuite with a graphical user interface. For an introduction to the Solstice AdminSuite, see "Introducing the Solstice AdminSuite Product."

Frequently Used Commands

The following sections briefly introduce basic SunOS 5.x commands that you are likely to use regularly as part of routine system administration; they are grouped by tasks. See "Basic OS Commands" in Chapter 2 for more frequently used commands. See Appendix A for a list of SunOS 4.x commands and their SunOS 5.x equivalents.

Getting Around in the File System

SunOS 5.x system software has a hierarchical file system. When administering systems, you need to know where you are in the file hierarchy and how to change to a different directory.

Finding Where You Are in the File System To find out where you are in the file system hierarchy, type pwd and press Return. The print working directory command displays the current directory.

oak& pwd
/etc
oak%

Changing Directories To change directories, type cd pathname and press Return. The change directory command puts you in the directory name you type:

oak% cd /usr
oak% pwd
/usr
oak%

If you type cd and press Return without typing a path name, you are returned to the login home directory.

Finding Information About Files

Using the ls command, you can list the contents of a directory and display permissions, links, ownership, group, size (in bytes), modification date and time, and file name for files. Many user problems related to accessing files can be traced to problems with incorrect permissions or ownership. See Chapter 10, "Recognizing File Access Problems," for more information.

Displaying File Information

To display information about an individual file, type ls -l filename and press Return. Permissions, links, owner, group, file size in bytes, modification date and time, and the file name are displayed:

oak% ls -l /etc/passwd
-r--r--r--   1 root     sys          659 Feb 24 17:28 /etc/passwd
oak%

To see a complete list for all the files in the directory, type ls -l and press Return. See the ls manual page for a complete list of options.


Previous Table of Contents Next