Wednesday, 6 December. 2006
Debuggingcat -v -t -e [file] Show non-printing charactersdumpadm -d swap Configure swap device as dump deviceld -l <libname without 'lib'> Check if you have a particular librarytruss -f -p <pid of a shell> Using multiple windows, this can be used to trace setuid/setgid programstruss executable Trace doing of given command (useful debugging)
Disk Commands/bin/mount -F hsfs -o ro /dev/sr0 /cdrom Mount an ISO 9660 CDROM/usr/bin/iostat -E Command to display drives statisticsdu -ad /var | sort -nr Report the the disk used in /var in reverse orderdu -k . Report disk usage in Kilobytesdu -sk | sort -nr | head Shows the top ten largest files/directoriesdu -sk |sort -k1,1n Reports total disk space used in Kilobytes in present directorydu -sk . Report total disk usage in Kilobytesfdformat -d -U Format diskettenewfs -Nv /dev/rdsk/c0t0d0s1 To view the superfblocks availableprtvtoc /dev/rdsk/c0t0d0s2 Disk geometry and partitioning infoprtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2 Copy partition table from one disk to anotherquot -af How much space is used by users in kilobytesvolrmmount -i floppy Mount a floppy or other media easily by its nickname.Driver Parametersndd /dev/ip ip_forwarding Show the ip_forwarding variable in the kernelndd /dev/ip ip_forwarding 1 Set the ip_forwarding variable in the kernelndd /dev/ip \? Show all IP variables set in the kernelFile Manipulation dos2unix | -ascii Converts DOS file formats to Unixfold -w 180 To break lines to have maximum charsplit [-linecount] [file] Split files into pieces[vi] : %s/existing/new/g Search and Replace text in vi[vi] :set list Show non-printing characters in vi[vi] :set nu Set line numbers in vi[vi] :set ts=[num] Set tab stops in viFile System/sbin/uadmin x x Syncs File Systems and Reboots systems fastawk ' END {print NR}' file_name Display the Number of lines in a filecat /dev/null > filename Zero's out the file without breaking pipedd if=/dev/rdsk/... of=/dev/rdsk/... bs=4096 Make a mirror image of your boot diskdf -k | grep dg| awk '{print $6}' |xargs -n 1 umount Unmount all file systems in disk group dgfsck -F ufs -o b=97472 /dev/rdsk/c0t0d0s0 Check and repair a UFS filesystem on c0t0d0s0, using an alternate superblockfsck -F ufs -y /dev/rdsk/c0t0d0s0 Check a UFS filesystem on c0t0d0s0, repair any problems without prompting.fsck -F ufs /dev/rdsk/c0t0d0s0 Check a UFS filesystem on c0t0d0s0gzip -d -c tarball.tgz | (cd /[dir];tar xf - ) & Unpacking tarballs to diff locationgzip -dc file1.tar.gz | tar xf - Unpack .tar.gz files in placeln [-fhns] <source file> <destination file> Creating hard links and soft linksls -al | awk '$3 == "oracle" || $3 == "root" {print $9}' List all file names by testing ownerls -l | sort +4n List files by sizels -la | awk '{ print $5," ",$9 }' | sort -rn File sizes of current directoryls -lR | awk '{total +=$5};END {print "Total size: " total/1024/1024 "MB" }' Recursive directory size calculations in MBmkisofs -l -L -r -o [image-name].iso [directory] Create an ISO image of a directorymount -F ufs -o rw,remount / Used to remount root to make it writeablemount -o remount,logging /spare Re-mount the ro file system rw and turn on ufs loggingmount -f pcfs /dev/dsk/c0d0p1 /export/dos mount DOS fdisk partition from Solaris mv [filename]{,.new_suffix} Renaming filepax -rw . /newdir Efficient alternative for copying directoriesprtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2 Cloning Partitiontablestar cf - . | (cd /newdir ; tar xf -) Recursively copy files and their permissionstar cvf filename.tar Create a tape (tar) archivetar xvf filename.tar Extract a tape (tar) archiveX=$(wc -l < filename); echo $X Count number of lines in a file into a variable (ksh)zcat < patch_file.tar.Z | tar xvf - Extract the patch_file that is a compressed tar filezcat [cpio file] | cpio -itmv Show the contents of a compressed cpioFile Transferfind . -depth | cpio -pdmv /path/tobe/copied/to Fast alternative to cp -prfind . -follow | cpio -pdumL /path/tobe/copied/to Copy with symbolic links to be followedget filename.suffix | "tar xf -" Undocumented Feature of FTPssh cd /some/directory \&\& tar cf - | ssh cd /some/direstory \&\& tar xvf - Move any file(s) without actually touching them put " | tar cf - ." filename.tar Undocumented Feature of FTPsendport FTP command for transferring large numbers of files within the same control sessionGeneral/bin/printf '%d\n' '0x' Converts hexadecimal number to decimal./usr/bin/catman -w Create windex databases for man page directoriesFQ_FILENAME=<fully_qualified_file_name>; echo ${FQ_FILENAME% /*} Extract directory from fully-qualified file name.mailx -H -u <username> List out mail headers for specified userps -ef | grep -i $@ Access common commands quickerset filec Set file-completion for cshuuencode [filename] [filename] | mailx -s "Subject" [user to mail] Send files as attachmentsxauth -f /home/${LOGNAME} extract - ${DISPLAY} | xauth merge - Allow root to xdisplay after suHardwarecfgadm Verify reconfigurable hardware resourcesm64config -depth 8|24 Sets the screen depth of your M64 graphics acceleratorm64config -prconf Print M64 hardware configurationm64config -res 'video_mode' Change the resolution of your M64 graphics acceleratorprtpicl -v | grep sync-speed Discover SCSI sync speedKernel/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/usr/sbin/sysdef Show system kernal tunable detailsnm -x /dev/ksyms | grep OBJ | more Tuneable kernel parametersMemorypagesize -a Available page sizes for Solaris 9prtconf | grep Mem Display Memory Size of the local machine.Network Informationarp -a Ethernet address arp tablearp -d myhost Delete an ethernet address arp table entrylsof -iTCP@10.20.2.9 Display open files for internet addressndd /dev/arp arp_cache_report Prints ARP table in cache with IP and MAC addressnetstat -a | grep EST | wc -l Displays number active established connections to the localhostnetstat -a | more Show the state of all the sockets on a machinenetstat -i Show the state of the interfaces used for TCP/IP trafficenetstat -k hme0 Undocumented netstat commandnetstat -np Similar to arp -a without name resolutionnetstat -r Show the state of the network routing table for TCP/IP trafficnetstat -rn Displays routing information but bypasses hostname lookup.snoop -S -ta [machine] Snoop for network packets and get size and time stamp entries.traceroute <ipaddress> Follow the route to the ipaddressNetwork Tuning/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 100Mbpsifconfig eth0 10.1.1.1 netmask 255.255.255.255 Add an Interfaceifconfig eth0 mtu 1500 Change MTU of interfacendd -set /dev/ip ip_addrs_per_if 1-8192 To set more than 256 virtual ip addresses.ndd -set /dev/tcp tcp_recv_hiwat 65535 Increase TCP-receivebuffers on Sol2.5.1 systems with 100BaseTxndd -set /dev/tcp tcp_xmit_hiwat 65535 Increase TCP-transmitbuffers on Sol2.5.1 systems with 100BaseTxProcesses/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/usr/ucb/ps -aux | more Displays CPU % usage for each process in ascending order/usr/ucb/ps -auxww | grep <process name> Gives the full listing of the process (long listing)fuser -uc /var Processes that are running from /varipcs Report inter-process communication facilities statuskill -HUP `ps -ef | grep [p]roccess | awk '{print $2}'` HUP any related process in one steplsof -i TCP:25 Mapping port with processpfiles <pid> Shows processes' current open filespkill -n <name> Kill a process by nameprstat -a An alternative for top commandps -edf -o pcpu,pid,user,args Nicely formatted 'ps'ps -ef | grep -i | awk '{ print $2 }' Creates list of running PID by ps -ef | grep -i | awk '{ print $2 }' Creates list of running PID byps -ef | grep | grep -v grep | cut -c 10-15 | xargs kill -9 Find and kill all instances of a given processps -ef | more Show all processes runningps -ef | grep -v "0:00"|more Gives you a list of any process with CPU time more than 0:00ps -eo pid,args List processes in simplified formatps -fu oracle | grep pmon See which instances of Oracle are runningtop -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 All Solaris CommandsComparision of Shell commands (PDF)Cool Commandscoolcommands.comDOS to UNIX command translationMan Pages: System Administration Commands (Solaris 10)Man Pages: System Administration Commands (Solaris 9)Man Pages: User Commands (Solaris 10)Man Pages: User Commands (Solaris 9)Tips on good shell programming practicesTrapping Special Characters in the Korn ShellUniversal Command Guide for Operating Systems |
|
|