BigAdmin System Administration Portal
Shell Commands

Show me commands that deal with:

Additional Resources
1.  Click here for more information All Solaris Commands *
2.  Click here for more information Alphabetical Directory of Linux Commands *
3.  Click here for more information Awk, Nawk and GNU Awk Cheat Sheet *
4.  Click here for more information Comparision of Shell commands (PDF) *
5.  Click here for more information Cool Commands *
6.  Click here for more information coolcommands.com *
7.  Click here for more information DOS to UNIX command translation *
8.  Click here for more information Famous Awk One-Liners Explained, Part I *
9.  Click here for more information Famous Awk One-Liners Explained, Part II *
10.  Click here for more information Korn Shell Nuances *
11.  Click here for more information Man Pages: System Administration Commands (Solaris 10)
12.  Click here for more information Man Pages: System Administration Commands (Solaris 9)
13.  Click here for more information Man Pages: User Commands (Solaris 10)
14.  Click here for more information Man Pages: User Commands (Solaris 9)
15.  Click here for more information Tips on good shell programming practices *
16.  Click here for more information Top 10 Best Cheat Sheets and Tutorials for Linux / UNIX Commands *
17.  Click here for more information Trapping Special Characters in the Korn Shell *
18.  Click here for more information Universal Command Guide for Operating Systems *
19.  Click here for more information Unix 'find command' helper *
20.  Click here for more information Useful Solaris Commands (Blog) *

Back to top

 

Debugging
21.  Click here for more information cat -v -t -e [file]
/* Show non-printing characters */
22.  Click here for more information dumpadm -d swap
/* Configure swap device as dump device */
23.  Click here for more information ld -l <libname without 'lib'>
/* Check if you have a particular library */
24.  Click here for more information truss -f -p <pid of a shell>
/* Using multiple windows, this can be used to trace setuid/setgid programs */
25.  Click here for more information truss executable
/* Trace doing of given command ( useful debugging ) */

Back to top

 

Disk Commands
26.  Click here for more information /bin/mount -F hsfs -o ro /dev/sr0 /cdrom
/* Mount an ISO 9660 CDROM */
27.  Click here for more information /usr/bin/iostat -E
/* Command to display drives statistics */
28.  Click here for more information du -ad /var | sort -nr
/* Report the the disk used in /var in reverse order */
29.  Click here for more information du -k .
/* Report disk usage in Kilobytes */
30.  Click here for more information du -sk * | sort -nr | head
/* Shows the top ten largest files/directories */
31.  Click here for more information du -sk *|sort -k1,1n
/* Reports total disk space used in Kilobytes in present directory */
32.  Click here for more information du -sk .
/* Report total disk usage in Kilobytes */
33.  Click here for more information fdformat -d -U
/* Format diskette */
34.  Click here for more information mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mnt
/* Mount an ISO Image */
35.  Click here for more information newfs -Nv /dev/rdsk/c0t0d0s1
/* To view the superfblocks available */
36.  Click here for more information One-liner to copy a partition table
/* prtvtoc /dev/dsk/c1t2d0s2 | fmthard -s - /dev/rdsk/c1t3d0s2 */
37.  Click here for more information prtvtoc /dev/rdsk/c0t0d0s2
/* Disk geometry and partitioning info */
38.  Click here for more information prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
/* Copy partition table from one disk to another */
39.  Click here for more information quot -af
/* How much space is used by users in kilobytes */
40.  Click here for more information volrmmount -i floppy
/* Mount a floppy or other media easily by its nickname. */

Back to top

 

Driver Parameters
41.  Click here for more information ndd /dev/ip ip_forwarding
/* Show the ip_forwarding variable in the kernel */
42.  Click here for more information ndd /dev/ip ip_forwarding 1
/* Set the ip_forwarding variable in the kernel */
43.  Click here for more information ndd /dev/ip \?
/* Show all IP variables set in the kernel */

Back to top

 

File Manipulation
44.  Click here for more information dos2unix | -ascii <filename>
/* Converts DOS file formats to Unix */
45.  Click here for more information fold -w 180
/* To break lines to have maximum char */
46.  Click here for more information split [-linecount] [file]
/* Split files into pieces */
47.  Click here for more information [vi] : %s/existing/new/g
/* Search and Replace text in vi */
48.  Click here for more information [vi] :set list
/* Show non-printing characters in vi */
49.  Click here for more information [vi] :set nu
/* Set line numbers in vi */
50.  Click here for more information [vi] :set ts=[num]
/* Set tab stops in vi */

Back to top

 

File System
51.  Click here for more information /sbin/uadmin x x
/* Syncs File Systems and Reboots systems fast */
52.  Click here for more information awk ' END {print NR}' file_name
/* Display the Number of lines in a file */
53.  Click here for more information cat /dev/null > filename
/* Zero's out the file without breaking pipe */
54.  Click here for more information cksum [filename]
/* View the checksum value for the given file */
55.  Click here for more information dd if=/dev/rdsk/... of=/dev/rdsk/... bs=4096
/* Make a mirror image of your boot disk */
56.  Click here for more information df -k | grep dg| awk '{print $6}' |xargs -n 1 umount
/* Unmount all file systems in disk group dg */
57.  Click here for more information fsck -F ufs -o b=97472 /dev/rdsk/c0t0d0s0
/* Check and repair a UFS filesystem on c0t0d0s0, using an alternate superblock */
58.  Click here for more information fsck -F ufs -y /dev/rdsk/c0t0d0s0
/* Check a UFS filesystem on c0t0d0s0, repair any problems without prompting. */
59.  Click here for more information fsck -F ufs /dev/rdsk/c0t0d0s0
/* Check a UFS filesystem on c0t0d0s0 */
60.  Click here for more information gzip -d -c tarball.tgz | (cd /[dir];tar xf - ) &
/* Unpacking tarballs to diff location */
61.  Click here for more information gzip -dc file1.tar.gz | tar xf -
/* Unpack .tar.gz files in place */
62.  Click here for more information ln [-fhns] <source file> <destination file>
/* Creating hard links and soft links */
63.  Click here for more information ls -al | awk '$3 == "oracle" || $3 == "root" {print $9}'
/* List all file names by testing owner */
64.  Click here for more information ls -l | sort +4n
/* List files by size */
65.  Click here for more information ls -la | awk '{ print $5,"    ",$9 }' | sort -rn
/* File sizes of current directory */
66.  Click here for more information ls -lR | awk '{total +=$5};END {print "Total size: " total/1024/1024 "MB" }'
/* Recursive directory size calculations in MB */
67.  Click here for more information mkisofs -l -L -r -o [image-name].iso [directory]
/* Create an ISO image of a directory */
68.  Click here for more information mount -F ufs -o rw,remount /
/* Used to remount root to make it writeable */
69.  Click here for more information mount -o remount,logging /spare
/* Re-mount the ro file system rw and turn on ufs logging */
70.  Click here for more information mount DOS fdisk partition from Solaris
/* mount -f pcfs /dev/dsk/c0d0p1 /export/dos */
71.  Click here for more information mv [filename]{,.new_suffix}
/* Renaming file */
72.  Click here for more information pax -rw . /newdir
/* Efficient alternative for copying directories */
73.  Click here for more information prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
/* Cloning Partitiontables */
74.  Click here for more information rpm -q --queryformat '%{INSTALLPREFIX}\n' [packagename]
/* [Linux] Locate binaries */
75.  Click here for more information tar cf - . | (cd /newdir ; tar xf -)
/* Recursively copy files and their permissions */
76.  Click here for more information tar cvf filename.tar
/* Create a tape (tar) archive */
77.  Click here for more information tar xvf filename.tar
/* Extract a tape (tar) archive */
78.  Click here for more information X=$(wc -l < filename); echo $X
/* Count number of lines in a file into a variable (ksh) */
79.  Click here for more information zcat <patch_file.tar.Z | tar xvf -
/* Extract the patch_file that is a compressed tar file */
80.  Click here for more information zcat [cpio file] | cpio -itmv
/* Show the contents of a compressed cpio */

Back to top

 

File Transfer
81.  Click here for more information find . -depth | cpio -pdmv /path/tobe/copied/to
/* Fast alternative to cp -pr */
82.  Click here for more information find . -follow | cpio -pdumL /path/tobe/copied/to
/* Copy with symbolic links to be followed */
83.  Click here for more information get filename.suffix |"tar xf -"
/* Undocumented Feature of FTP */
84.  Click here for more information Move any file(s) without actually touching them
/* ssh cd /some/directory \&\& tar cf - | ssh cd /some/direstory \&\& tar xvf - */
85.  Click here for more information put "| tar cf - ." filename.tar
/* Undocumented Feature of FTP */
86.  Click here for more information sendport
/* FTP command for transferring large numbers of files within the same control session */

Back to top

 

General
87.  Click here for more information /bin/printf '%d\n' '0x<hex>'
/* Converts hexadecimal number to decimal. */
88.  Click here for more information /usr/bin/catman -w
/* Create windex databases for man page directories */
89.  Click here for more information echo 'obase=16;255' | bc
/* Simple way to convert decimal to hex */
90.  Click here for more information FQ_FILENAME=<fully_qualified_file_name>; echo ${FQ_FILENAME%/*}
/* Extract directory from fully-qualified file name. */
91.  Click here for more information mailx -H -u <username>
/* List out mail headers for specified user */
92.  Click here for more information ps -ef | grep -i $@
/* Access common commands quicker */
93.  Click here for more information set filec
/* Set file-completion for csh */
94.  Click here for more information uuencode [filename] [filename] | mailx -s "Subject" [user to mail]
/* Send files as attachments */
95.  Click here for more information xauth -f /home/${LOGNAME} extract - ${DISPLAY} | xauth merge -
/* Allow root to xdisplay after su */

Back to top

 

Hardware
96.  Click here for more information cfgadm
/* Verify reconfigurable hardware resources */
97.  Click here for more information m64config -depth 8|24
/* Sets the screen depth of your M64 graphics accelerator */
98.  Click here for more information m64config -prconf
/* Print M64 hardware configuration */
99.  Click here for more information m64config -res 'video_mode'
/* Change the resolution of your M64 graphics accelerator */
100.  Click here for more information prtpicl -v | grep sync-speed
/* Discover SCSI sync speed */

Back to top

 

Kernel
101.  Click here for more information /usr/sbin/modinfo
/* Display kernel module information */
102.  Click here for more information /usr/sbin/modload <module>
/* Load a kernel module */
103.  Click here for more information /usr/sbin/modunload -i <module id>
/* Unload a kernel module */
104.  Click here for more information /usr/sbin/sysdef
/* Show system kernal tunable details */
105.  Click here for more information nm -x /dev/ksyms | grep OBJ | more
/* Tuneable kernel parameters */
106.  Click here for more information update_drv -f [driver name]
/* Force a driver to reread it's .conf file without reloading the driver */

Back to top

 

Memory
107.  Click here for more information pagesize -a
/* Available page sizes for Solaris 9 */
108.  Click here for more information prtconf | grep Mem
/* Display Memory Size of the local machine. */

Back to top

 

Network Information
109.  Click here for more information arp -a
/* Ethernet address arp table */
110.  Click here for more information arp -d myhost
/* Delete an ethernet address arp table entry */
111.  Click here for more information lsof -iTCP@10.20.2.9
/* Display open files for internet address */
112.  Click here for more information named-xfer -z qantas.com.au -f /tmp/allip
/* Get All IP Addresses On A DNS Server */
113.  Click here for more information ndd /dev/arp arp_cache_report
/* Prints ARP table in cache with IP and MAC address */
114.  Click here for more information netstat -a | grep EST | wc -l
/* Displays number active established connections to the localhost */
115.  Click here for more information netstat -a | more
/* Show the state of all the sockets on a machine */
116.  Click here for more information netstat -i
/* Show the state of the interfaces used for TCP/IP traffice */
117.  Click here for more information netstat -k hme0
/* Undocumented netstat command */
118.  Click here for more information netstat -np
/* Similar to arp -a without name resolution */
119.  Click here for more information netstat -r
/* Show the state of the network routing table for TCP/IP traffic */
120.  Click here for more information netstat -rn
/* Displays routing information but bypasses hostname lookup. */
121.  Click here for more information snoop -S -ta [machine]
/* Snoop for network packets and get size and time stamp entries. */
122.  Click here for more information traceroute <ipaddress>
/* Follow the route to the ipaddress */

Back to top

 

Network Tuning
123.  Click here for more information /sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 255.255.0.0 broadcast 10.210.xxx.xxx
/* Virtual Interfaces */
124.  Click here for more information /sbin/ifconfig hme0:1 up
/* Bring virtual interface up */
125.  Click here for more information /usr/sbin/ndd -set /dev/hme adv_100fdx_cap 1
/* Nailling to 100Mbps */
126.  Click here for more information ifconfig eth0 10.1.1.1 netmask 255.255.255.255
/* Add an Interface */
127.  Click here for more information ifconfig eth0 mtu 1500
/* Change MTU of interface */
128.  Click here for more information ndd -set /dev/ip ip_addrs_per_if 1-8192
/* To set more than 256 virtual ip addresses. */
129.  Click here for more information ndd -set /dev/tcp tcp_recv_hiwat 65535
/* Increase TCP-receivebuffers on Sol2.5.1 systems with 100BaseTx */
130.  Click here for more information ndd -set /dev/tcp tcp_xmit_hiwat 65535
/* Increase TCP-transmitbuffers on Sol2.5.1 systems with 100BaseTx */

Back to top

 

Processes
131.  Click here for more information /usr/proc/bin/ptree <pid>
/* Print the parent/child process 'tree' of a process */
132.  Click here for more information /usr/proc/bin/pwdx <pid>
/* Print the working directory of a process */
133.  Click here for more information /usr/ucb/ps -aux | more
/* Displays CPU % usage for each process in ascending order */
134.  Click here for more information /usr/ucb/ps -auxww | grep <process name>
/* Gives the full listing of the process (long listing) */
135.  Click here for more information coreadm -i core.%f.%p
/* Append program name and process id to core file names */
136.  Click here for more information fuser -uc /var
/* Processes that are running from /var */
137.  Click here for more information ipcs
/* Report inter-process communication facilities status */
138.  Click here for more information kill -HUP `ps -ef | grep [p]roccess | awk '{print $2}'`
/* HUP any related process in one step */
139.  Click here for more information lsof -i TCP:25
/* Mapping port with process */
140.  Click here for more information pfiles <pid>
/* Shows processes' current open files */
141.  Click here for more information pkill -n <name>
/* Kill a process by name */
142.  Click here for more information prstat -a
/* An alternative for top command */
143.  Click here for more information ps -edf -o pcpu,pid,user,args
/* Nicely formatted 'ps' */
144.  Click here for more information ps -ef | grep -i <string> | awk '{ print $2 }'
/* Creates list of running PID by <string> */
145.  Click here for more information ps -ef | grep -i <string> | awk '{ print $2 }'
/* Creates list of running PID by */
146.  Click here for more information ps -ef | grep <process name> | grep -v grep | cut -c 10-15 | xargs kill -9
/* Find and kill all instances of a given process */
147.  Click here for more information ps -ef | more
/* Show all processes running */
148.  Click here for more information ps -ef|grep -v "0:00"|more
/* Gives you a list of any process with CPU time more than 0:00 */
149.  Click here for more information ps -eo pid,args
/* List processes in simplified format */
150.  Click here for more information ps -fu oracle|grep pmon
/* See which instances of Oracle are running */
151.  Click here for more information top -b 1
/* Returns the process utilizing the most cpu and quits */

Back to top

 

Resource Management
152.  Click here for more information /usr/bin/ldd [filename]
/* List the dynamic dependencies of executable files */
153.  Click here for more information /usr/proc/bin/pmap pid
/* Report address space map a process occupies */

Back to top

 

Route Configuration
154.  Click here for more information route add net 128.50.0.0 128.50.1.6 1
/* Add a route to the routing table */
155.  Click here for more information route change 128.50.0.0 128.50.1.5
/* Changes the destination address for a route */
156.  Click here for more information route delete net 128.50.0.0 128.50.1.6
/* Delete a route from the routing table */
157.  Click here for more information route flush
/* Flush the routing table, which will remove all entries */
158.  Click here for more information route get [hostname]
/* Which interface will be used to contact hostname */
159.  Click here for more information route monitor
/* Monitor routing table lookup misses and changes */

Back to top

 

Searching Items
160.  Click here for more information cat <filename> | awk '{if (substr($1,1,1) == '#') print $0 }'
/* Print all lines in a file beginning with a specific character */
161.  Click here for more information egrep "patterna|patternb" <filename>
/* Search for multiple patterns within the same file */
162.  Click here for more information find <start_path> -name "<file_name>" -exec rm -rf {} \;
/* Recursively finds files by name and automatically removes them */
163.  Click here for more information find . -type f -print | xargs grep -i [PATTERN]
/* Recursive grep on files */
164.  Click here for more information find . ! -mtime -<days> | /usr/bin/xargs rm -rf
/* Finds and removes files older than <days> specified */
165.  Click here for more information find . -exec egrep -li "str" {} \;
/* Find a string in files starting cwd */
166.  Click here for more information find . -mtime -1 -type f
/* Find recently modified files */
167.  Click here for more information find . -type f -exec grep "<sub-string>" {} \; -print
/* Find files (and content) containing <sub-string> within directory tree */
168.  Click here for more information find . -type f -exec grep -l "<sub-string>" {} \;
/* Find files (and content) containing <sub-string> within directory tree */
169.  Click here for more information find ./ \! -type f -exec ls -l {} \;|grep -v '^[l|p|s|-]'|grep -v 'total' | wc -l
/* Find number of directories under the current directory */
170.  Click here for more information find / -fstype nfs -prune -o fstype autofs -prune -o -name filename -print
/* find without traversing NFS mounted file systems */
171.  Click here for more information find / -mtime <# of days>
/* Find files modified during the past # of days */
172.  Click here for more information find / -perm -2 -a ! -type l
/* Find files writable by 'others' */
173.  Click here for more information find / -type f |xargs ls -s | sort -rn |more
/* List files taking up the most system space */
174.  Click here for more information find / -user <username>
/* Find all files owned by <username> */
175.  Click here for more information find / -xdev -type f -ls|sort -nr -k 7,7
/* Find largest files in a file system */
176.  Click here for more information find / | grep [file mask]
/* Fast way to search for files */
177.  Click here for more information find /proc/*/fd -links 0 -type f -size +2000 -ls
/* Find large files moved or deleted and held open by a process */
178.  Click here for more information grep <full_path_to_filename> /var/sadm/install/contents| awk '{ print $1 ' ' $10 }'
/* Find which package contains a particular file */
179.  Click here for more information ls -lR | grep <sub_string>
/* Fast alternative to find. */
180.  Click here for more information pkgchk -l -p /absolute/path/todir
/* Which package does this file belong to? */

Back to top

 

Security
181.  Click here for more information crypt <abc.cr> abc && rm abc.cr
/* Decrypting a file that has been encrypted */
182.  Click here for more information crypt <abc> abc.cr && rm abc
/* File encryption with crypt */
183.  Click here for more information echo 'Please go away' > /etc/nologin
/* Stops users logging in */
184.  Click here for more information find / -perm -0777 -type d -ls
/* Find all your writable directories */
185.  Click here for more information find / -type f -perm -2000 -print
/* Find all SGID files */
186.  Click here for more information find / -type f -perm -4000 -print
/* find all SUID files */
187.  Click here for more information getpwenc [encryption scheme] password
/* Genrate passwords for LDAP Using 'getpwenc' Utility */
188.  Click here for more information trap 'exit 0' 1 2 3 9 15
/* Trap specific signals and exit */
189.  Click here for more information vi -x [filename]
/* Encrypt a file with vi editor */

Back to top

 

Setting Term Options
190.  Click here for more information stty erase ^?
/* Set the delete key to delete a character */
191.  Click here for more information stty erase ^H
/* Set the backspace to delete a character */
192.  Click here for more information stty sane
/* Reset terminal after viewing a binary file. */
193.  Click here for more information tput rmacs
/* Reset to standard char set */

Back to top

 

Snoop
194.  Click here for more information snoop -d pcelx0
/* Watch all the packets on a device */
195.  Click here for more information snoop -i /tmp/mylog -o /tmp/newlog host1
/* Filter out all the host1 packets and write them to a new logfile */
196.  Click here for more information snoop -i /tmp/mylog -v -p101
/* Show verbose info on packet number 101 in the logfile */
197.  Click here for more information snoop -i /tmp/mylog host1 host2
/* View packets from a logfile between hosts1 and host2 */
198.  Click here for more information snoop -o /tmp/mylog pcelx0
/* Save all the packets from a device to a logfile */
199.  Click here for more information snoop -s 120
/* Return the first 120 bytes in the packet header */
200.  Click here for more information snoop -v arp
/* Capture arp broadcasts on your network */
201.  Click here for more information snoop port [port-number]
/* Monitor particular port for traffic */

Back to top

 

Swap Files
202.  Click here for more information mkfile -nv 10m /export/disk1/myswap
/* Makes an empty 10 Megabyte swapfile in /export/disk */
203.  Click here for more information mkfile -v 10m /export/disk1/myswap
/* Makes a 10 Megabyte swapfile in /export/disk */

Back to top

 

Swap Space
204.  Click here for more information swap -a /export/disk1/swapfile
/* Add a swap file */
205.  Click here for more information swap -d /dev/dsk/c0t0d0s4
/* Delete a swap device */
206.  Click here for more information swap -l
/* List the current swap devices */
207.  Click here for more information swap -s
/* List the amount of swap space available */

Back to top

 

System Configuration
208.  Click here for more information /usr/sbin/eeprom auto-boot? false
/* Changes eeprom autoboot? setting without going to Ok prompt */
209.  Click here for more information /usr/sbin/eeprom diag-switch? true
/* Set the system to perform diagnostics on the next reboot. */
210.  Click here for more information /usr/sbin/eeprom local-mac-address?=true
/* Multiple Port Network Card Setting */
211.  Click here for more information /usr/sbin/grpck
/* Check /etc/group file syntax */
212.  Click here for more information /usr/sbin/pwck
/* Check /etc/passwd file syntax */
213.  Click here for more information /usr/sbin/sys-unconfig
/* Clear host specific network configuration information */
214.  Click here for more information /usr/sbin/useradd
/* Add a new user to the system */
215.  Click here for more information drvconfig ; disks
/* Adding hot-plug disks to system */

Back to top

 

System Information/Monitoring
216.  Click here for more information /bin/echo "0t${stamp}>Y\n<Y=Y" | adb
/* Convert UNIX timestamp to something human-readable */
217.  Click here for more information /usr/sbin/eeprom
/* Show eeprom parameters */
218.  Click here for more information /usr/sbin/prtconf -vp
/* Show system configuration details */
219.  Click here for more information coreadm -e log
/* Report global core */
220.  Click here for more information grep "\-root" /var/adm/sulog | grep -v \+ | tail -25
/* List most recent attempts to switch to superuser account. */
221.  Click here for more information isainfo -bv
/* Quickly checkout if machine is in 32 or 64 bit mode */
222.  Click here for more information last
/* Tells who was or still is on the system */
223.  Click here for more information logger -i
/* Log the process ID */
224.  Click here for more information prtconf -pv | grep banner-name |awk -F\' ' { print $2 } ' | head -1
/* Show actual model name of machine */
225.  Click here for more information prtdiag -v
/* System Diagnostics */
226.  Click here for more information prtpicl -v | grep wwn
/* A command to find persistent binding of storage */
227.  Click here for more information psradm -f [processor id]
/* Take processor offline */
228.  Click here for more information psrinfo | wc -l
/* Display number of processors */
229.  Click here for more information sar -u
/* Report CPU Utilization */
230.  Click here for more information sar [ -aA ] [ -o filename ] t [ n ]
/* Provides cumulative reports about system activity. */
231.  Click here for more information telnet <remote machine> 13 | grep ':'
/* Get the time on remote Unix machine */
232.  Click here for more information uname -a
/* Displays system information */
233.  Click here for more information uname -X
/* Displays system information */
234.  Click here for more information vmstat 10
/* Displays summary of what the system is doing every 10 seconds */
235.  Click here for more information who -b
/* Displays the date of the last system reboot. */
236.  Click here for more information ypcat hosts | sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4
/* Take the input of "ypcat hosts" or "cat /etc/inet/hosts" and sort by IP. */

BigAdmin
  
 
Download Opensolaris