|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
[ 作者: Linux联盟收集 加入时间:2006-07-19 13:10:42 来自:Linux联盟收集
] | |
|
今天在SUN的网站找到1篇文章,推荐大家参考,大虾小虾都有参考价值,关键是集中了,各个方面的命令,不全(全了就没法看了),但还实用。5ALLinux联盟 5ALLinux联盟 Debugging 5ALLinux联盟 truss executable 5ALLinux联盟 /* Trace doing of given command ( useful debugging ) */ 5ALLinux联盟 truss -f -p <pid of a shell>; 5ALLinux联盟 /* Using multiple windows, this can be used to trace setuid/setgid programs */ 5ALLinux联盟 [ Back to Top ] 5ALLinux联盟 Arp, ethernet trouble shooting 5ALLinux联盟 arp -a . 5ALLinux联盟 /* Shows the ethernet address arp table */ 5ALLinux联盟 arp -d myhost 5ALLinux联盟 /* Delete a stale ethernet entry for host myhost */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Disk Commands 5ALLinux联盟 du -k . 5ALLinux联盟 /* Reports disk space used in Kilobytes */ 5ALLinux联盟 du -sk . 5ALLinux联盟 /* Reports only total disk space used in Kilobytes */ 5ALLinux联盟 du -ad /var | sort -nr 5ALLinux联盟 /* Tells you how big the /var files are in reverse order */ 5ALLinux联盟 fdformat -d -U 5ALLinux联盟 /* Format diskette */ 5ALLinux联盟 /usr/bin/iostat -E 5ALLinux联盟 /* Command to display drives statistics */ 5ALLinux联盟 /bin/mount -F hsfs -o ro /dev/sr0 /cdrom 5ALLinux联盟 /* Mount an ISO 9660 CDROM */ 5ALLinux联盟 prtvtoc /dev/rdsk/c0t0d0s2 5ALLinux联盟 /* Disk geometry and partitioning info */ 5ALLinux联盟 quot -af 5ALLinux联盟 /* How much space is used by users in kilobytes */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Driver Parameters 5ALLinux联盟 ndd /dev/ip \? 5ALLinux联盟 /* Shows IP variables in the kernel */ 5ALLinux联盟 ndd /dev/ip ip_forwarding 5ALLinux联盟 /* Tells you if forwarding is on (=1) */ 5ALLinux联盟 ndd -set /dev/ip ip_forwarding 1 5ALLinux联盟 /* Enables IP forwarding between interfaces */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 File Manipulation 5ALLinux联盟 dos2unix | -ascii <filename>; 5ALLinux联盟 /* Converts DOS file formats to Unix */ 5ALLinux联盟 split 5ALLinux联盟 /* Split files into pieces */ 5ALLinux联盟 [vi] : %s/existing/new/g 5ALLinux联盟 /* Search and Replace text in vi */ 5ALLinux联盟 [vi] :set nu 5ALLinux联盟 /* Set line numbers in vi */ 5ALLinux联盟 [vi] :set ts=[num] 5ALLinux联盟 /* Set tab stops in vi */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 File System 5ALLinux联盟 cat /dev/null >; filename 5ALLinux联盟 /* Zero's out the file without breaking pipe */ 5ALLinux联盟 dd if=/dev/rdsk/... of=/dev/rdsk/... bs=4096 5ALLinux联盟 /* Make a mirror image of your boot disk */ 5ALLinux联盟 df -k | grep dg| awk '{print $6}' |xargs -n 1 umount 5ALLinux联盟 /* Unmount all file systems in disk group dg */ 5ALLinux联盟 fsck -F ufs /dev/rdsk/c0t0d0s0 5ALLinux联盟 /* Check a UFS filesystem on c0t0d0s0 */ 5ALLinux联盟 fsck -F ufs -y /dev/rdsk/c0t0d0s0 5ALLinux联盟 /* Check answering yes to all questions */ 5ALLinux联盟 fsck -F ufs -o b=97472 /dev/rdsk/c0t0d0s0 5ALLinux联盟 /* Check using an alternate super block */ 5ALLinux联盟 gzip -dc file1.tar.gz | tar xf - 5ALLinux联盟 /* Unpack .tar.gz files in place */ 5ALLinux联盟 ls -la | awk '{ print $5," ",$9 }' | sort -rn 5ALLinux联盟 /* File sizes of current directory */ 5ALLinux联盟 mount -f pcfs /dev/dsk/c0d0p1 /export/dos 5ALLinux联盟 /* Mount DOS fdisk partition from Solaris */ 5ALLinux联盟 mount -F ufs -o rw,remount / 5ALLinux联盟 /* Used to remount root to make it writeable */ 5ALLinux联盟 mount -o remount,logging /spare 5ALLinux联盟 /* Re-mount the ro file system rw and turn on ufs logging */ 5ALLinux联盟 tar cvf filename.tar 5ALLinux联盟 /* Create a tape (tar) archive */ 5ALLinux联盟 tar xvf filename.tar 5ALLinux联盟 /* Extract a tape (tar) archive */ 5ALLinux联盟 tar cf - . | (cd /newdir ; tar xf -) 5ALLinux联盟 /* Recursively copy files and their permissions */ 5ALLinux联盟 /sbin/uadmin x x 5ALLinux联盟 /* Syncs File Systems and Reboots systems fast */ 5ALLinux联盟 zcat <patch_file.tar.Z | tar xvf - 5ALLinux联盟 /* Extract the patch_file that is a compressed tar file */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 File Transfer 5ALLinux联盟 put "| tar cf - ." filename.tar 5ALLinux联盟 /* Undocumented Feature of FTP */ 5ALLinux联盟 find . -depth | cpio -pdmv /path/tobe/copied/to 5ALLinux联盟 /* Fast alternative to cp -pr */ 5ALLinux联盟 sendport 5ALLinux联盟 /* Transferring large numbers of files within the same ftp control session */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 General 5ALLinux联盟 /usr/bin/catman -w 5ALLinux联盟 /* Create windex databases for man page directories */ 5ALLinux联盟 mailx -H -u <username>; 5ALLinux联盟 /* List out mail headers for specified user */ 5ALLinux联盟 set filec 5ALLinux联盟 /* Set file-completion for csh */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Hardware 5ALLinux联盟 cfgadm 5ALLinux联盟 /* Verify reconfigurable hardware resources */ 5ALLinux联盟 m64config -prconf 5ALLinux联盟 /* Print M64 hardware configuration */ 5ALLinux联盟 m64config -depth 8|24 5ALLinux联盟 /* Sets the screen depth of your M64 graphics accelerator */ 5ALLinux联盟 m64config -res 'video_mode' 5ALLinux联盟 /* Change the resolution of your M64 graphics accelerator */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Kernel 5ALLinux联盟 /usr/sbin/modinfo 5ALLinux联盟 /* Display kernel module information */ 5ALLinux联盟 /usr/sbin/modload <module>; 5ALLinux联盟 /* Load a kernel module */ 5ALLinux联盟 /usr/sbin/modunload -i <module id>; 5ALLinux联盟 /* Unload a kernel module */ 5ALLinux联盟 nm -x /dev/ksyms | grep OBJ | more 5ALLinux联盟 /* Tuneable kernel parameters */ 5ALLinux联盟 /usr/sbin/sysdef 5ALLinux联盟 /* Show system kernal tunable details */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Memory 5ALLinux联盟 prtconf | grep "Memory size" 5ALLinux联盟 /* Display Memory Size */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Network Information 5ALLinux联盟 ndd /dev/arp arp_cache_report 5ALLinux联盟 /* Prints ARP table in cache with IP and MAC address */ 5ALLinux联盟 netstat -a | grep EST | wc -l 5ALLinux联盟 /* Displays number active established connections to the localhost */ 5ALLinux联盟 netstat -k hme0 5ALLinux联盟 /* Undocumented netstat command */ 5ALLinux联盟 netstat -i 5ALLinux联盟 /* Show the TCP/IP network interfaces */ 5ALLinux联盟 netstat -np 5ALLinux联盟 /* Similar to arp -a without name resolution */ 5ALLinux联盟 netstat -r 5ALLinux联盟 /* Show network route table */ 5ALLinux联盟 netstat -rn 5ALLinux联盟 /* Displays routing information but bypasses hostname lookup. */ 5ALLinux联盟 netstat -a | more 5ALLinux联盟 /* Show the state of all sockets */ 5ALLinux联盟 traceroute <ipaddress>; 5ALLinux联盟 /* Follow the route to the ipaddress */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Network/Tuning 5ALLinux联盟 ifconfig eth0 mtu 1500 5ALLinux联盟 /* Change MTU of interface */ 5ALLinux联盟 ifconfig eth0 10.1.1.1 netmask 255.255.255.255 5ALLinux联盟 /* Add an Interface */ 5ALLinux联盟 /sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 255.255.0.0 broadcast 10.210.xxx.xxx 5ALLinux联盟 /* Virtual Interfaces */ 5ALLinux联盟 /sbin/ifconfig hme0:1 up 5ALLinux联盟 /* Bring virtual interface up */ 5ALLinux联盟 /usr/sbin/ndd -set /dev/hme adv_100fdx_cap 1 5ALLinux联盟 /* Nailling to 100Mbps */ 5ALLinux联盟 ndd -set /dev/ip ip_addrs_per_if 1-8192 5ALLinux联盟 /* To set more than 256 virtual ip addresses. */ 5ALLinux联盟 ndd -set /dev/tcp tcp_xmit_hiwat 65535 5ALLinux联盟 /* Increase TCP-transmitbuffers */ 5ALLinux联盟 ndd -set /dev/tcp tcp_recv_hiwat 65535 5ALLinux联盟 /* Increase TCP-receivebuffers */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Processes 5ALLinux联盟 fuser -uc /var 5ALLinux联盟 /* Processes that are running from /var */ 5ALLinux联盟 kill -HUP `ps -ef | grep [p]roccess | awk '{print $2}'` 5ALLinux联盟 /* HUP any related process in one step */ 5ALLinux联盟 pfiles <pid>; 5ALLinux联盟 /* Shows processes' current open files */ 5ALLinux联盟 pkill -n <name>; 5ALLinux联盟 /* Kill a process by name */ 5ALLinux联盟 kill `ps -ef | grep program_name | grep -v grep | cut -f8 -d ' '` 5ALLinux联盟 /* pkill for solaris 2.6 */ 5ALLinux联盟 prstat -a 5ALLinux联盟 /* An alternative for top command */ 5ALLinux联盟 /usr/ucb/ps -aux | more 5ALLinux联盟 /* Displays CPU % usage for each process in ascending order */ 5ALLinux联盟 /usr/ucb/ps -auxww | grep <process name>; 5ALLinux联盟 /* Gives the full listing of the process (long listing) */ 5ALLinux联盟 ps -ef | grep -i <string>; | awk '{ print $2 }' 5ALLinux联盟 /* Creates list of running PID by */ 5ALLinux联盟 ps -ef | grep -v "0:00" | more 5ALLinux联盟 /* Gives you a list of any process with CPU time more than 0:00 */ 5ALLinux联盟 ps -ef | more 5ALLinux联盟 /* Show all processes running */ 5ALLinux联盟 ps -fu oracle|grep pmon 5ALLinux联盟 /* See which instances of Oracle are running */ 5ALLinux联盟 /usr/proc/bin/ptree <pid>; 5ALLinux联盟 /* Print the parent/child process 'tree' of a process */ 5ALLinux联盟 /usr/proc/bin/pwdx <pid>; 5ALLinux联盟 /* Print the working directory of a process */ 5ALLinux联盟 top -b 1 5ALLinux联盟 /* Returns the process utilizing the most cpu and quits */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Resource Management 5ALLinux联盟 /usr/bin/ldd [filename] 5ALLinux联盟 /* List the dynamic dependencies of executable files */ 5ALLinux联盟 /usr/proc/bin/pmap pid 5ALLinux联盟 /* Report address space map a process occupies */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Route Configuration 5ALLinux联盟 route add net 128.50.0.0 128.50.1.6 1 5ALLinux联盟 /* Adds route to 128.50 network via 128.50.1.6 */ 5ALLinux联盟 route delete net 128.50.0.0 128.50.1.6 5ALLinux联盟 /* Deletes route to 128.50 network */ 5ALLinux联盟 route get [hostname] 5ALLinux联盟 /* Which interface will be used to contact hostname */ 5ALLinux联盟 route monitor 5ALLinux联盟 /* Monitors traffic to the routes */ 5ALLinux联盟 route flush 5ALLinux联盟 /* Removes all entries in the route table */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Searching Items 5ALLinux联盟 egrep "patterna|patternb" <filename>; 5ALLinux联盟 /* Search for multiple patterns within the same file */ 5ALLinux联盟 find . -exec egrep -li "str" {} \; 5ALLinux联盟 /* Find a string in files starting cwd */ 5ALLinux联盟 find / -fstype nfs -prune -o fstype autofs -prune -o -name filename -print 5ALLinux联盟 /* Find without traversing NFS mounted file systems */ 5ALLinux联盟 find . -mtime -1 -type f 5ALLinux联盟 /* Find recently modified files */ 5ALLinux联盟 find / -mtime <# of days>; 5ALLinux联盟 /* Find files modified during the past # of days */ 5ALLinux联盟 find . ! -mtime -<days>; | /usr/bin/xargs rm -rf 5ALLinux联盟 /* Finds and removes files older than <days>; specified */ 5ALLinux联盟 find . -type f -exec grep "<sub-string>;" {} \; -print 5ALLinux联盟 /* Find files containing <sub-string>; within directory tree */ 5ALLinux联盟 find . -type f -print | xargs grep -i [PATTERN] 5ALLinux联盟 /* Recursive grep on files */ 5ALLinux联盟 find / -user <username>; 5ALLinux联盟 /* Find all files owned by <username>; */ 5ALLinux联盟 find / | grep [file mask] 5ALLinux联盟 /* Fast way to search for files */ 5ALLinux联盟 find <start_path>; -name "<file_name>;" -exec rm -rf {} \; 5ALLinux联盟 /* Recursively finds files by name and automatically removes them */ 5ALLinux联盟 find /proc/*/fd -links 0 -type f -size +2000 -ls 5ALLinux联盟 /* Find large files held open by a process */ 5ALLinux联盟 ls -lR | grep <sub_string>; 5ALLinux联盟 /* Fast alternative to find */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Security 5ALLinux联盟 echo 'Please go away' >; /etc/nologin 5ALLinux联盟 /* Stops users logging in */ 5ALLinux联盟 find / -perm -0777 -type d -ls 5ALLinux联盟 /* Find all your writable directories */ 5ALLinux联盟 find / -type f -perm -2000 -print 5ALLinux联盟 /* Find all SGID files */ 5ALLinux联盟 find / -type f -perm -4000 -print 5ALLinux联盟 /* find all SUID files */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Set Terminal Options 5ALLinux联盟 stty erase ^H 5ALLinux联盟 /* Sets the Backspace Key to erase */ 5ALLinux联盟 stty erase ^? 5ALLinux联盟 /* Sets the Delete Key to erase */ 5ALLinux联盟 stty sane 5ALLinux联盟 /* Rreset terminal after viewing a binary file. */ 5ALLinux联盟 tput rmacs 5ALLinux联盟 /* Reset to standard char set */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Snoop Your Network 5ALLinux联盟 snoop -d pcelx0 5ALLinux联盟 /* Watch all network packets on device pcelx0 */ 5ALLinux联盟 snoop -o /tmp/mylog pcelx0 5ALLinux联盟 /* Saves packets from device pcelx0 to a file */ 5ALLinux联盟 snoop -i /tmp/mylog host1 host2 5ALLinux联盟 /* View packets from logfile between host1 & host2 */ 5ALLinux联盟 snoop -i /tmp/mylog -v -p101 5ALLinux联盟 /* Show all info on packet number 101 from a logfile */ 5ALLinux联盟 snoop -i /tmp/mylog -o /tmp/newlog host1 5ALLinux联盟 /* Write a new logfile with all host1 packets */ 5ALLinux联盟 snoop -s 120 5ALLinux联盟 /* Return the first 120 bytes in the packet header */ 5ALLinux联盟 snoop -v arp 5ALLinux联盟 /* Capture arp broadcasts on your network */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Swap File 5ALLinux联盟 mkfile -v 10m /export/disk1/myswap 5ALLinux联盟 /* Makes a 10 Megabyte swapfile in /export/disk */ 5ALLinux联盟 mkfile -nv 10m /export/disk1/myswap 5ALLinux联盟 /* Makes an empty 10 Megabyte swapfile */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 Swap Space 5ALLinux联盟 swap -s 5ALLinux联盟 /* List the amount of swap space available, also see mkfile */ 5ALLinux联盟 swap -a /export/disk1/swapfile 5ALLinux联盟 /* Add a swapfile */ 5ALLinux联盟 swap -d /dev/dsk/c0t0d0s4 5ALLinux联盟 /* Deletes a swap device */ 5ALLinux联盟 swap -l 5ALLinux联盟 /* List the current swap devices */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 System Configuration 5ALLinux联盟 /usr/sbin/eeprom auto-boot? false 5ALLinux联盟 /* Changes eeprom autoboot? setting without going to Ok prompt */ 5ALLinux联盟 /usr/sbin/eeprom diagswitch? true 5ALLinux联盟 /* Set the system to perform diagnostics on the next reboot. */ 5ALLinux联盟 /usr/sbin/grpck 5ALLinux联盟 /* Check /etc/group file syntax */ 5ALLinux联盟 /usr/sbin/pwck 5ALLinux联盟 /* Check /etc/passwd file syntax */ 5ALLinux联盟 /usr/sbin/sys-unconfig 5ALLinux联盟 /* Clear host specific network configuration information */ 5ALLinux联盟 5ALLinux联盟 5ALLinux联盟 System Information and Monitoring 5ALLinux联盟 coreadm -e log 5ALLinux联盟 /* Report global core */ 5ALLinux联盟 /usr/sbin/eeprom 5ALLinux联盟 /* Show eeprom parameters */ 5ALLinux联盟 grep "\-root" /var/adm/sulog | grep -v \+ | tail -25 5ALLinux联盟 /* List most recent attempts to switch to superuser account. */ 5ALLinux联盟 isainfo -bv 5ALLinux联盟 /* Quickly checkout if machine is in 32 or 64 bit mode */ 5ALLinux联盟 last 5ALLinux联盟 /* Tells who was or still is on the system */ 5ALLinux联盟 logger -i 5ALLinux联盟 /* Log the process ID */ 5ALLinux联盟 /usr/sbin/prtconf -vp 5ALLinux联盟 /* Show system configuration details */ 5ALLinux联盟 /usr/platform/`/bin/uname -i`/sbin/prtdiag -v 5ALLinux联盟 /* System Diagnostics */ 5ALLinux联盟 psrinfo | wc -l 5ALLinux联盟 /* Display number of processors */ 5ALLinux联盟 sar -A <time in sec>; 5ALLinux联盟 /* Provides cumulative system report. */ 5ALLinux联盟 sar -a <time in sec>; 5ALLinux联盟 /* Report use of file access system routines. */ 5ALLinux联盟 sar -u 5ALLinux联盟 /* Report CPU Utilization */ 5ALLinux联盟 uname -a 5ALLinux联盟 /* Displays system information */ 5ALLinux联盟 vmstat 10 5ALLinux联盟 /* Displays summary of what the system is doing every 10 seconds */ 5ALLinux联盟 ypcat hosts | sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4 5ALLinux联盟 /* Take the input of "ypcat hosts" or "cat /etc/inet/hosts" and sort by IP. */ 5ALLinux联盟 5ALLinux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|