Frequently, I find myself doing something (or rather, trying to do something) which I know is not particularly difficult, but I can't remember the specifics of how to do it. It could be redirecting STDERR from a command under bash, changing settings on my camera, or making MS Word behave the way I want it to.
So at some point, I began keeping a hierarchical collection of notes to remind myself how to do stuff. I call it my distilled wisdom. None of it's particularly profound. In fact, some of it's downright obscure ... useless to anyone in the world ... except for that one person who can't remember or doesn't know a given detail.
minute hour day-of-month month day-of-week command e.g.,
0 * * * * bin/whatever.bash > log 2>&1 1 1 * * * (cd /blah; ./blah) > /dev/null 2>&1Remember, it runs under /bin/sh, not whatever your personal default shell may be!
to start postmaster, use
pg_ctl start(has many options), e.g. -o -i to enable network connections
perl -e "print crypt('password','xX').'\n';"where xX is the salt. Of course, you could just use the Apache htpasswd command.
for i in *.java; do echo $i; done for i in *.java; do mv $i ${i%java}new_ext done(be sure not to quote the string to be expanded)
example: rename file000-t.jpg to thumb_file000.jpg:
for i in file*.jpg; do mv $i thumb_${i/-t/}; done
for ((i=0;i<10;i++)); do echo $i; done ((i=o)); while ((i<10)); do echo $i; ((i += 1)); done
bash: (cmd) 2>&1 | tee filespec
csh: (cmd) |& tee filespec
ls ab[c,d]
for f (*.conf) do set b=`echo $f | sed 's/\(.*\).conf/\1/'` echo $b
find . -mtime -1 | tar -czf - -T - | ssh host1 cat > file.tar.gz(finds files changed in last 24 hours, compress into tar stream, write tar file on host1)
find . -mtime -1 | tar -czf - -T - | ssh host1 tar -xvf -(finds files changed in last 24 hours, compress into tar stream, copy files to host1)
tar czvf - dirname | ssh host1 "cat - > dirname.tar.gz"(tars a directory onto a remote machine)
sort -u file1 > file1s sort -u file2 > file2s comm -2 -3 file1s file2s
(also see shell stuff)
ssh tunneling:
ssh -g -L localport:localhost:remoteport user@remotehost(connect port "localport" on localhost to port "remoteport" on remotehost... Now "telnet localhost localport" will go to remote host's remoteport)
ssh -L localport:remotehost:remoteport user@originatehost(creates a tunnel from localhost:localport to remotehost:remoteport, which will behave as if originating from originatehost.)
find . -name "*.html" -exec grep -il page {} \;(grep all html files for the word "page" without regard to case)
find . \( -iname "*.gif" -o -iname "*.jpg" \)(case insensitive find of jpg or gif files)
find -name '_most_recent' -prune , ! -name '_most_recent' -mtime -1 -ctime -1 -type d -print(Display any directories have been created or modified in the last day, excluding the dircetory named "_most_recent".)
apt-get update apt-get -u dist-upgrade
/etc/init.d/hylafax stop /etc/init.d/hylafax start /usr/local/sbin/faxmodem ttyS4
for sendfax -h flag to work w/out asking for password, put host in hylafax/etc/hosts.hfaxd
select * from v$session(or, depending on Oracle version, v_$session)
lsnrctl start exit svrmgrl connect internal startup exit
grant query rewrite to (account)
desc[ribe] [table or view name]
sqlplus user/pass @scriptname
select * from v_$datafile select * from USER_FREE_SPACE
archive log listenable or disable archiving:
alter system archive log (start/stop)
wet -> bisque, no measurable shrinkage.
bisque -> cone-10 reduction, 9.4% shrinkage (1" -> 29/32")
Tools-> AutoCorrect...-> AutoFormat tab -> uncheck "Internet and address path with hyperlinks"
Tools -> Options... -> Edit -> uncheck "When selecting, automatically select entire word"
tools -> customize... -> options -> uncheck "menus show recently used commands first"
C:\windows\system32\drivers\etc or C:\winnt\system32\drivers\etc