05.08.2013 Views

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

72 <strong>Chapter</strong> 4 Informational Tools<br />

The -kl option tells df to report disk space in kilobytes (rather than as the number<br />

of 512-byte blocks), and to only report data for local drives. The columns are<br />

reasonably self-explanatory and include the name of the disk, the size, the amount<br />

used, the amount remaining, and the percentage amount used. The final column<br />

shows the mount point. In this example, both the /data and the /export/home<br />

file systems are running low on available space. On <strong>Solaris</strong> 9 and later there is a -h<br />

option to produce the output in a more human-readable format.<br />

4.3.14 Reporting Disk Space Used by Files (du)<br />

The du utility reports the disk space used by a given directory and its subdirectories.<br />

Once again, there is a -k option to report usage in kilobytes. On <strong>Solaris</strong> 9 and<br />

later, there is also a -h option to report in a human-readable format. Example output<br />

from the du command is shown in Example 4.29.<br />

% du -k<br />

8 ./.X11-unix<br />

8 ./.X11-pipe<br />

3704 .<br />

% du -h<br />

8K ./.X11-unix<br />

8K ./.X11-pipe<br />

3.6M .<br />

The du command in Example 4.29 reported that two directories consume 8KB<br />

each, and there is about 3.6MB of other data in the current directory.<br />

4.4 Process- and Processor-Specific Tools<br />

4.4.1 Introduction<br />

Example 4.29 Example of Output from the du Command<br />

This section covers tools that report the status of a particular process, or the<br />

events encountered by a particular processor.<br />

4.4.2 Timing Process Execution (time, timex, and ptime)<br />

The commands time, timex, and ptime all report the amount of time that a process<br />

uses. They all have the same syntax, as shown in Example 4.30. All three<br />

tools produce output showing the time a process spends in user code and system<br />

code, as well as reporting the elapsed time, or wall time, for the process. The wall

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!