UNIX


Tags:

I bought the professional version of Komodo 4, the multi-language Web-Dev IDE. I bought the personal version of 3.5 and actually started using it, so I decided to buy the professional version of 4 while ActiveState was offering me a big discount. I'm happy with it, but I spent a few hundred dollars on it before I realized this:

the Gui builder toolkit (previously present only in the pro version) has been removed from pro 4... and is now available for free here.


Tags:

                                  
editing commands

h    cursor left
j    cursor right
k    cursor up
l    cursor down
^    beginning of line  
$    end of line
)    next sentence 
(    previous sentence
}    next paragraph
{    previous paragraph 
:$   end of file
w    one character forward
W    one word forward
:10  go to line number (10)
.    repeats text
u    undo last change
U    undo changes to the current line
 

inserting and appending text

i    inserts text to the left of  cursor
I    inserts at the beginning of line 

Tags:

                                  
1. cd to '.ssh' directory in the home directory of the user you wish to create
keys for.  If the directory is not there, create it and 'chmod 700 .ssh'

2. create 1024 bit dsa key

ssh-keygen -t dsa -b 1024

where type is '-t dsa' and bits are '-b 1024'

3. When prompted for values, generally use the default names.  This will 
generate two files in the .ssh directory:

id_dsa      (private key file)
id_dsa.pub  (public key file)


Tags:

                                  

SED add/ delete/ replace
------------------------

sed -f <scriptname> <filename>  # runs the scripted commands against the <filename>

example:

sed -f deletescript myfile.ldif 
sed -f addscript newfile.ldif 

or from command line:

sed '/<searchstring>/d' filename

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

deletescript:

# deletes any line containing <searchstring>


Tags:

                                 
Regular Expressions Reference Sheet
-----------------------------------
                                                 
^       match pattern at beginning of string

$       match pattern at end of string               

.       match any single character (except newline)                                         

[]      match one of any characters enclosed within the []     
        [bBaA] matches b, B, a, and A

[^]     match one of any character EXCEPT those enclosed within the []  

Tags:

                                  
grep [options] 'pattern' [file ...]

Option  Description
------  -----------

-c      print only a count of the matching lines
-h      print matching lines but not the filenames
-i      ignore case 
-l      print names of files with matching lines but not the lines
-n      prefix match with line number
-r      recursive
-s      suppress error messages 
-v      print all lines that DON'T match pattern


Tags:
                                  
find <location> <criteria> <action>

criteria:

-atime n         accessed n days ago
-mtime n         modified n days ago
-size n[c]       n blocks (a block is 512 bytes) if followed by 'c', the number
                 is in bytes
-type type          file type: f=plain text, d=directory, etc...
-fstype type     file system type: ufs, nfs, etc...
-name name       name of file
-user user       owner of file
-group group     group of file
-o               or

-mtime +10       modified more than 10 days ago

Tags:

                                  
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


Tags:

                                  
cron fields

[minute] [hour] [day of month] [month] [day of week] [cmd]

minute           minute of the hour (0 - 59)
  
hour             hour of the day (0 - 23, 0 being midnight)

day of month     day of month (1 - 31)

month            month of the year (0 - 12)

day of week      day of week (0 - 7, Sunday being 0 or 7) 

cmd              path to command to be run 
 

examples

run every hour at 15 after the hour:
15 * * * * /usr/local/admin/bin/backup.sh


Tags:
                                  
extract second field separated by space (space is the default separator)
--------------------------------------
awk '{ print $2 }' 


extract second field separated by a tab
------------------------------------
awk -F'\t' '{ print $2 }' 


extract lines where second field is "TEST", separated by tab
---------------------------------------------------------
awk -F'\t' '($2=="TEST")'


extract second field where the third field is "TEST"
----------------------------------------------------
awk '($3=="TEST") { print $2 }'