Solaris下/proc文件系统简介

本文介绍了Solaris中的/proc文件系统,它是一个到运行中进程地址空间的访问接口,允许通过标准Unix系统调用来访问进程信息。Solaris提供了多种工具,如pflags、pcred、pldd、pstack等,用于通过/proc获取和分析进程状态。这些工具位于/usr/proc/bin目录下,帮助用户深入了解和管理系统中的进程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ln-bes2% df
/                  (/dev/md/dsk/d10   ):31004448 块  5900647 文件
/devices           (/devices          ):       0 块        0 文件
/system/contract   (ctfs              ):       0 块 2147483568 文件
/proc              (proc              ):       0 块    29492 文件
/etc/mnttab        (mnttab            ):       0 块        0 文件
/etc/svc/volatile  (swap              ):86623952 块  4783482 文件
/system/object     (objfs             ):       0 块 2147483430 文件
/dev/fd            (fd                ):       0 块        0 文件
/tmp               (swap              ):86623952 块  4783482 文件
/var/run           (swap              ):86623952 块  4783482 文件
/dev/vx/dmp        (swap              ):86623952 块  4783482 文件
/dev/vx/rdmp       (swap              ):86623952 块  4783482 文件
/data              (/dev/md/dsk/d30   ):13171894 块  8337669 文件
/dev/odm           (/dev/odm          ):       0 块        0 文件
Solaris的文件系统中,有一个/proc文件系统,一些巨大的文件放在那里,/proc文件系统不是普通意义上的文件系统,它是一个到运行中进程地址空间的访问接口。通过/proc,可以用标准Unix系统调用(比如open()、read()、write()、ioctl()等等)访问进程地址空间。事实上,Solaris ps(1)命令正是利用/proc获取进程状态。 Solaris下使用/proc的工具相当完善,位于/usr/proc/bin目录中。这些工具提供了一种访问任意指定进程临界数据的简捷办法。/proc的魅力正是在于它包含了你可能想知道的关于一个进程的任何信息。
比如:
pldd -列出进程连接的动态库
pstack -调用栈 
pfiles -打开的文件描述符列表
ptree -进程关系树
了解了/proc工具的使用,就能更好的了解进程状态信息,所以,让我们花点事件看看proc(1)手册页
ln-bes2% man proc
正在重新格式化页面。请等待... 完成

User Commands                                             proc(1)

NAME
     proc, pflags,  pcred,  pldd,  psig,  pstack,  pfiles,  pwdx,
     pstop, prun, pwait, ptime - proc tools

SYNOPSIS
     /usr/bin/pflags [-r] pid | core [/lwp] ...

     /usr/bin/pcred [pid | core] ...

     /usr/bin/pcred [-u user/uid] [-g group/gid]  [-G  grouplist]
     pid...

     /usr/bin/pcred -l login pid...

     /usr/bin/pldd [-F] [pid | core] ...

     /usr/bin/psig [-n] pid ...

     /usr/bin/pstack [-F] pid | core  [/lwp] ...

     /usr/bin/pfiles [-Fn] pid...

     /usr/bin/pwdx pid...

     /usr/bin/pstop pid...

     /usr/bin/prun pid...

     /usr/bin/pwait [-v] pid...

     /usr/bin/ptime command [arg...]

     The proc tools are utilities that exercise features of /proc
     (see  proc(4)).  Most  of  them  take  a list of process-ids
     (pid).  The tools  that  do  take  process-ids  also  accept
     /proc/nnn  as  a  process-id, so the shell expansion /proc/*
     can be used to specify all processes in the system.

     Some of the proc tools can also be  applied  to  core  files
     (see  core(4)).  The tools that apply to core files accept a
     list of either process IDs or names of core files or both.

     Some of the proc tools can operate  on  individual  threads.
     Users   can  examine  only  selected  threads  by  appending
     /thread-id to the process-id or core. Multiple  threads  can
     be  selected  using  the  -  and  , delimiters.  For example
     /1,2,7-9 examines threads 1, 2, 7, 8, and 9.

     See .

SunOS 5.10          Last change: 11 Oct 2005                    1

User Commands                                             proc(1)

     pflags          Print the /proc tracing flags,  the  pending
                     and  held  signals,  and  other /proc status
                     information for each lwp in each process.

     pcred           Print or  set  the  credentials  (effective,
                     real, saved UIDs and GIDs) of each process.

     pldd            List the dynamic libraries linked into  each
                     process, including shared objects explicitly
                     attached using dlopen(3C).  See also ldd(1).

     psig            List the signal actions and handlers of each
                     process. See signal.h(3HEAD).

     pstack          Print a hex+symbolic stack  trace  for  each
                     lwp in each process.

     pfiles          Report fstat(2) and fcntl(2) information for
                     all open files in each process. In addition,
                     a path to the file is reported if the infor-
                     mation  is  available  from  /proc/pid/path.
                     This is not necessarily the same  name  used
                     to  open  the  file.  See  proc(4)  for more
                     information.

     pwdx            Print the current working directory of  each
                     process.

     pstop           Stop each process (PR_REQUESTED stop).

     prun            Set each process running (inverse of pstop).

     pwait           Wait for all of the specified  processes  to
                     terminate.

SunOS 5.10          Last change: 11 Oct 2005                    2

User Commands                                             proc(1)

     ptime           Time the command, like  time(1),  but  using
                     microstate  accounting for reproducible pre-
                     cision. Unlike time(1), children of the com-
                     mand are not timed.

     The following options are supported:

     -F       Force. Grabs the target  process  even  if  another
              process has control.

     -n       (psig and pfiles only) Sets non-verbose mode.  psig
              displays   signal  handler  addresses  rather  than
              names. pfiles does not display verbose  information
              for  each  file descrīptor.  Instead, pfiles limits
              its  output  to  the  information  that  would   be
              retrieved  if  the process applied fstat(2) to each
              of its file descrīptors.

     -r       (pflags only) If the process is  stopped,  displays
              its machine registers.

     -v       (pwait only) Verbose. Reports terminations to stan-
              dard output.

     Additionally, pcred supports the following options:

     -g group/gid    Sets the real, effective,  and  saved  group
                     ids  (GIDs)  of  the target processes to the
                     specified value.

     -G grouplist    Sets the supplementary GIDs  of  the  target
                     process to the specified list of groups. The
                     supplementary groups should be specified  as
                     a  comma-separated  list of group names ids.
                     An empty list clears the supplementary group
                     list of the target processes.

SunOS 5.10          Last change: 11 Oct 2005                    3

User Commands                                             proc(1)

     -l login        Sets the real, effective, and saved UIDs  of
                     the  target  processes  to  the  UID  of the
                     specified login. Sets the  real,  effective,
                     and  saved  GIDs  of the target processes to
                     the GID of the  specified  login.  Sets  the
                     supplementary  group  list to the supplemen-
                     tary groups list of the specified login.

     -u user/uid     Sets the real, effective, and saved user ids
                     (UIDs) of the target processes to the speci-
                     fied value.

     In order to set the credentials of another process,  a  pro-
     cess  must  have sufficient privilege to change its user and
     group ids to those specified according to the rules laid out
     in  setuid(2)  and it must have sufficient privilege to con-
     trol the target process.

     These proc tools stop their target processes while  inspect-
     ing  them  and  reporting  the  results:  pfiles,  pldd, and
     pstack. A process can do nothing while it is stopped.  Thus,
     for  example,  if  the X server is inspected by one of these
     proc tools running in a window under the X server's control,
     the  whole  window  system can become deadlocked because the
     proc tool would be attempting to print its results to a win-
     dow  that  cannot be refreshed. Logging in from from another
     system using rlogin(1) and killing the offending  proc  tool
     would clear up the deadlock in this case.

     See .

     Caution should be exercised when using the -F flag. Imposing
     two  controlling processes on one victim process can lead to
     chaos. Safety is assured only  if  the  primary  controlling
     process,  typically  a debugger, has stopped the victim pro-
     cess and the primary controlling process is doing nothing at
     the moment of application of the proc tool in question.

     Some of the proc tools can also be applied to core files, as
     shown  by the synopsis above. A core file is a snapshot of a
     process's state and is produced by the kernel prior to  ter-
     minating a process with a signal or by the gcore(1) utility.
     Some of the proc tools can need to derive the  name  of  the
     executable corresponding to the process which dumped core or
     the names of shared libraries associated with  the  process.
     These files are needed, for example, to provide symbol table
     information for pstack(1). If the proc tool in  question  is

SunOS 5.10          Last change: 11 Oct 2005                    4

User Commands                                             proc(1)

     unable  to  locate  the needed executable or shared library,
     some symbol information is unavailable  for  display.  Simi-
     larly,  if  a core file from one operating system release is
     examined on a different operating system release,  the  run-
     time  link-editor debugging interface (librtld_db) cannot be
     able to initialize. In this  case,  symbol  information  for
     shared libraries is not available.

     The following exit values are returned:

     0                       Successful operation.

     non-zero                An error has occurred.

     /proc/*                 process files

     See attributes(5) for descrīptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Availability                | SUNWesu                     |
    |_____________________________|_____________________________|
    | Interface Stability         | See below.                  |
    |_____________________________|_____________________________|

     Human Readable Output is Unstable. Options are Evolving.

     gcore(1), ldd(1), pargs(1), pgrep(1),  pkill(1),  plimit(1),
     pmap(1),  preap(1),  ps(1), ptree(1), ppgsz(1), pwd(1), rlo-
     gin(1),  time(1),  truss(1),  wait(1),  fcntl(2),  fstat(2),
     setuid(2),  dlopen(3C),  signal.h(3HEAD),  core(4), proc(4),
     process(4), attributes(5), zones(5)

     The following proc tools stop their target  processes  while
     inspecting them and reporting the results: pfiles, pldd, and
     pstack.

SunOS 5.10          Last change: 11 Oct 2005                    5

User Commands                                             proc(1)

     A process can do nothing while it  is  stopped.  Stopping  a
     heavily used process in a production environment, even for a
     short amount of time, can cause severe bottlenecks and  even
     hangs  of these processes, causing them to be unavailable to
     users. Some databases could also terminate abnormally. Thus,
     for  example,  a database server under heavy load could hang
     when one of the database processes is traced using the above
     mentioned  proc tools. Because of this, stopping a UNIX pro-
     cess in a production environment should be avoided.

     A process being stopped by these tools can be identified  by
     issuing  /usr/bin/ps  -eflL and looking for "T" in the first
     column. Notice that certain processes, for example  "sched",
     can show the "T" status by default most of the time.

SunOS 5.10          Last change: 11 Oct 2005                    6

 

 

 

 

1. 系统
# passwd:修改口令
# exit:退出系统
2. 文件
# cp:复制文件或目录,参数:-a递归目录,-i覆盖确认
# mv:改名移动
# rm:删除,参数:-r递归删除
3. 目录
# mkdir:创建目录
# rmdir:删除空目录
# cd:改变工作目录
# pwd:查看当前路径
# ls:列目录,参数:-a所有文件,-c按时间排序,-l详细信息--没有ll
4. 文本
# sort:排序
# uniq:删除重复行
5. 备份压缩
# tar:档案,参数:-c创建新档案,-r追加到末尾,-t列出档案内容,-u更新文件,-x释放文件,-f使用档案文件或设备,-M多卷,-v详细报告,-w每步确认。例tar cvf text.tar *.txt
++++++++++++++++++++++++++++++++
在 Linux 的环境里tar是新的,符合GUN,因此可以在 tar的參數加上 z 会自动呼叫gzip
但如果在某些 unix 如sunos 其tar就无法呼叫gzip,因此如果同样一个abc.tar.gz 压缩文档,要分二次解。
gzip -d abc.tar.gz 解开 .gz 会产生abc.tar 再执行
tar vxf abc.tar 就会再解开abc.tar全部了。
++++++++++++++++++++++++++++++++
# gzip:压缩解压缩,参数:-d解压,-r递归压缩
# unzip:解压缩,参数:-d目录,-x解压缩
6. 权限
# chmod:改变权限,r可读,w可写,x可执行。0表示没有权限,1表示可执行权限,2表示可写权限,4表示可读权限,然后将其相加。例如,如果想让某个文件的属主有“读/写”二种权限,需要把4(可读)+2(可写)=6(读/写)。
# chgrp:改变所属用户组
# chown:改变属主
7. 管理
# wall:发送信息到全部登录用户
# write:向某个用户发送信息
# mesg y:设定允许别人给自己发送信息
# sync:缓存同步校验
# shutdown:关机,参数:-r重启,-h关机不重启,-f快速关机,-c取消关机
# free:查看内存
# uptime:显示系统运行时间
# df:磁盘占用空间,参数:-a显示所有文件系统
# du:磁盘使用情况
# dd:拷贝并格式转换
# fdformat:低格软盘
# echo:显示文字
# cal:日历
# date:系统日期和时间
# clear:清屏
8. 我的回忆 by tom2sun
# who:查看当前用户
# finger:查看其他用户信息
# rlogin:远程登录
# rcp:远程复制
# netstat:网络状态
# cat:一次完全显示
# more:分屏显示
# file:列出文件类型
# grep:查找内容
# find:查找文件
# ps:当前运行程序,参数-a显示所有进程
# at:时间,命令,Ctrl+D结束
# lp:打印
# nice:指定优先级
# renice:调整优先级
# kill:终止进程
# man:获取命令帮助
# touch:改变时间记录
# ln:链接
# mount -t vfat /dev/hda1 /mnt/dos:挂载Dos分区(不适用于Unix-Center)
9. FTP
# ftp:启动FTP程序
ftp>
open:打开
close:关闭
bye:离开
get:下载
put:上传
mget/mput:多个文件下载/上传
reget:恢复下载
binary:二进制传送文件
ascii:ASCII码传送
cd:改变远程目录
lcd:改变本地目录
mkdir:建目录
rmdir:删除目录
delete:删除文件
mdelete:一次删除多个
rename:重命名
status:显示状态
prompt:交互式
hash:每传送1024字节显示#(hash)
size:显示文件大小
reset:重置
10. vi
a,i:进入输入状态
ESC:返回命令状态
:命令模式
Q!:退出
11. 快键及其他
Alt+F1~F6:访问多个虚拟控制台(不适用于Unix-Center)
Tab:命令补全
末尾&:后台进程
----------------------------------------
硬件系统:
1、如何查看cpu的状态?                  
# psrinfo -v
# mpstat     可以列出多cpu负载的状态
2、如何查看内存?                       
# prtconf | grep 'Memory' 可以查看内存的多少.
# /usr/platform/sun4u/sbin/prtdiag
3、如何动态添加swap分区? # $su - root                                  -----  成为超级用户
# mkfile 100m /home/swapfile         -----  创建100m的Swap文件
# /usr/sbin/swap -a /path/filename  -----  激活Swap文件
# /usr/sbin/swap -l                 -----  验证swap文件
# /usr/sbin/swap -d /path/filename  -----  取消swap文件
# rm -rf /home/swapfile              -----  删除swap文件
4、如何查看当前网卡是以何种速率起来的?    
# dmesg |grep Link
5、如何调整x-window的分辨率和刷新频率?
  字符界面登陆,运行:#/kdmconfig
6、如何使用光、软驱?
一般情况下用:
# /etc/init.d/volmgt start
# volcheck
以上方法不行,用:
# /etc/init.d/volmgt stop
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom --挂接光驱
# mount -F pcfs /dev/diskette0 /floppy         --挂接软驱
solaris定义系统磁盘文件系统说明:
ufs – UNIX文件系统。是Solaris缺省的文件系统。
hsfs – 高密度CD-ROM文件系统,是只读文件系统。
pcfs – PC文件系统,支持DOS格式化的软盘
7、SCSI设备的命名规则是什么?
带有总线控制器的硬盘的使用,下面列出了总线控制器的硬盘命名习惯:
cWtXdYsZ
c Logical controller number
t Physical bus target number
d Drive number
s Slice (or partition) number (0 to 7)
例如:
/dev/rdsk/c0t0d0s0 该原始接口对应第一个控制器的第一个SCSI目标地址的第一个硬盘的第一片(根)
/dev/rdsk/c0t0d0s2 该原始接口对应第一个控制器的第一个SCSI目标地址上的第一个硬盘的第三片(表示整上硬盘)
8、如何查看硬盘的使用情况?                         
# df -k      可以看到已安装的文件系统的空间大小及剩余空间大小。
# quota -v       查看用户的磁盘空间信息,如果你用quota限制了用户空间大小的话。
# du -sk *   查看目录的使用情况
# du -k | sort -n  可以迅速发现那个目录是最大的。
9、如何查看硬盘物理信息?
# format       这个命令也可以查看硬盘的类型和分区的详细情况
# iostat -E看硬盘的大小和型号
# prtvtoc /dev/rdsk/c0t0d0s0   显示某个磁盘的分区状况
10、查看系统内核命令。                           
  # isainfo        看内核的bit,
  # isainfo -kv      调整内核
# modinfo          显示可载入的模组
# prtconf          显示系统硬件配置(周边设备)
#sysdef           显示可载入的模组,硬件配置与一些可以调整的核心参考值
#ulimit -a
11、打印当前的OBP版本号                          
# prtconf –V
OBP 3.20.0 2000/10/24 10:47
# /usr/platform/sun4u/sbin/prtdiag –v | grep OBP
OBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49
ok. .version
Release 3.20 Version 0 created 2000/10/24 10:47
OBP 3.20.0 2000/10/24 10:47
POST 6.1.0 2000/10/24 10:49
OBDIAG 4.5.1 2000/10/24 10:48
12、查看及启动系统的32位或64位内核模式                      
64位模式
# isalist –v
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
# isainfo –v
64-bit sparcv9 applications
32-bit sparc applications
# isainfo –b
64
启动64位内核模式
ok. boot kernel/sparcv9/unix
32位模式
# isalist –v
sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
# isainfo –v
32-bit sparc applications
# isainfo –b
32
启动32位模式
ok. boot kernel/unix
13、测定当前的显示器刷新频率
# /usr/sbin/fbconfig –rev /?
14、如何配置网卡ip?
# ifconfig -a             --查看网卡,例如是hme0
# ifconfig hme0  unplumb  --停止网卡
# ifconfig hme0  plumb    --起用网卡
# ifconfig hme0 inet 192.168.2.3 netmask 255.255.255.0 up  --添加ip、子网掩码
# vi /etc/defaultrouter   添加默认路由的ip
# vi /etc/hostname.hme0   添加主机名
# vi /etc/nodename        添加主机名
# vi /etc/resolv.conf    
   domain china.com          你的域名
   nameserver 202.106.0.20   你使用的nds ip
# vi /etc/nsswitch.conf     更改 hosts:file dns
15、 PROM状态命令与参数
格式:  OK>; 指令
       命令        说明
banner                     显示当前机器配置状况,CPU,内存,hostid,EtherNet
probe-scsi                 显示内部SCSI通道所挂接设备
probe-scsi-all             显示所有SCSI通道及所挂接设备
probe-ide                  显示所有IDE通道及所挂接设备(针对U10,U5)
dias                   显示设备别名,如 cdrom,disk,disk0,disk1等
printenv                   无参数,显示环境变量或
                                    参数为环境变量名 如: printenv auto-boot?
setenv                     设置环境变量,如: setenv auto-boot? false
set-default                恢复环境变量预定值  如:set-default auto-boot?
set-defaults               恢复所有环境变量预定值
boot device option        启动主机
                        设备别名:  cdrom 或 disk
                        设备名:   /pci@1f,4000/scsi@3,1/disk@6,0:f
                        option  -r  设备配置
                                -s  单用户
eject cdrom|floppy         弹出cdrom或floppy
reset                         复位
test net       
watch-net-all       
show-devs       
16、查找网卡名称及接口个数                           
# grep network /etc/path_to_inst
17、如何一块网卡帮定三个ip,并且子网掩码不同?
举例说明,网卡名hme0:
# vi /etc/hosts
127.0.0.1 localhost
192.168.2.1 dbs loghost
192.168.9.15 dd
192.168.9.65 aa
# vi /etc/netmasks
192.168.2.0 255.255.255.0
192.168.9.0 255.255.255.192
192.168.9.64 255.255.255.252
#vi /etc/hostname.hme0
dbs
#vi /etc/hostname.hme0:1
dd
#vi /etc/hostname.hme0:2
aa
# ipconfig hme0 inet 192.168.2..1 netmask 255.255.255.0 up
# ipconfig hme0:1inet 192.168.9.15 netmask 255.255.255.192 up
# ipconfig hme0 inet 192.168.9.65 netmask 255.255.255.252 up
# init 6
#ipconfig -a
18、如何在prom状态下查看光纤硬盘 ?  
stop +a进入ok状态:
ok>; select 光纤卡设备名(可用show-devs查看到)
ok>; show-children
19、主机双屏幕设置。         
1.Confirm there are two Video Cards。
2.Confirm driver installed and patches installed if need。
3.vi /usr/dt/config/Xservers.
comment the last line.
and uncomment the nearest line like this.
4.reboot.
20、查看硬盘参数及其物理地址:
#format </dev/null
21、显示磁盘的分区情况:
#prtvtoc /dev/rdsk/c0t0d0s2
系统应用:
1、、查看系统运行级别
# who -r 看运行级别
2、进程工具                
pstop pid  停止进程
prun pid  重新启动进程
ptime pid  使用微状态计算进程时间
pwait pid  等待指定的进程终止
pcred pid 显示可信度    *
pfiles pid 显示已打开文件的fstat和fcntl信息   *
pflags pid 显示每个lwp的/proc跟踪标志,等待和待有信号量以及其他状态信息  *
pldd  pid 显示链接到每个进程的动态链接库   *
pmap pid  显示地址映射空间   *
psig pid 显示信号操作    *
pstack pid 显示每个lwp的十六进制与符号堆跟踪   *
ptree pid 显示包含指定PID的进程树
pwdx  pid 显示当前工作目录   *
后面加*的必须是超级用户执行。
这些工具在/usr/proc/bin/里面。
3、patch软件包的安装
每个补丁都有编号。例如补丁号为101945,版本是34的话,这个补丁的目录名就是101945-34.
# patchadd 105160-01     安装补丁
# patchrm                删除补丁
# patchadd -p            检查系统的补丁情况
# showrev -p             查看所有已经安装的patch
4、如何容许root用户远程登录?
  # vi /etc/default/login
  CONSOLE=/dev/console  ---用#注释掉这一行。
5、如何限定telnet登陆数?solaris pts的数量缺省为47, 修改/etc/system文件,增加如下内容:
set maxusers=数量
set pt_cnt=数量
6、显示已经使用和未使用的i-node数目         
# df –F ufs –o i
7、显示cpu使用率最高的进程                   
# ps –eo pid,pcpu,args | sort +1n
该命令输出当前系统进程的pid, CPU占用率及命令描述,并以pcpu来排序
8、查看当前的OpenWindows版本                   
# showrev –w
OpenWindows version:
X11 Version 6.4.1 5 November 2001
9、查看当前CDE的版本                               
# /usr/ccs/bin/what /usr/dt/bin/dtmail
/usr/dt/bin/dtmail:
CDE Version 1.4.6_06
CDEVersion1.4.6_06
10、文消掉本中的^M
# cat test.dat | tr -d '/015' >; test.out
这样可以将 test.dat 内 ^M(/015) 这个字元去掉, 产生 test.out
11、关机命令。
关闭系统的方式根据关闭的原因而不同.执行关闭有的是为了转至执行等级S,有的是要停止操作系统并关闭设备的电源.
(1) /usr/sbin/shutdown –gtime –ilevel -y
(2) init 0
(3) halt
(4) STOP+A ; sync
(5) 关闭电源
紧急情况,按Stop_A , 如Stop_A不起作用,则将设备电源关闭再打开.这是
极端情况.这两种方法不是干净的关闭,是突然关闭的,仅在紧急情况使用.
12、Solaris下怎么发送即时消息?
用wirte命令到单个用户的终端。
$ wirte username
输入消息正文,结束按ctrl-d,消息就会出现在用户终端。
用户可以用mesg n[y]来决定是否启动接受消息。
用wall,是发给所有系统用户。
$ wall
hello ,i love you ...... 结束用ctrl-D.
rwall -n netgroup 给网络上所有用户。
$ rwall -n workgroup --------发给组workgroup下的每一个用户
hi ! no smoking ...... 结束用ctrl -d
$ rwall sune450 ------或者主机名为sune450。用法如上。。。
13、系统是sunos5.8, 不知何种原因现在唯一的普通用户起不了Terminal, vi等,但是超级用户可以,如何补救?          
   用/etc/skel/local.cshrc 替换掉登陆路径下的 .cshrc, 重新登陆, 就OK了!
$cp /etc/skel/local.cshrc ./
14、关机时这个题是什么意思?            
/usr/sbin/vold[724]: [ID 244572 daemon.error] 卸载 /vol 时发生问题;中断系统调用
uxwdog[481]: [ID 248799 daemon.error] error communicating with server (Broken pipe)
你还没卸下来/VOL就启动,才出问题,运行:
# umount -f /vol后再做。
15、find常用的例子:
命令格式: find dir -name filename command
例子:
# find . -name hello -print         寻找目前目录及所有的子目录内叫hello的文档。
# find . -ctime +7 -print            找出七天内未被更动的文档
# find . -size +2000m -print         找出大小超过2000 bytes的文档
# find /tmp -user b1234567 -print    在/tmp下属於b1234567的文档
# find . -name '*.c' -exec rm {}     删除所有的.c档
# find . -name test/* -print         显示当前目录及其子目录文件名前4位为test的文件名
16、忘记solarsi的root口令怎么办?               
方法一:
1.别怕 ,跟我来.
2.把你的solaris光盘放进cdrom
3.键入stop+a
4.当出现'ok'字样时,键入boot cdrom -s
5.cd /tmp
6.mkdir /tmp/xxx (xxx是什么鬼东西就无关紧要了)
7.mount /dev/dsk/c0t0d0s0 /tmp/xxx (在这里c0t0d0s0是你的root盘)
8.运行csh
9.TERM=sun;export TERM或者
setenv TERM vt220
10.cp /tmp/root/xxx/shadow /tmp/root/xxx/shadow/shadow.backup
11.vi /tmp/root/xxx/shadow并且将password里root项删除。
12.重启动,你就可以以无密码的root登陆了,这时更改你的密码。
要是没有shadow,就把/etc/passwd里root用户名后面的X删掉,就可以了
方法二:
找一台有系统的solaris机器,把忘记密码的系统放进去mount上来,重复方法一10以后的步骤.
solaris for x86的机器:
用光盘启动到要你安装的时候退出去就成单用户,剩下的操作如上。
17、常见文件的解压                   
一般而言,在solaris下,会有这么几种格式的软件:
1) .gz结尾的文件,我们用gunzip或者gzip -d来解压,再用tar来解压.
2) .tar结尾的文件,我们肯定知道用tar xvf的格式来解压.
3) .zip结尾的文件,我们用unzip,注意,这个只有在高版本的solaris下,才有.而且该文件格式以solaris的patch比较多.
4) .Z结尾的文件,我们一般用uncompress来解压(当然,每个人的习惯不一样.)
上面讲的是解压,一般解压后,会生成这么几种方式:
1)生成.local的文件,这个时候,我们用: pkgadd -d xxx.local来安装.
2) 生成一个目录,而且该目录下会有一些pkg信息,我们用: pkgadd -d . ;指在当前目录下,安装,并且按照缺省的路径来安装.
3) 生成一个数字的目录,一般是指solaris的patch,这个时候我们用patchadd来安装.
18、如何在命令行界面替换一个文件中的字符段?
# vi file 在命令模式中输入:
:1, $s/diag/peng/g 全文件查找diag并替换为peng
19、请问TERM=VT100和TERM=dtterm都在什么情况下设置?   
一般情况下如果你在机器的显示器上登陆或者通过XMANAGER等登陆,就默认是dtterm,telnet 一般是ansi,当你通过telnet修改文件的时候,需要设置成 TERM = VT100 ; export
TERM
20、如何查看系统的版本?
$ uname -X
$ more /etc/release
21、命令行进入CDE:
#/usr/dt/bin/dtlogin -daemon;exit
or
#/etc/rc2.d/S92dtlogin start;exit;
22、查看patch安装过程中返回错误代码的含义:
#more /usr/sbin/patchadd
23、如何从一台SOL8的机器登录到另外一台SOL8的CDE桌面上去。
登陆CDE的时候点击一下菜单:选择--登陆远程主机--
24、如何查看你的默认语言环境?    C.Arthur
# more /etc/default/init
25、如何更改/home的权限?   
停掉autofs服务,或者将/etc/auto_master的home注释掉:
#vi /etc/auto_master  
------------内容如下----------
# Master map for automounter
#
+auto_master
/net -hosts -nosuid,nobrowse
#/home auto_home -nobrowse
/xfn -xfn
第三方软件应用或技巧:
1、查看当前的bind版本信息                     
# nslookup –class=chaos –q=txt version.bind
2、在登录时显示系统指定的消息?
#vi /etc/motd    ----删除所有过时的消息,输入新消息
注意:对于已经登录且正在使用系统的用户不显示该消息,超过一屏的消息无法显示。每次修改该文件后,该文件的时间戳随之更新。
3、去掉文本中^M
# dos2unix aaa.txt bbb.txt,会去掉aaa.txt中的^M,生成bbb.txt文件。
4、将系统中7天前的txt文件查找并打包。
# find / -mtime -7 >;aaa.txt
# tar cvf bbb.tar -I aaa.txt
---查找出文件记录在aaa.txt文件中,在作成bbb.tar文件包。
5、查找并删除比某一天更老的文件:
#find . ! -mtime -<days>; | /usr/bin/xarys rn -rf
6、solaris9普通用户下无法正确输入中文的解决方法:
在用户目录在#vi .profile 修改如下:
stty cs8 -istrip
7、请问如何防止telnet登陆发呆时间过长被踢呢?
这里,vi /etc/default/login
# TIMEOUT sets the number of seconds (between 0 and 900) to wait before
# abandoning a login session.
#
#TIMEOUT=300
修改之后不是立即生效,在这之后所又的login session都符合这个要求,但是在修改之前已经建立的连接不受影响。
8、如何安装gcc。
去sunfreeware.com上下载相应平台的pkg包的gcc版本。
#pkgadd -d gcc*
设置环境变量:
bash 和sh 的shell:
vi $home/.profiel
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/etc:/usr/local/bin:/usr/ccs/bin;export PATH
CC=gcc;export CC
csh的shell:
vi $home/.cshrc
set path=( /bin /usr/bin /usr/ucb /etc /usr/local/bin /usr/local/sbin .)
setenv CC gcc
9、列出当前目录下的目录。  
ls -al | grep '^d'
10、用命令行来打开一个新的terminal。
/usr/dt/bin/dtterm
X86或者Vmware:
1、在Solaris10 x86上挂接window98分区的方法。     
#mount -F pcfs /dev/dsk/c0d1p0:e /mnt
总结一下:
偶的硬盘是接在IDE1的slaver盘上,用上述命令可将E:盘挂在/mnt
目录下。如果你的电脑只有一个硬盘,并且是接在主板的IDE1槽,设为
Master盘(通常这种情况较多),现在想挂WIN98下的D:盘,可输入
#mount -F pcfs /dev/dsk/c0d0p0:d /mnt
注意,/mnt可以改为任意的其它空目录,如/data(我在文件管理器中自己
新建的一个目录),可改为
#mount -F pcfs /dev/dsk/c0d0p0:d /data
按回车后如没有任何出错提示,则表示挂接成功,你就可以进入挂接的文件夹(此处为/data)找到你所挂接的win98的D:分区上的文件了。
本方法经过偶N次实验,是确实可行的。为后来者不再偶走过的弯路,偶特在此总结一下,哪位初学者不会在Solaris10 x86(Solaris9也应该行)
挂win98分区的话,可参考本方法。
export LANG=zh_CN.GB18030
查看安装的Solaris版本?
cat /etc/release
看进程
如果未安装top,Soralis下可用prstat代替!a
prstat
/opt/vulcan/temp/
pkgadd -d top-3.6.1-sol10-sparc-local

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值