Solaris 8.0 常用命令解释( 三 )


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 -size2000 -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
/usr/sbin/eeprom auto-boot? false
/* Changes eeprom autoboot? setting without going to Ok prompt */
/usr/sbin/eeprom diagswitch? true
/* Set the system to perform diagnostics on the next reboot. */
/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 */
/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 */
/usr/sbin/prtconf -vp
/* Show system configuration details */
/usr/platform/`/bin/uname -i`/sbin/prtdiag -v
/* System Diagnostics */
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 */
uname -a
/* Displays system information */
vmstat 10
/* Displays summary of what the system is doing every 10 seconds */
ypcat hosts | sort -n -t.0 -11 -22 -33 -4
/* Take the input of "ypcat hosts" or "cat /etc/inet/hosts" and sort by IP. */

推荐阅读