Shell Startup Files
http://www.science.uva.nl/research/air/wiki/ShellStartupFiles
OBP printenv
ok printenv
Variable Name Value Default Value
test-args
diag-passes 1 1
pci-probe-list c,8,d,5,13 c,8,d,5,13
local-mac-address? false false
fcode-debug? false false
silent-mode? false false
scsi-initiator-id 7 7
oem-logo No default
oem-logo? false false
oem-banner No default
oem-banner? false false
ansi-terminal? true true
screen-#columns 80 80
screen-#rows 34 34
ttyb-rts-dtr-off false false
ttyb-ignore-cd true true
ttya-rts-dtr-off false false
ttya-ignore-cd true true
ttyb-mode 9600,8,n,1,- 9600,8,n,1,-
ttya-mode 9600,8,n,1,- 9600,8,n,1,-
output-device screen screen
input-device keyboard keyboard
load-base 16384 16384
auto-boot? false true
boot-command boot boot
diag-file
diag-device net net
boot-file
boot-device disk disk net
use-nvramrc? false false
nvramrc
security-mode none No default
security-password No default
security-#badlogins 0 No default
diag-script none none
diag-level min max
diag-switch? false false
error-reset-recovery boot boot
ok
Sys Admin Pocket Survival Guide - Solaris
http://www.cs.fiu.edu/~tho01/psg/sol.html
Solaris 9 x86 u7 Installation for vmware
http://www.douzhe.com/docs/vmware/
Solaris SPARC Boot Sequence
Solaris SPARC Boot Sequence
The following represents a summary of the boot process for a Solaris 2.x system on Sparc hardware.
Power On : Depending on the system involved, you may see some output on a serial terminal immediately after power on. This may take the form of a Hardware Power ON message on a large Enterprise server, or a "'" or "," in the case of an older Ultra system. These indications will not be present on a monitor connected directly to the server.
POST : If the PROM diag-switch? parameter is set to true, output from the POST (Power On Self Test) will be viewable on a serial terminal. The PROM diag-level parameter determines the extent of the POST tests. (See the Hardware Diagnostics page for more information on these settings.) If a serial terminal is not connected, a prtdiag -v will show the results of the POST once the system has booted. If a keyboard is connected, it will beep and the keyboard lights will flash during POST. If the POST fails, an error indication may be displayed following the failure.
Init System : The "Init System" process can be broken down into several discrete parts:
OBP : If diag-switch? is set, an Entering OBP message will be seen on a serial terminal. The MMU (memory management unit) is enabled.
NVRAM : If use-nvramrc? is set to true, read the NVRAMRC. This may contain information about boot devices, especially where the boot disk has been encapsulated with VxVM or DiskSuite.
Probe All : This includes checking for SCSI or other disk drives and devices.
Install Console : At this point, a directly connected monitor and keyboard will become active, or the serial port will become the system console access. If a keyboard is connected to the system, the lights will flash again during this step.
Banner : The PROM banner will be displayed. This banner includes a logo, system type, PROM revision level, the ethernet address, and the hostid.
Create Device Tree : The hardware device tree will be built. This device tree can be explored using PROM monitor commands at the ok> prompt, or by using prtconf once the system has been booted.
Extended Diagnostics : If diag-switch? and diag-level are set, additional diagnostics will appear on the system console.
auto-boot?: If the auto-boot? PROM parameter is set, the boot process will begin. Otherwise, the system will drop to the ok> PROM monitor prompt, or (if sunmon-compat? and security-mode are set) the > security prompt.
The boot process will use the boot-device and boot-file PROM parameters unless diag-switch? is set. In this case, the boot process will use the diag-device and diag-file.
bootblk : The OBP (Open Boot PROM) program loads the bootblk primary boot program from the boot-device (or diag-device, if diag-switch? is set). If the bootblk is not present or needs to be regenerated, it can be installed by running the installboot command after booting from a CDROM or the network. A copy of the bootblk is available at /usr/platform/`arch -k`/lib/fs/ufs/bootblk
ufsboot : The secondary boot program, /platform/`arch -k`/ufsboot is run. This program loads the kernel core image files. If this file is corrupted or missing, a bootblk: can't find the boot program or similar error message will be returned.
kernel : The kernel is loaded and run. For 32-bit Solaris systems, the relevant files are:
/platform/`arch -k`/kernel/unix
/kernel/genunix
For 64-bit Solaris systems, the files are:
/platform/`arch -k`/kernel/sparcV9/unix
/kernel/genunix
As part of the kernel loading process, the kernel banner is displayed to the screen. This includes the kernel version number (including patch level, if appropriate) and the copyright notice.
The kernel initializes itself and begins loading modules, reading the files with the ufsboot program until it has loaded enough modules to mount the root filesystem itself. At that point, ufsboot is unmapped and the kernel uses its own drivers. If the system complains about not being able to write to the root filesystem, it is stuck in this part of the boot process.
The boot -a command singlesteps through this portion of the boot process. This can be a useful diagnostic procedure if the kernel is not loading properly.
/etc/system: The /etc/system file is read by the kernel, and the system parameters are set.
The following types of customization are available in the /etc/system file:
moddir : Changes path of kernel modules.
forceload : Forces loading of a kernel module.
exclude : Excludes a particular kernel module.
rootfs : Specify the system type for the root file system. (ufs is the default.)
rootdev : Specify the physical device path for root.
set : Set the value of a tuneable system parameter.
If the /etc/system file is edited, it is strongly recommended that a copy of the working file be made to a well-known location. In the event that the new /etc/system file renders the system unbootable, it might be possible to bring the system up with a boot -a command that specifies the old file. If this has not been done, the system may need to be booted from CD or network so that the file can be mounted and edited.
kernel initialized : The kernel creates PID 0 ( sched). The sched process is sometimes called the "swapper."
init : The kernel starts PID 1 (init).
init: The init process reads the /etc/inittab and /etc/default/init and follows the instructions in those files.
Some of the entries in the /etc/inittab are:
fs : sysinit (usually /etc/rcS)
is : default init level (usually 3, sometimes 2)
s# : script associated with a run level (usually /sbin/rc#)
rc scripts : The rc scripts execute the files in the /etc/rc#.d directories. They are run by the /sbin/rc# scripts, each of which corresponds to a run level .
Debugging can often be done on these scripts by adding echo lines to a script to print either a "I got this far" message or to print out the value of a problematic variable.
solaris迅速查找
硬件系统:
1、如何查看cup的状态? 作者:南非蜘蛛
# 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版本号 作者:gunguymadman007
# 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位内核模式 作者:gunguymadman007
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)
devalias 显示设备别名,如 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、主机双屏幕设置。 作者:iricyan
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
21、显示磁盘的分区情况
#prtvtoc /dev/rdsk/c0t0d0s2
系统应用:
1、、查看系统运行级别
# who -r 看运行级别
2、进程工具 作者:e4gle
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数目 作者:gunguymadman007
# df –F ufs –o i
7、显示cpu使用率最高的进程 作者:gunguymadman007
# ps –eo pid,pcpu,args | sort +1n
该命令输出当前系统进程的pid, CPU占用率及命令描述,并以pcpu来排序
8、查看当前的OpenWindows版本 作者:gunguymadman007
# showrev –w
OpenWindows version:
X11 Version 6.4.1 5 November 2001
9、查看当前CDE的版本 作者:gunguymadman007
# /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 '15' >; test.out
这样可以将 test.dat 内 ^M(15) 这个字元去掉, 产生 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等,但是超级用户可以,如何补救? 作者:kesin
用/etc/skel/local.cshrc 替换掉登陆路径下的 .cshrc, 重新登陆, 就OK了!
$cp /etc/skel/local.cshrc ./
14、关机时这个题是什么意思? 作者:sunmarmot
/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都在什么情况下设置? 作者:C.Arthur
一般情况下如果你在机器的显示器上登陆或者通过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、如何查看默认语言环境
# more /etc/default/init
25、如何更改/home的权限 作者: xieliangcheng
停掉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版本信息 作者:gunguymadman007
# 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 -; | /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、列出当前目录下的目录 作者:brucewoo
ls -al | grep '^d'
10、用命令行来打开一个新的terminal 作者:beginner-bj
/usr/dt/bin/dtterm
X86或者Vmware:
1、在Solaris10 x86上挂接window98分区的方法。 作者:k338
#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分区的话,可参考本方法。
添加一个逻辑借口
ifconfig hme0 addif 10.5.0.120 netmask 255.255.0.0
使用配置文件配置,重起后不消失
先使用ifconfig配置
#ifconfig hme0:1 plumb *.*.*.* up permanence
1.vi /etc/hosts
加入
10.0.128.217 register loghost
-〉202.96.232.10 register1 loghost
2.vi /etc/hostname.hme0:1
加入主机名 register1
3.vi /etc/netmasks
加入虚拟接口ip的netmask
202.96.232.10 255.255.255.0
4.reboot
我也顶一把
写大文件系统
newfs -f 8192 -i 16384 /dev/rdsk/c0t0d0s0
truss -d 和 truss -D (Solaris >;= 8):这两个选项表明与truss显示的每个系统调用相关的时间信息
truss -T:这是个很棒的调式帮助选项。在执行指定的系统调用时,它可以终止进程("-U"也执行同样的操作,不过是在进行用户级的函数调用时)。此时,将会获取用于进一步分析的 core 文件,或者使用一些 /proc 工具来确定进程各个方面的状态。
truss -l(在 Solaris 9 中已改进):显示多线程进程中每个调用的线程号。Solaris 9 中的 truss -l 经过了改进,最后还可以监视多线程的应用程序的执行。
Truss 的确是个功能强大的工具。例如,可在 core 文件中用于分析问题产生的原因。还可以通过"-u"选项来显示用户级的库(既可以为系统库,也可为程序员库)调用的详细信息。
pkg-ge:这是个用于自动获取免费软件包的好工具(http://www.bolthole.com/solaris)。它通过 /etc/pkg-get.conf 来配置。一旦配置好并运行后,就运行 pkg-get -a 来获取可用包的列表以及运行 pkg-get -I 来获取并安装给定的包。
Plimit (Solaris >;= 8):这个命令用于显示并设置正在运行的进程中的每个进程的限制。如果一个长时间运行的进程超过了某个限制(如打开的文件数目),使用该命令就十分方便。因为无须使用 limit 命令后重新运行该进程,plimit 就可以修改正在运行的进程。
coreadm (Solaris >;= 8):在以前没有 coreadm 命令时,core dumps 被置于进程的工作目录下。并且 core 文件将会互相覆盖。而这个问题和其他更多问题都可以由 coreadm 来处理,它是一个管理 core 文件生成的工具。您可以通过该工具指定是否保存 core、core存储的位置和应保留的版本数目,等等。所有这些设置信息都是在重启前通过 coreadm 修改 /etc/coreadm.conf 来保存的。
pgrep (Solaris >;= 8):pgrep 在 /proc 中搜索符合给定规则的进程,并返回进程的 ID。其中一个很棒的选项是"-n",它返回的是最新的满足条件的进程号。
preap (Solaris >;= 9):除去僵尸进程。任何困于"z"状态(由 ps 命令显示)的进程,该命令都可将之从系统中清除。
pargs (Solaris >;= 9):显示进程的参数及环境变量。
nohup -p (Solaris >;= 9):nohup 命令可以用于启动一个进程,因此即使用于启动进程的 shell 被关闭(即进程获得"SIGHUP"信号),该进程仍然可以继续运行。这对于让一个后台任务不管碰到何种情况仍然可以继续运行是很有用的。但是如果您已经启动了一个进程,但稍后希望使它免受 HUP 信号的影响,该怎么办呢?在Solaris 9中, nohup -p 可以获取进程 ID 并使之忽略 SIGHUP 信号。
prstat (Solaris >;= 8):prstat 也是 top 命令,但拥有更多功能。这两个命令都可以提供一个屏幕的关于进程的有用信息以及其他的相关信息,并且能频繁地更新,总之是个很棒的显示系统性能的窗口。但 prstat 要比 top 更加精确。它还提供了一些很好的选项。"-a"可以同时显示进程与用户的信息(默认由 CPU hog 排序)。"-c"使其执行很像 vmstat(在前一个报告下面接着显示新的报告)。"-C"显示在处理器集中的进程。"-j"显示一个"工程"中的进程。"-L"显示每个线程和每个进程的信息。"-m"和"-v"显示每个进程的很多详细的性能信息(包括 pages、traps、lock wait 和 CPU wait)。所有输出数据都可以按照在内存中设置的大小、虚拟内存大小、运行时间等等条件来排列。prstat 在没有 top 的系统中是个十分有用的工具,并且由于它的精确性,所以很可能取代 top(有些地方考虑到它是个被支持的程序而使用它)。
trapstat (Solaris >;= 9):trapstat 以及 lockstat 和 kstat 是 Solaris 中最难以理解的命令。它们显示一个运行的操作系统内部中最具体的细节信息。每个命令对于解决 Solaris 系统中发生的古怪问题都是必不可少的。最好是将它们的输出随错误报告一起提交,但进一步的研究揭示,它们也能为一般应用提供有用信息。
vmstat -p (Solaris >;= 8):在这个选项可以使用之前,要确定是哪种类型的内存命令导致系统页面调度几乎是不可能的(请查阅"se toolkit")。vmstat -p 可以解决此问题,因为它不但显示您的系统是否处于内存紧缺的情况(通过"sr"栏),而且还显示是否是由以下内容导致的:应用程序的代码,应用程序的数据或 I/O 。"-p"能够真正帮助找出 Solaris 中导致神秘的内存问题的原因。
pmap -x (Solaris >;= 8,Solaris >;= 9中进行了错误修复):如果已经得知进程中有内存问题,并且需要获得更多内存使用的详细信息,就可以使用 pmap -x。该命令将解释指定 ID 的目标进程的整个内存映射信息
df -h (Solaris >;= 9):这个命令在 Linux 上已经应用十分普遍,刚刚转移到了 Solaris 平台。df -h 以一种方便阅读的形式显示文件系统的概要信息
硬件安装
用D240的光驱安装软件,一般需要更改默认的cdrom 别名。
ID 不再是6,是4。
ok boot /ssm@0,0/pci@18,700000/pci@1/SUNW,isptwo@4/sd@4,0:f
or
ok nvalias dvd /ssm@0,0/pci@18,700000/pci@1/SUNW,isptwo@4/
sd@4,0:f
ok boot dvd
把系统根盘c1t0和备份盘c1t1两块磁盘的分区设置为完全一样为例:
# prtvtoc /dev/rdsk/c1t0d0s2 | fmthard –s - /dev/rdsk/c1t1d0s2
这样就保证c1t1d0的分区和c1t0d0的分区完全一致。
prtdiag命令查看系统的资源配置,可以得到比uname命令更多的信息!
在ok状态下,可以用probe-scsi-all查看机器的相关的scsi硬件配置!
用pgrep 进程名,可查找当前运行进程的进程号,用pkill命令可以杀死不想运行的进程,如果杀不死,用kill -9 ,如果还杀不死,只有reboot了。
在vi下,^M的键入方法为;CTRL+V+M!
如何才能解开.tgz或.tar.gz文件?
· gzip -d filename.tar.gz/filename.tgz
· tar -xvf filename.tar
ipcs命令显示活动的消息队列、共享内存和系统信号量的状态。当进程出现与共享内存有关的错误时,可用ipcs –a进行查找,看看是哪一个进程占用了大量的共享内存,然后用ipcrm –m 进程ID号即可。另外在sun中,与共享内存相关的文件为/etc/system文件,可检查该文件,在该文件末尾有有关共享内存大小和段个数的设置。
设置Sun Solaris 双屏:
修改文件:/usr/dt/config/Xservers 在文件最后一行nobanner前将两图卡的设备加入,还要设24真彩色,例C3DC图卡:/dev/fbs/ffb0,/dev/fbs/ffb1,添加的内容如下:
:0 Local local_uid@console root /usr/openwin/bin/Xsn
:0 -dev /dev/fbs/ffb0 defdepth 24 -dev /dev/fbs/ffb1 defdepth 24 –nobanner
当你想要umount一个设备时,有人在用,设备无法umount。可以用
fuser -u /mount-point.看到谁在使用,然后杀之!!!!
-u 显示使用该设备的用户
-k 杀掉使用该设备的进程
另有一个方法可强制卸载文件系统:
#umount -f /mount_point
增加新硬盘,或移动槽位时
运行drvconfig;disks;devlink
可以重新更新设备文件联结等
stty -echo 隐藏你输入的命令,不知道会吓一跳的
stty echo 恢复
Q:启动工作站时出现黑屏怎么办?
C&S:
Product:操作系统
Request class:SOLARIS
Security level:合作方
A:
在工作站正常状态下用“STOP+A”命令,有时可能会造成工作站PROM(相当于PC机的BIOS)参数错误。处理过程如下:
1)重开主机电源,用;+;组合键,显示器变亮、主机不闪烁,系统正常重启;
2)在OK状态键入命令:
OK set env boot-device=disk
即设置PROM参数使系统以后启动从硬盘启动;
3)重启网管计算机,若显示器、主机和系统一切正常,则问题解决。
pkgmk 创建包目录
pkgadd 从包文件安装包
pkgtrans 将包目录转换为一个文件
pkgrm 卸载包
pkgchk 确认包有效
pkginfo 打印包的内容
168 Solaris commands
SysAdmin Commands
Debugging
truss executable
/* Trace doing of given command ( useful debugging ) */
truss -f -p
/* Using multiple windows, this can be used to trace setuid/setgid programs */
Arp, ethernet trouble shooting
arp -a .
/* Shows the ethernet address arp table */
arp -d myhost
/* Delete a stale ethernet entry for host myhost */
Disk Commands
du -k .
/* Reports disk space used in Kilobytes */
du -sk .
/* Reports only total disk space used in Kilobytes */
du -sk *|sort -k1,1n
/* Reports total disk space used in Kilobytes in present directory */
du -ad /var | sort -nr
/* Tells you how big the /var files are in reverse order */
fdformat -d -U
/* Format diskette */
/usr/bin/iostat -E
/* Command to display drives statistics */
/bin/mount -F hsfs -o ro /dev/sr0 /cdrom
/* Mount an ISO 9660 CDROM */
newfs -Nv /dev/rdsk/c0t0d0s1
/* To view the superfblocks available */
prtvtoc /dev/rdsk/c0t0d0s2
/* Disk geometry and partitioning info */
quot -af
/* How much space is used by users in kilobytes */
Driver Parameters
ndd /dev/ip \?
/* Shows IP variables in the kernel */
ndd /dev/ip ip_forwarding
/* Tells you if forwarding is on (=1) */
ndd -set /dev/ip ip_forwarding 1
/* Enables IP forwarding between interfaces */
File Manipulation
dos2unix | -ascii
/* Converts DOS file formats to Unix */
split
/* Split files into pieces */
[vi] : %s/existing/new/g
/* Search and Replace text in vi */
[vi] :set nu
/* Set line numbers in vi */
[vi] :set ts=[num]
/* Set tab stops in vi */
File System
cat /dev/null > filename
/* Zero's out the file without breaking pipe */
dd if=/dev/rdsk/... of=/dev/rdsk/... bs=4096
/* Make a mirror image of your boot disk */
df -k | grep dg| awk '{print $6}' |xargs -n 1 umount
/* Unmount all file systems in disk group dg */
fsck -F ufs /dev/rdsk/c0t0d0s0
/* Check a UFS filesystem on c0t0d0s0 */
fsck -F ufs -y /dev/rdsk/c0t0d0s0
/* Check answering yes to all questions */
fsck -F ufs -o b=97472 /dev/rdsk/c0t0d0s0
/* Check using an alternate super block */
gzip -dc file1.tar.gz | tar xf -
/* Unpack .tar.gz files in place */
gzip -d -c tarball.tgz | (cd /[dir];tar xf - ) &
/* Unpacking tarballs to diff location */
ln [-fhns]
/* Creating hard links and soft links */
ls -la | awk '{ print $5," ",$9 }' | sort -rn
/* File sizes of current directory */
mount -f pcfs /dev/dsk/c0d0p1 /export/dos
/* Mount DOS fdisk partition from Solaris */
mount -F ufs -o rw,remount /
/* Used to remount root to make it writeable */
mount -o remount,logging /spare
/* Re-mount the ro file system rw and turn on ufs logging */
pax -rw . /newdir
/* Efficient alternative for copying directories */
prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
/* Cloning Partitiontables */
tar cvf filename.tar
/* Create a tape (tar) archive */
tar xvf filename.tar
/* Extract a tape (tar) archive */
tar cf - . | (cd /newdir ; tar xf -)
/* Recursively copy files and their permissions */
/sbin/uadmin x x
/* Syncs File Systems and Reboots systems fast */
zcat [cpio file] | cpio -itmv
/* Show the contents of a compressed cpio */
zcat
/* Extract the patch_file that is a compressed tar file */
File Transfer
get filename.suffix |"tar xf -"
/* Undocumented Feature of FTP */
put "| tar cf - ." filename.tar
/* Undocumented Feature of FTP */
find . -depth | cpio -pdmv /path/tobe/copied/to
/* Fast alternative to cp -pr */
sendport
/* Transferring large numbers of files within the same ftp control session */
General
/usr/bin/catman -w
/* Create windex databases for man page directories */
FQ_FILENAME=; echo ${FQ_FILENAME%/*}
/* Extract directory from fully-qualified file name. */
mailx -H -u
/* List out mail headers for specified user */
set filec
/* Set file-completion for csh */
uuencode [filename] [filename] | mailx -s "Subject" [user to mail]
/* Send files as attachments */
Hardware
cfgadm
/* Verify reconfigurable hardware resources */
m64config -prconf
/* Print M64 hardware configuration */
m64config -depth 8|24
/* Sets the screen depth of your M64 graphics accelerator */
m64config -res 'video_mode'
/* Change the resolution of your M64 graphics accelerator */
Kernel
/usr/sbin/modinfo
/* Display kernel module information */
/usr/sbin/modload
/* Load a kernel module */
/usr/sbin/modunload -i
/* Unload a kernel module */
nm -x /dev/ksyms | grep OBJ | more
/* Tuneable kernel parameters */
/usr/sbin/sysdef
/* Show system kernal tunable details */
Memory
prtconf | grep Mem
/* Display Memory Size */
Network Information
ndd /dev/arp arp_cache_report
/* Prints ARP table in cache with IP and MAC address */
netstat -a | grep EST | wc -l
/* Displays number active established connections to the localhost */
netstat -k hme0
/* Undocumented netstat command */
netstat -i
/* Show the TCP/IP network interfaces */
netstat -np
/* Similar to arp -a without name resolution */
netstat -r
/* Show network route table */
netstat -rn
/* Displays routing information but bypasses hostname lookup. */
netstat -a | more
/* Show the state of all sockets */
traceroute
/* Follow the route to the ipaddress */
Network/Tuning
ifconfig eth0 mtu 1500
/* Change MTU of interface */
ifconfig eth0 10.1.1.1 netmask 255.255.255.255
/* Add an Interface */
/sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 255.255.0.0 broadcast 10.210.xxx.xxx
/* Virtual Interfaces */
/sbin/ifconfig hme0:1 up
/* Bring virtual interface up */
/usr/sbin/ndd -set /dev/hme adv_100fdx_cap 1
/* Nailling to 100Mbps */
ndd -set /dev/ip ip_addrs_per_if 1-8192
/* To set more than 256 virtual ip addresses. */
ndd -set /dev/tcp tcp_xmit_hiwat 65535
/* Increase TCP-transmitbuffers */
ndd -set /dev/tcp tcp_recv_hiwat 65535
/* Increase TCP-receivebuffers */
Processes
fuser -uc /var
/* Processes that are running from /var */
kill -HUP `ps -ef | grep [p]roccess | awk '{print $2}'`
/* HUP any related process in one step */
lsof -i TCP:25
/* Mapping port with process */
pfiles
/* Shows processes' current open files */
pkill -n
/* Kill a process by name */
kill `ps -ef | grep program_name | grep -v grep | cut -f8 -d ' '`
/* pkill for solaris 2.6 */
prstat -a
/* An alternative for top command */
/usr/ucb/ps -aux | more
/* Displays CPU % usage for each process in ascending order */
/usr/ucb/ps -auxww | grep
/* Gives the full listing of the process (long listing) */
ps -ef | grep -i | awk '{ print $2 }'
/* Creates list of running PID by */
ps -ef | grep -v "0:00" | more
/* Gives you a list of any process with CPU time more than 0:00 */
ps -ef | more
/* Show all processes running */
ps -eo pid,args
/* List processes in simplified format */
ps -fu oracle|grep pmon
/* See which instances of Oracle are running */
/usr/proc/bin/ptree
/* Print the parent/child process 'tree' of a process */
/usr/proc/bin/pwdx
/* Print the working directory of a process */
top -b 1
/* Returns the process utilizing the most cpu and quits */
Resource Management
/usr/bin/ldd [filename]
/* List the dynamic dependencies of executable files */
/usr/proc/bin/pmap pid
/* Report address space map a process occupies */
Route Configuration
route add net 128.50.0.0 128.50.1.6 1
/* Adds route to 128.50 network via 128.50.1.6 */
route change 128.50.0.0 128.50.1.5
/* Changes the destination address for a route */
route delete net 128.50.0.0 128.50.1.6
/* Deletes route to 128.50 network */
route get [hostname]
/* Which interface will be used to contact hostname */
route monitor
/* Monitors traffic to the routes */
route flush
/* Removes all entries in the route table */
Searching Items
egrep "patterna|patternb"
/* Search for multiple patterns within the same file */
find . -exec egrep -li "str" {} \;
/* Find a string in files starting cwd */
find / -fstype nfs -prune -o fstype autofs -prune -o -name filename -print
/* Find without traversing NFS mounted file systems */
find . -mtime -1 -type f
/* Find recently modified files */
find / -mtime <# of days>
/* Find files modified during the past # of days */
find . ! -mtime - | /usr/bin/xargs rm -rf
/* Finds and removes files older than specified */
find . -type f -exec grep "" {} \; -print
/* Find files (and content) containing within directory tree */
find . -type f -exec grep -l "" {} \;
/* Find filenames containing within directory tree */
find . -type f -print | xargs grep -i [PATTERN]
/* Recursive grep on files */
find / -user
/* Find all files owned by */
find / | grep [file mask]
/* Fast way to search for files */
find -name "" -exec rm -rf {} \;
/* Recursively finds files by name and automatically removes them */
find /proc/*/fd -links 0 -type f -size +2000 -ls
/* Find large files held open by a process */
ls -lR | grep
/* Fast alternative to find */
Security
echo 'Please go away' > /etc/nologin
/* Stops users logging in */
find / -perm -0777 -type d -ls
/* Find all your writable directories */
find / -type f -perm -2000 -print
/* Find all SGID files */
find / -type f -perm -4000 -print
/* find all SUID files */
Set Terminal Options
stty erase ^H
/* Sets the Backspace Key to erase */
stty erase ^?
/* Sets the Delete Key to erase */
stty sane
/* Rreset terminal after viewing a binary file. */
tput rmacs
/* Reset to standard char set */
Snoop Your Network
snoop -d pcelx0
/* Watch all network packets on device pcelx0 */
snoop -o /tmp/mylog pcelx0
/* Saves packets from device pcelx0 to a file */
snoop -i /tmp/mylog host1 host2
/* View packets from logfile between host1 & host2 */
snoop -i /tmp/mylog -v -p101
/* Show all info on packet number 101 from a logfile */
snoop -i /tmp/mylog -o /tmp/newlog host1
/* Write a new logfile with all host1 packets */
snoop -s 120
/* Return the first 120 bytes in the packet header */
snoop -v arp
/* Capture arp broadcasts on your network */
Swap File
mkfile -v 10m /export/disk1/myswap
/* Makes a 10 Megabyte swapfile in /export/disk */
mkfile -nv 10m /export/disk1/myswap
/* Makes an empty 10 Megabyte swapfile */
Swap Space
swap -s
/* List the amount of swap space available, also see mkfile */
swap -a /export/disk1/swapfile
/* Add a swapfile */
swap -d /dev/dsk/c0t0d0s4
/* Deletes a swap device */
swap -l
/* List the current swap devices */
System Configuration
drvconfig ; disks
/* Adding hot-plug disks to system */
/usr/sbin/eeprom auto-boot? false
/* Changes eeprom autoboot? setting without going to Ok prompt */
/usr/sbin/eeprom diag-switch? true
/* Set the system to perform diagnostics on the next reboot. */
/usr/sbin/eeprom local-mac-address?=true
/* Multiple Port Network Card Setting */
/usr/sbin/grpck
/* Check /etc/group file syntax */
/usr/sbin/pwck
/* Check /etc/passwd file syntax */
/usr/sbin/sys-unconfig
/* Clear host specific network configuration information */
System Information and Monitoring
coreadm -e log
/* Report global core */
/bin/echo "0t${stamp}>Y\n
/* Convert UNIX timestamp to something human-readable */
/usr/sbin/eeprom
/* Show eeprom parameters */
grep "\-root" /var/adm/sulog | grep -v \+ | tail -25
/* List most recent attempts to switch to superuser account. */
isainfo -bv
/* Quickly checkout if machine is in 32 or 64 bit mode */
last
/* Tells who was or still is on the system */
logger -i
/* Log the process ID */
psradm -f [processor id]
/* Take processor offline */
/usr/sbin/prtconf -vp
/* Show system configuration details */
/usr/platform/`/bin/uname -i`/sbin/prtdiag -v
/* System Diagnostics */
prtconf -pv | grep banner-name |awk -F\' ' { print $2 } ' | head -1
/* Show actual model name of machine */
psrinfo | wc -l
/* Display number of processors */
sar -A
/* Provides cumulative system report. */
sar -a
/* Report use of file access system routines. */
sar -u
/* Report CPU Utilization */
telnet 13 | grep ':'
/* Get the time on remote Unix machine */
uname -a
/* Displays system information */
vmstat 10
/* Displays summary of what the system is doing every 10 seconds */
who -b
/* Displays the date of the last system reboot. */
ypcat hosts | sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4
/* Take the input of "ypcat hosts" or "cat /etc/inet/hosts" and sort by IP. */
About Me
Links
Categories
NetBackup Solaris
Recent Entries
Shell Startup Files OBP printenv Sys Admin Pocket Survival Guide - Solaris Solaris 9 x86 u7 Installation for vmware Solaris SPARC Boot Sequence
Friends