Archive for the ‘Unix’ Category
Tuesday, August 7th, 2007
Tip courtesy of Kyle Reynolds at http://www.camelrichard.org
vi reference
------------
Editing commands
Moving around the file
h cursor left j cursor right
k cursor up l cursor down
^ & B Beginning of line
$ end of line
) Next sentance
( Previous sentance
} Next Paragraph
{ Previous Paragraph
:$ end of file
w one character forward
W one word forward
:20 go to Line ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
Tip courtesy of Kyle Reynolds at http://www.camelrichard.org
Trusted authentication with OpenSSH
1. Change directory to the .ssh (hidden directory) located under your home
directory, or create it (mkdir -m 755 ~/.ssh).
2. Create the necessary 1024 bit public and private keys for type dsa, version 2,
of ssh (-t dsa).
ssh-keygen -t dsa -b 1024
3. ...
Posted in Unix | 1 Comment »
Tuesday, August 7th, 2007
Tip courtesy of Kyle Reynolds at http://www.camelrichard.org
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>
/<searchstring>/d
------------------------------------------------------------------------------------
addscript:
# adds the <newline entry> above any line containing <searchstring>
/<searchstring>/i\
<newline entry>
------------------------------------------------------------------------------------
addscript:
# adds the <newline ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
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 ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
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 ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
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 ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
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 ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
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 ...
Posted in Unix | No Comments »
Tuesday, August 7th, 2007
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 }'
Posted in Unix | No Comments »