Useful Solaris command [zt]

xiaoxiao2021-03-06  40

The command in Solaris is very much, so that it is difficult to separate the cool commands. For example, some command reporting procedures take time to spend each system call, some commands dynamically display system activity information, and most of these commands are included in Solaris 8 and Solaris 9. Here, I will focus on some of the commands, you may find that they are particularly useful.

System administrator is the user of the tool. Through practical experience, we have mastered more tools and enhances the diagnostics and the ability to implement solutions. The commands contained in this column are collected by experience, friends, acquaintances, and SunNetwork 2002 held in September. The "The / Procodile Hunter" said by the developer of the Solaris kernel, the "The / Procodile Hunter" told that people are very inspired, because the CANTRILL writes code to illustrate a point of view of a point than Shapiro's point of view. fast!

Useful Solaris command

Truss -c (Solaris> = 8): This is a shocking Truss option, which provides comprehensive summary information of the tracking command:

$ TRUSS-CGG ASDF WORK.DOC SYSCALL Seconds Calls Errors_Exit .00 1 Read .01 24 Open.00 8 4 Close .00 5 BRK .00 15 Stat .00 1 fstat .00 4 Execve .00 1 mmap .00 10 Munmap .01 3 MUNMCNTL .00 2 llseek .00 1 Open64.00 1 ---- --- --- Sys Totals: .02 76 4 usr time: .00 elapsed: .05

It also displays the summary data of the running process. In this case, the data indicates what the process has done from the start-up truss command to terminate TRUSS execution with control-c. This is ideal for how to judge the process, because you don't have to force the entire TRUSS output.

Truss -d and truss -d (Solaris> = 8): These two options indicate time information related to each system call displayed by TRUSS. This is very helpful for finding the problem in custom code or business code. E.g:

$ trus -d who base time stamp: 1035385727.3460 [WED OCT 23 11:08:47 EDT 2002] 0.0000 Execve ("/ usr / bin / wheh", 0xffbefd5c, 0xffbefd64) Argc = 1 0.0032 Stat ("/ usr / bin / WHO ", 0xffbefa98) = 0 0.0037 open (" / var / ld / ld.config ", o_rdonly) err # 2 Enoent 0.0042 open (" / usr / local / lib / lib / lib / libc.so.1 ", o_rdonly) Err # 2 Enoent 0.0047 Open ("/ usr / lib / libc.so.1", o_rdonly) = 3 0.0051 fstat (3, 0xffbef42c) = 0.. Truss -d is more useful for the delay time between the display system call:

Dilbert> Truss -d WHO 0.0000 Execve ("/ usr / bin / who", 0xffbefd5c, 0xffbefd64) Argc = 1 0.0028 Stat ("/ usr / bin / who", 0xffbefa98) = 0 0.0005 open ("/ var / ld / LD.config ", o_rdonly) Err # 2 Enoent 0.0006 Open (" / usr / local / lib / libc.so.1 ", o_rdonly) Err # 2 Enoent 0.0005 open (" / usr / lib / libc.so.1 " , O_rdonly) = 3 0.0004 FSTAT (3, 0xffbef42c) = 0 This example, STAT This system call takes longer than other system calls.

Truss -T: This is a great adjustment help option. When the specified system call is executed, it can terminate the process ("-u" also perform the same operation, but is when the user-level function is called). At this point, a Core file for further analysis will be obtained, or some / PROC tools will be used to determine the status of the processes.

Truss -l (Improved in Solaris 9): Displays the thread number per call in the multi-thread process. Truss -l in Solaris 9 has been improved, and finally, you can also monitor the execution of multi-threaded applications.

Truss is indeed a powerful tool. For example, the cause of the problem can be used in the Core file. You can also display user-level libraries (either for system libraries or programmer libraries) through the "-u" option.

PKG-GE: This is a good tool for automatically obtaining a free package (http://www.bolthole.com/solaris). It is configured by /etc/pkg-get.conf. Once configured and run, run PKG-GET -A to get the list of available packages and run PKG-GET -I to get and install a given package.

PLIMIT (Solaris> = 8): This command is used to display and set the limitations of each process in the running process. If a long running process exceeds a limit (such as the number of open files), it is very convenient to use this command. Plimit can modify the running process because there is no need to re-run the process after using the Limit command.

Coreadm (Solaris> = 8): When there is no Coreadm command before, Core Dump is placed in a working directory of the process. And the core file will overwrite each other. This issue and other more questions can be processed by CoreAdm, which is a tool for managing the Core file. You can specify whether to save the Core, Core stored location and the number of versions should be retained, and so on. All of these setup information is saved by modifying /etc/coreadm.conf before reboot.

PGREP (Solaris> = 8): PGREP Search in / proc to comply with a given rule, and return the ID of the process. One of the great options is "-n", which returns the latest process number that meets the conditions.

PreAp (Solaris> = 9): Remove the zombie process. Any process that is trapped in the "Z" state (displayed by the PS command), which can be cleared from the system.

Pargs (Solaris> = 9): Displays the parameters and environment variables of the process. NoHUP -P (Solaris> = 9): The NOHUP command can be used to start a process, so even if the shell of the start process is turned off (ie the process gets "SIGHUP" signal), the process can continue to run. This is useful to continue to run for a background task. But if you have already launched a process, then I hope to protect it from the HUP signal. What should I do? In Solaris 9, NOHUP -P can get the process ID and ignore the SIGHUP signal.

PRSTAT (Solaris> = 8): PRSTAT is also a TOP command, but has more features. Both commands provide a screen's useful information about the process and other related information, and can be updated frequently, in short, a great display system performance window. But PRSTAT is more accurate than TOP. It also provides some good options. "-a" can display the process and user information (default by CPU HOG sort). "-c" makes it very much like VMSTAT (next to the previous report). "-C" is displayed in the processor set. "-j" shows a process in "Engineering". "-L" displays information about each thread and each process. "-m" and "-v" show a lot of detailed performance information (including Pages, Traps, Lock Wait, and CPU Wait). All output data can be arranged in size, virtual memory size, runtime, and so on in memory. PRSTAT is a very useful tool in a system without TOP, and because of its accuracy, it is likely to replace TOP (some places take into account it is a supported program).

TrapStat (Solaris> = 9): Trapstat and Lockstat and Kstat are the most difficult command in Solaris. They show the most detailed details of the operating system within the operating system. Each command is essential to solve the problem that happens in the Solaris system. It is best to submit their output with the error report, but further research reveals that they can provide useful information for general applications.

VMSTAT -P (Solaris> = 8): Before this option can be used, you want to determine which type of memory command causes that the system page scheduling is almost impossible (please refer to "SELKIT"). VMSTAT -P can resolve this issue, as it does not only display whether your system is in memory shortage (via "SR" column), but also displayed by the following: Application code, application data or I / O. "-p" can truly help find the cause of mysterious memory in Solaris.

PMAP -X (Solaris> = 8, Solaris> = 9) Error repair): PMAP -X can be used if there is a memory problem in the process and you need more memory usage. This command will explain the entire memory mapping information of the target process of the specified ID, as follows:

# pmap -X 1779 1779: -ksh address kbytes rss anon locked mode mapped file 00010000 192 192 - - RX - KSH 00040000 8 8 8 - RWX - ksh 00042000 32 32 8 - RWX - [HEAP] FF180000 680 664 - - RX - Libc.SO.1 FF23A000 24 24 - - RWX - libc.so.1 FF240000 8 8 - - RWX - libc.so.1 FF280000 568 472 - - RX - Libnsl.so.1 ff31e000 32 32 - - rwx - libnsl.so.1 FF326000 32 24 - - RWX - Libnsl.so.1 FF340000 16 16 - - RX - libc_psr.so.1 FF350000 16 16 - - RX - libmp.so.2 FF364000 8 8 - - RWX - libmp.so.2 ff380000 40 40 - - rx - libsocket.so.1 ff39a000 8 8 - - rwx - libsocket.so.1 ff3a0000 8 8 - - rx - libdl.so .1 FF3B0000 8 8 8 - RWX - [Anon] FF3C0000 152 152 - - RX - ld.so.1 FF3F6000 8 8 8 - RWX - ld.so.1 FFBFE000 8 8 8 - RW --- [stack ] -------- - ------------------------- Total KB 1848 1728 40 - Here we can see each A piece of memory is used to do, accounting for how big (virtual and real) space and its pattern information.

DF-H (Solaris> = 9): This command is very common in Linux, just transferred to the Solaris platform. DF -H Displays the profile information of the file system in the form of a convenient reading:

$ DF -H FileSystem Size Used Avail Capacity Mounted ON / DEV / DSK / C0T0D0S0 4.8G 1.7G 3.0G 37% / Proc 0k 0K 0K 0% / Proc MNTTAB 0K 0K 0K 0% / etc / mnttab FD 0K 0K 0K 0 % / DEV / FD SWAP 848M 40K 848M 1% / VAR / RUN SWAP 849M 1.0M 848M 1% / TMP / DEV / DSK / C0T0D0S7 13G 78K 13G 1% / Export / HOME

Conclude

Each administrator has a daily use of tools, as well as another set of tools that help solve problems in an emergency. This article introduces a variety of orders and options, which are not widely known but it is very useful. Do you also save such preferred tools? If there is, please send it to me, let me expand my tool set. In addition, you can send some tools you don't like or feel dangerous, they may also become useful!

转载请注明原文地址:https://www.9cbs.com/read-59612.html

New Post(0)