Solaris管理员常用168条命令简明手册.doc_第1页
Solaris管理员常用168条命令简明手册.doc_第2页
Solaris管理员常用168条命令简明手册.doc_第3页
Solaris管理员常用168条命令简明手册.doc_第4页
Solaris管理员常用168条命令简明手册.doc_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Solaris管理员常用168条命令简明手册呕血力作,申请设精!本来想写篇关于solaris系统作raid的详细指导,谁知道过年后一直疯狂忙碌,只好整理了一下自己以前刚接触solaris时候的笔记,作了个新手指导不是手把手教新手如何安装,如何使用,这些文档CU已经有很多,主要是针对新手在学习过程中肯定会碰到的疑难作解答和总结。要排版好的内容请下载附件,希望对各位新人有帮助。RAID指导的文档只好推后咯。solaris9 x86新手最需要的知识目录1.Solaris 9 x86 安装系统2.基本信息查看3.网络信息配置和修改 4.磁盘管理:配额、RAID、CLUSTER5.环境管理6.背景知识Solaris9 x86 新手最需要的知识Solaris 9 x86 安装系统系统安装 soft1和2一定要装。Admintool改用户等,kdmconfig改驱动,sys-unconfig改网络配置驱动选择(vmware) 显卡:通用vesa,显示器:NOTEPAD 1024*768,分辨率:可选然后安装vmware for solaris的显卡驱动补丁打补丁,查看用patchadd -p patchroot/reports/  各种版本补丁描述patchroot/clusters/  推荐补丁集目录下运行 ./install_cluster解开上传远程GUI管理 xbrowserXmanager/download/down_xme2.htmlxstartXmanager /products/xmg_tutorial2.html光驱cdrom Mount F hsfs /dev/dsk/c?t?d?s0 /cdrom添加新硬盘flag=wu 为不可mount Devfsadm (x86)or probe-scsi-all(sparc)yfdisk选磁盘Formatlabelprint查看一下现有分区,然后给分区分配空间:0/1/2/7Partionnewfs /dev/dsk/c?d?s?mkdir /newdisk1mount /dev/dsk/c?d?s? /newdisk1建立man的帮助索引 Catman -w解压软件包 Gzip d 文件名.gz; Tar vxf 文件名.tar; gunzip *.gz; 感觉比gzip好用安装软件包,查看:pkgadd i 包名 在软件所在目录下:Pkgadd d .或者 pkgadd d 包名字sh ./xxxx.sh 或者 ./xxx.sh pkginfo | grep xxx 也可以查看包常用软件 上网用Mozilla、办公用open office、QQ用lumaqq/textQQ、TOP基本信息查看快截键 Ctrl+Insert=复制,Shift+Insert=粘贴,stty erase H=Backspace键起作用操作系统信息 Uname a主机名 Hostname XXXX系统时间 Date 或者 date 102317302005 修改系统当前时间为2005-10-23 17:30主机硬件软件/补丁 Showrev;showrev p; showrev a 看软件硬件;补丁;全部显示 patchadd -p硬盘和分区信息 Format;prtvtoc /dev/dsk/c0d0s0 看c0d0s0的分区信息文件系统空间使用率 Df k; du -sk /export; du sk * 查看所有目录的大小 CPU Psrinfo; Prtconf | grep cpu;psradm 可使CPU下线或上线内存 Dmesg |grep mem; prtconf | grep Mem交换空间 Swap l系统资源使用率 Prstat;Vmstat 5 或者安装 top 然后 ln s /usr/local/bin/top /usr/bin/top开关重启机器 Init 6 或者 telinit 6 或者 shutdown 或者 halt 或者 reboot当前用户和运行级别 Who;id;Who r查看用户和组和密码 More /etc/passwd;/etc/group;/etc/shadow建立新组建立新用户设置新密码修改用户主目录的属主设置用户主目录的权限修改用户主目录的属组修改用户属组等属性 Groupadd wnt; groups teacher 查看teacher用户属于哪些组Useradd g wnt d /export/home/teacher c “a teacher” m s /usr/bin/sh teacherPasswd teacherCd /export/home;chown teacher teacherChmod 644 teacher; chmod o+w teacher 其他用户对teacher目录拥有写权限,u+,g+)Chgrp R sysadmin /export/home/teacherteacher目录和子文件被改为sysadmin所拥有Usermod G staff teacher teacher用户的附加组为staff,和useradd用法几乎一样查找 Find / -name test print 所有根目录下名字为test文件或者目录都被找出查找文件中的 Grep v “#” /etc/inetd.confinetd.conf里不包含#的行都列出Grep n ftp /ect/inetd.conf查找inetd.conf中包含ftp的行,不区分大小写扩充临时交换空间永久增加交换空间 Mkfile v 100m swap_file;Swap a swap_file;swap d swap_fileVi /etc/vfstab; /path/filename - - Swap - no -查看shell Echo $SHELL临时设置路径后接新路径 Echo $PATHPATH=$PATH:/user/openwin:Export PATH系统初始环境变量 /etc/default/login、$home/.profile等(没有就touch .profile)网络信息配置和修改 路由表察看 Netstat rn (flag:U=up,H=host,G=gateway)临时路由添加 Route add netmask Route add /24 网卡地址修改(不会保存) Ifconfig 网卡名字 downIfconfig 网卡名字 netmask upDNS服务器设置 /etc/Resolv.conf主机-ip对应关系设置 /etc/Hosts; tocnc ( Chmod 611 ./inet/hosts; vi /etc/hosts )网络号及网络掩码 /etc/netmasks缺省路由配置多路由,passive指定网关是否被动更新 /etc/defaultrouter 如果没有此文件就创建一个vi /etc/gateways net /24 gateway metric 1 passive|activein.routed网卡IP /etc/Hostname.网卡名字 tocnc ( 和hosts中的对应 )名字解析的顺序 /etc/Nsswitch.conf配置由inetd监视的进程 /etc/inetd.conf自动共享 vi /etc/dfs/dfstab share F nfs o ro d “test share” /export/home手动共享资源(/etc/dfs/dfstab)(必须要有内容!) /etc/init.d/nfs.server start或者 /etc/rc3.d/S15nfs.server startshare F nfs o ro d “first share” /home/usr/lib/nfs/mountd/usr/lib/nfs/nfsd a 16察看共享资源 Share或者 dfshares; dfmounts;unshare F nfs /home挂接共享资源 Mkdir /mnt/home.35Mount F nfs 5:/home /home.35W2k和solaris互相访问 配置samba磁盘管理:配额、RAID、CLUSTER磁盘检查 fsck F ufs /dev/dsk/c0t0d0s0; fsck y /dev/dsk/c0d0s7;fsck -y限制用户空间配额(假设/export/home)(假设用户为huangyu)(配额为1024K-2048K)(时间限制为1分钟)(1分钟内还可继续)(使用,但不能超过)(2048K的限制)inode是节点,可理解为文件和目录数量 vi /etc/vfstab 把要开启配额的文件系统的mount option下“-”改为 rqcd /export/home; Touch quotas; Chmod 600 quotasedquota huangyufs /data blocks (soft = 1024, hard = 204 inodes (soft = 0, hard = 0)quotacheck /export/homequotaon arepquota aedquota t huangyufs /export/home blocks time limit = 1.00 min, files time limit = 0(default)quotaoff /export/home扩容,比如/目录满mount个新分区在/usr/local 取代以前的目录 1.mount /dev/dsk/xxx /mnt/tmp2. cd /usr/local; tar cf - . | (cd /mnt/tmp; tar xvf -)3. umount /mnt/tmp4.cd /usr;rm -rf local5. mount /dev/dsk/xxx /usr/local6. vi vfstab 加入 该分区到 /usr/local能够虚拟光盘,把硬盘上的影像文件当作光盘用 lofiadmlofiadm -a /opt/file1.isodev/lofi/1mount -F hsfs /dev/lofi/1 /mnt卷管理器 /etc/init.d/volmgt stop,/etc/init.d/volmgt startRAID 请看SUN CLUSTER init的各个级别 0关机1初始化6重启S/s重启到单用户模式3缺省模式,多用户,有NFSPV,LV,VG 环境管理用户环境变量定义 用户主目录下的 .profile 没有就建立一个J2SE/JDK的安装(源文件cp到/usr) Cd /usr; Sh ./jrexx.sh localinstall; Rm /usr/java; ln s /usr/jre1.5.6.xx /usr/java; java -version修改启动设置 eepromeeprom auto-boot?=true非正常关闭系统:cannot create /var/adm/utmpx还不行就:boot cdrom -stouch /var/adm/*tmp*如果有metadevice就要先备份metastat的信息 mount -o rw,remount /重新以读写方式mount /文件系统metadbmetadb -d /dev/.metadb -d -f /dev/.rebootfsck -ymore /etc/vfstab 该启动mount的就mount,fsck pass该设置的就设置fsck -y /dev/dsk/c. fsck -y 没有检查的检查mountall 一次性把/etc/vfstab中的全部mount 默认软件包执行路径 /usr/local/bin 背景知识以下是检查硬件问题: hp,和IBM的一些机器是启动的时候用盘引导,来设置raid卡之后在划分好的LUN上安装系统sun的机器只能先安装系统,再做raid,因为没有硬的raid卡1touch /reconfigure;1init 02boot -r3devfsadm/devconfig Solaris利用特定空文件reconfigure,标明在下次启动时,重新检查配置硬件,加载内核模块,实际上,Solaris与传统的比有所变化,将传统的内核部分分为很小的内核(约2MB)和大量动态联接的内核模块二部分,内核在启动后常驻内存,但关于新的硬件支持的内核模块可动态加载或卸下,硬件变化无需重起Solaris。察看shell的区别都是bourn shellls -l /sbin/shls -l usr/bin/shfile /sbin/shfile /usr/bin/shldd /sbin/shldd /usr/bin/sh /sbin/sh is statically linked /usr/bin/sh is dynamically linked. /bin/sh /bin目录是到/usr/bin的链接动态链接的bin执行的时候使用共享的libraries.他们的文件更小,而且当libraries更新的时候,他们自动使用更新的libaries静态链接bin包含了所有的代码,不需要使用共享的libraries. 他们的文件大小比动态链接的bin文件要大. 如果系统 broken并且libraries被删除了,损坏了,或者/usr目录没被mounted,/sbin/sh仍然可以执行。所以推荐大家使用/sbin/sh 作为缺省的root shellMac地址# eeprom local-mac-address?=true# boot -r SUN和任何其他厂商一样,每个网卡都有自己唯一的MAC地址.不过SUN的机器自己也有个MAC地址,一般保存在NVRAM里.默认情况下,也就是local-mac-address?为false的情况下,机器上不管有多少块网卡,所有网卡的MAC地址都使用系统MAC地址. 执行以下命令使网卡使用自己的MAC地址!数据备份 系统监控/etc/syslog.conf /var/adm/messages /var/adm/wtmpx/var/adm/utmx Who wtmpx;察看系统登陆纪录其他详细资料请见本人个人网站论坛下载不回帖,做人不厚道 本帖最后由 yuhuohu 于 2006-4-20 09:35 编辑 附件: solaris9 x86新手最需要的知识solaris9 x86新手最需要的知识.rar (2006-4-19 12:30, 10.89 K)该附件被下载次数 594_mcse- ccnp+ ccsp-(ccsp=chinaunix certificated solaris professional)八闽技术联盟:火狐: 福建IT技术交流论坛: /bbs SUN 的官方论坛上看到的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 /* Zeros 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 netmask 55 /* Add an Interface */ /sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 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 proccess | 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 1 /* Adds route to 128.50 network via */ route change /* Changes the destination address for a route */ route delete net /* 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/* Find files modified during the past # of days */ find . ! -mtime - | /usr/bin/xargs rm -rf /* Finds and removes files older thanspecified */ find . -type f -exec grep ; -print /* Find files (and content) containingwithin directory tree */ find . -type f -exec grep -l ; /* Find filenames containingwithin 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 */

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论