|
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 -ad /var | sort -nr
/* Tells you how big the /var files are in reverse order */
fdformat -d -U
/* Format diskette */
/bin/mount -F hsfs -o ro /dev/sr0 /cdrom
/* Mount an ISO 8660 CDROM */
prtvtoc /dev/rdsk/c0t0d0s2
/* Disk geometry and partitioning info */
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 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 */
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 */
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 */
tar cvf filename.tar
/* Create a tape (tar) archive */
tar xvf filename.tar
/* Extract a tape (tar) archive */
/sbin/uadmin x x
/* Syncs File Systems and Reboots systems fast */
]
File Transfer
put "| tar cf - ." filename.tar
/* Undocumented Feature of FTP */
find . -depth | cpio -pdmv /path/tobe/copied/to
/* Fast alternative to cp -pr */
]
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 <module>
/* Load a kernel module */
/usr/sbin/modunload -i <module id>
/* 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 "Memory size"
/* Display Memory Size */
Network Information
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 -r
/* Show network route table */
netstat -rn
/* Displays routing information but bypasses hostname lookup.
*/
netstat -a | more
/* Show the state of all sockets */
traceroute <ipaddress>
/* Follow the route to the ipaddress */
Network/Tuning
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 */
pfiles <pid>
/* Shows processes' current open files */
prstat -a
/* An alternative for top command */
/usr/ucb/ps -aux | more
/* Displays CPU % usage for each process in ascending order */
ps -ef | more
/* Show all processes running */
/usr/proc/bin/ptree <pid>
/* Print the parent/child process 'tree' of a process */
/usr/proc/bin/pwdx <pid>
/* Print the working directory of a process */
top -b 1
/* Returns the process utilizing the most cpu and quits */
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 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
find . -type f -print | xargs grep -i [PATTERN]
/* Recursive grep on files */
find / | grep [file mask]
/* Fast way to search for files */
find <start_path> -name "<file_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 <sub_string>
/* Fast alternative to find */
Security
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 */
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 */
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
/usr/sbin/eeprom
/* Show eeprom parameters */
/usr/sbin/prtconf -vp
/* Show system configuration details */
psrinfo | wc -l
/* Display number of processors */
sar -A <time in sec>
/* Provides cumulative system report. */
sar -a <time in sec>
/* Report use of file access system routines. */
sar -u
/* Report CPU Utilization */
uname -a
/* Displays system information */
|