Unix Reqular Expressions Reference

August 7, 2007 – 8:05 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org Regular Expressions Reference Sheet ----------------------------------- Ctr     Definition                                                      ---     ----------                                                      ^       The pattern has to appear at the beginning of a string.         $       The pattern has to appear at the end of a string.               .       Matches any character.                                          []      Bracket expression. Matches one of any characters enclosed.     [^]     Negates a bracket expression. Matches one of any characters             EXCEPT those enclosed.  [-]     Range. Matches any characters within the range.                 ?       Preceeding item must match one or zero times.                   +       Preceeding item must match one or more times.                   *       Preceeding item must match zero or more times.                  ()      Parentheses. ...

Unix grep Command Notes and Examples

August 7, 2007 – 8:01 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org grep command notes and examples ------------------------------- grep [options] 'pattern' [file ...] Option  Description ------  ----------- -i      Ignore upper/lower case distinction. -n      Print matched lines and their line numbers. -c      Print only a count of the matching lines. -l      Print names of files with matching lines but not the lines. -h      Print matching lines but not the filenames. -v      Print all lines that don't match pattern. -s      Suppress error messages for non-existent or unreadable files. Symbol          Meaning ------          ------- ^               Match the beginning of a line. $               Match the end of a line. [...]           Match one from a set of ...

Unix Find Command Notes and Examples

August 7, 2007 – 7:59 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org find command notes and examples ------------------------------- find <where-to-look> <criteria< <what-to-do> There are several options for matching criteria: -atime n        File was accessed n days ago -mtime n        File was modified n days ago -size n         File is n blocks big (a block is 512 bytes) -type c         Specifies file type: f=plain text, d=directory -fstype typ     Specifies file system type: 4.2 or nfs -name nam       The filename is nam -user usr       The file's owner is usr -group grp      The file's group owner is grp -perm p         The file's access mode is p (where p is an ...

Unix CVS Basics

August 7, 2007 – 7:54 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org cvs basics ---------- remote settings on client (for tcsh) setenv CVSROOT ":ext:username@192.168.1.188:/usr/local/cvsroot"  # <<path to cvsroot on remote server setenv CVSEDITOR vi setenv CVS_RSH ssh ------------------------------------------------------------------- cvs import -m "comments" projectname CVS_VENDOR_TAG CVS_RELEASE_TAG cvs checkout projectname cvs update projectname cvs commit -m " message" projectname cvs release -d projectname cvs status projectname cvs log projectname cvs checkout -r 1.1 projectname cvs up -A projectname            # (returns to previous version)

Unix Cron Basics

August 7, 2007 – 7:53 pm
Tip courtesy of Kyle Reynolds at http://www.camelrichard.org An entry in cron is made up of a series of fields, much like the /etc/passwd
file is, but in the crontab they are separated by a space. There are normally
seven fields in one entry. The fields are: minute hour dom month dow user cmd minute  This controls what minute of the hour the command will run on,
         and is between '0' and '59'
hour    This controls what hour the command will run on, and is specified in
         the 24 hour clock, values must be between 0 and 23 (0 is midnight)
dom     ...

Unix AWK Examples

August 7, 2007 – 7:52 pm
Tip courtesy of Kyle Reynolds at http://www.camelrichard.org extract third field separated by space
--------------------------------------
awk '{ print $3 }' extract third field separated by tab
------------------------------------
awk -F'\t' '{ print $3 }' extract lines where third field is "111" separated by tab
---------------------------------------------------------
awk -F'\t' '($3=="111")' extract third field where the second field is "1957"
----------------------------------------------------
awk '($2=="1957") { print $3 }'

Veritas Volume Manager Command Line Examples

August 7, 2007 – 7:46 pm
Tip courtesy of Kyle Reynolds at http://www.camelrichard.org Volume Manager CLI examples:
--------------------------- display disk listings:         # vxdisk list display volume manager object listings         # vxprint -ht display free space in a disk group              # vxdg -g <diskgroup> free        
list all volume manager tasks currently running on the system           # vxtask list add a disk to Volume Manager (devicename = cXtXdX) (prompt driven)
               
        # vxdiskadd <devicename> designate/remove a disk as a hot-relocation spare         # vxedit set spare=on <diskname>         # vxedit set spare=off <diskname> rename a disk         # vxedit rename <old_diskname> <new_diskname> reserve/unreserve a disk (space won't be allocated unless specifically mentioned in vxassist)         # vxedit set reserve=on ...

Solaris Limit Processes per User

August 7, 2007 – 7:44 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org  To limit processes per user /etc/system set maxuprc = number

How to Tell if Solaris is Configured For 32 or 64 Bit

August 7, 2007 – 7:42 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org If Solaris has been configured for 32 bit, the output of: isainfo -v   will be: 32-bit sparc applications ---- If Solaris has been configured for 64 bit, the output of: isainfo -v   will be: 64-bit sparcv9 applications 32-bit sparc applications ---- OR: isainfo -b will return either 32 or 64

How to Change IP and Hostname on a Solaris Box

August 7, 2007 – 7:41 pm
 Tip courtesy of Kyle Reynolds at http://www.camelrichard.org Change in the following files: ----------------------------- /etc/hosts /etc/netmasks /etc/defaultrouter /etc/hostname.(hme0)     >> type of network card specific /etc/nodename /etc/net/*/hosts /etc/passwd ----------------------------- **        rename the directory under /var/crash to match your new hostname ** &&        type hostname to view hostname &&        type hostname <newhostname> to change name without reboot To bind an IP address to a Network Interface Card   (example - hme0) ------------------------------------------------- ifconfig -a                                        << to check configuration ifconfig hme0 plumb                                << to enable the card ifconfig hme0 <ip address> netmask <subnet> up     << to bind and enable the configuration