2 Solaris高级系统管理员指南( 八 )


gtxa%ps -e│grep openwin
260 ? 0:00 openwin
gtxa%
如果想要打印上述信息,可以另加管道命令(|lp )于上述命令之后:
gtxa%ps-ef │grep openwin │lp
request id is castle─51(request id is cstle ─51
(standard input)
gtxa%
2.5使用手册
SunOS 5.x提供联机参考手册,手册被分为不同的节(section),同一类型的命令组成一节 。例如,大多数用户命令归并为(1)节,系统管理归并为(IM)节 。手册可以存放在本地系统上,也可以在服务器上,本节描述如何显示手册,及如何找到某条命令在哪一节 。
2.5.1显示手册(man)
显示手册,只需键入man ,手册页即显示出来 。
gtxa%man grep
grep(1) USER COMMANDS grep(1)
NAME
grep -search a file for a pattern
SYNOPSIS
grep [-bchilnsvw] limited -expression
...
2.5.2找命令节号(whatis、man)
有些命令的名字可以出现在几个章节中,此时可以使用whatis找到命令在手册中的节号(section number) 。
注意:仅当使用了cat man来命令建立手册之后whatis命令才起作用 。在超级用户状态下键入#cat man 可以建立手册页,其中是欲建立的节号 。
依下列步骤可以找到手册的节号:
1、 键入whatis。本命令手册的第一行显示出来,此行中含有该命令手册的节号 。
2、键入man -s 再回车,则显示手册页 。
gtxa%whatis chown
chown chown(1) -change owner of file
chown chown(1b) -change owner
chown chown(1m) -change owner
chown chown(2) -change owner and group of a file
gtxa%man -s2 chown
chown(2) SYSTEM CALLS chown(2)
NAME
chown,lchown,fchown-change owner and group of a file
SYNOPSIS
# include
# include
int chown(const char * path,uid-t owner,gid-t group);
int chown(const char * path,uid-t owner,gid-t group);
int fchown(int fildes,udi─towner,gid─t group);
DESCRIPTION
chown()sets the owner ID and group ID of the file specified by path or feferenced ty the open file descriptor fields to owner and group respectively. if owner or group is specified as-1,chown() does not change the corresponding ID of the file. ...
2.6查阅磁盘信息
下面的命令可用来查磁盘使用信息,并指出某文件系统是本地的UFS还是远程的(nfs) 。
2.6.1显示磁盘空间的信息(df -k)
Solaris中的df命令,当不加参数使用时,输出结果与以前的df命令不同 。df加上-k选择项,可以按SunOS 4.x中的格式来显示磁盘信息 。键入df -k显示文件系统名,总字节数,已使用的字节数,剩余字节数,已经使用的百分比,以及安装点 。
gtxa?-k
/dev/dsk/c0t0d0s0 30383 19926 7427 73% /
/dev/dsk/c0t0d0s6 189683 66503 104220 39% /usr
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
swap 44268 12 44256 0% /tmp
/dev/dsk/c0t0d0s7 331953 116133 182630 39% /opt
/dev/dsk/c0t3d0s7 189858 24293 146585 14% /export/home
openet:(pid146) 0 0 0 0% /nt
openet:(pid146) 0 0 0 0% /home
....
2.6.2判别某文件系统是否为本地文件系统(df)
键入df 可以查出某文件系统是本地文件系统还是远程安装的网络文件系统(nfs) 。与指定的文件系统相应的磁盘格式信息(包括磁盘位置或安装点)也将显示出来 。
在下例中,文件系统是nfs文件系统 。
gtxa%df /home/ignatz
bigriver:export/home/ignatz 5388980 399435 85647 82%/tmp-mmt/home/ignatz
gtxa%
在下例中,文件系统在本地硬盘上
#df /
/dev/dsk c0t0d0s0 30383 11885 15468 43% /
2.6.3找出某种类型已安装的文件系统(df -F)
若欲显示同一类型的所有已安装文件系统,可使用-F选择项,后接文件系统类型 。最常用的文件系统结构是本地文件系统ufs 和网络文件系统nfs 。键入df -F 可列出所有特定类型的已安装文件系统 。下例中,显示所有已安装的nfs文件系统:

推荐阅读