"If you aim the gun at your foot and pull the trigger, it's UNIX's job to ensure reliable delivery of the bullet to where you aimed the gun (in this case, Mr. Foot)." -- Terry Lambert, FreeBSD-Hackers mailing list.
chkconfig --level 2345 ntpd on chkconfig --list ntpd service ntpd start service ntpd stop service ntpd restart /sbin/chkconfig --level 345 xntpd on /etc/rc.d/init.d/xntpd start
File::DosGlob (3) - DOS like globbing and then some filesystems: cdfs, dos, fat, EFS, hfs, mac, iso9660, cd-rom, kfs, nfs, XFS, rock ridge (4) - IRIX filesystem types fpck (1M) - check and repair either FAT (MSDOS) or HFS (MACINTOSH) filesystems mkfp (1M) - construct a FAT (MSDOS) or HFS (MACINTOSH) filesystem to_dos, to_unix (1) - convert text files between MSDOS and UNIX XmFileSelectionDoSearch (3X) - A FileSelectionBox function that initiates a directory search
You may want to add the "-u" option to ls to see last-accessed times rather than last-modified times (esp to help gauge how harmful it would be to unsetuid the file).
3.0 - How do you do a search and replace?
Well, there are a few methods. The simplest is:
:s/old/new/g
But, this only does it on the current line... So:
:%s/old/new/g
In general:
:[range]s/old/new/[cgi]
Where [range] is any line range, including line numbers, $ (end of
file), . (current location), % (current file), or just two numbers with
a comma or semicolon between them. (Or even: .,+5 to mean the next
five lines).
[cgi] is either c, g, i, or nothing. c tells vi to prompt you before
the changes, g to change all of the occurrences on a line. (type yes
to tell vi to change it.) i tells vi to be case insensitive on the
search. The g after the last slash tells it to replace more than just
the first occurrence on each line.
Another method is:
:g/foobar/s/bar/baz/g This searches for foobar, and changes it to
foobaz. It will leave jailbars alone, which the other method will not.
Unfortunately, if jailbars appears on the same line as foobar, it will
change, too.
Of course you can also use regular expression search patterns, and a
few other commands in the replacement part of the text. If you use \(
and \) in the pattern to escape a sequence (and use \1, \2, etc., you
can do lots of nifty things.
For example:
:g/foo/s/^\([^ ]*\) \([^ ]*\)/\2 \1/
will swap the first and second words on every line containing "foo".
Special sequences allowed are:
& everything which was matched by the search
\[1-9] The contents of the 1st-9th \(\) pair
\u The next character will be made uppercase
\U The characters until \e or \E will be made uppercase
\l The next character will be made lowercase
\L The characters until \e or \E will be made lowercase
\[eE] end the selection for making upper or lowercase
3.1 - My / key is broken! How can I search and replace?
Well, okay, it doesn't really need to be a /. Lots of things will
work fine. (letters, numbers and a few other things won't...)
I have a huge text file that has the ^m for the end of line symbol. I :knew a comand that i used once, but that was a long time ago. tr -d '\015' < huge-text-file > huge-text-file-without-^M There's also the to_unix command specific to IRIX.
Date: Sun, 23 Dec 2001 12:19:17 +1100 (EST)
To: Lachlan Cranswick [l.cranswick@dl.ac.uk]
Subject: ssh things ...
Lach,
Some time in the next few days I'll need to reconfig sshd so it no longer
accepts v.1 connections, ie: will accept v.2 only. The command for
generating v.2 keys is ssh-keygen -t rsa and ssh-keygen -t dsa and then
you append these to your authorized_keys file on the server.
Date: Fri, 28 Dec 2001 14:59:07 +1100 (EST)
To: Lachlan Cranswick [l.m.d.cranswick@dl.ac.uk]
Subject: SSH progressing slowly
SSH
___
I'm typing this up from the new windows ssh client from www.ssh.com
(I set it up on this (adjacent) windows PC last night). Works well
except for the restricted colour range.
Also upgraded ssh on bluehaze last night. I discovered (during make)
that I hadn't properly installed SSL either, so ended up having to
get a new one of that. Then discovered that the portable vers of SSH
on the Oz mirror was out of date - nothing after 2.9 unless you went for
the BSD version. So a bit of stuffing around before I managed to get a
version 3.0.2p. You know what it's like ... :-)
I made a DSA (v.2) key using this ssh client on windows, and added
that to my unix pub key-ring and it works (although sshd on bluehaze is
still allowing v.1 through at the moment). Because the client is SSH
rather than OpenSSH, you need to:
1) make a (DSA) key-pair with no passphrase in the ssh windows client,
(I just called mine "identity") - use "ssh-keygen2.exe"
2) find the files and copy the pub one over to your home dir on unix,
(mine were in Program Files\users\tonys on windoze)
3) convert it from SSH to OpenSSH format via "ssh-keygen -i -f identity.pub > xx"
(xx will now be in OpenSSH format)
4) append xx to "authorized_keys" in your .ssh dir
5) (important) go back to windows and now change the passphrase to a
non-empty one!
This recipe is just something they figured out at work. I suspect it's
done this way because they couldn't see any way of going backwards, ie:
taking the unix keys in "authorized_keys" and converting 'em into SSH
format on Windows?
Date: Sat, 5 Jan 2002 01:38:28 +1100 (EST) BTW, suggestion (last Wed) was "get rid of all old keys at dest machines and REPLACE them with the pair generated by the new Win SSH pgm". That is - avoid multiple keys. So after you generate the one keypair with a Win SSH, you plant those everywhere. For subsequent PCs, just copy them across. For unixes do the same - the Win SSH priv key becomes the unix "id_dsa" and the Win SSH .pub key goes into "authorised_keys" (after converting 'em both via ssh-keygen -i of course). You've probably worked that much out yourself, of course.
Bunging in a 7.1 Redhat Inst CD (disc #1) and typing "linux rescue" (on my desktop Win98 PC) seems to do interesting things. It fires up a small kernel and most commands seem to work. It even found a cpio. I have 6Gb put aside and fdisk is there so may set that up as a linux partition and recover a linux onto it as an experiment.
Always test available signatures, e.g., pgpk -a KEYS pgpv apache_1.3.19.tar.gz.asc or, pgp -ka KEYS pgp apache_1.3.19.tar.gz.asc
CC="cc -o32" ./configure
make
CC=cc ./configure
make
CC=cc CFLAGS="-n32 -O2" ./configure
make
at 1:00am tomorrow /web_disc/ccp14/cron_scripts/september2001_http_analyse.script Then [CONTROL D] to terminate and submit the job
at 1 am Tuesday /usr/local/scripts/iindex.script Then [CONTROL D] to terminate and submit the job
at 1:00am tomorrow /web_disc/ccp14/cron_scripts/september2001_http_analyse.script Then [CONTROL D] to terminate and submit the job
at midnight Apr 01 /web_disc/ccp14/cron_scripts/march2002_weblog_rotate.script Then [CONTROL D] to terminate and submit the job
at 1am Apr 01 /web_disc/ccp14/cron_scripts/march2002_http_analyse.script Then [CONTROL D] to terminate and submit the job
#!/bin/sh
# Usage: rgrep path string
# From http://www.xnet.com/~drwho/tricks/rgrep
# Put here 9th Nov 1998 - Lachlan Cranswick
# rgrep -- -recursively grep through files starting at path for string
find $1 -type f -exec sh -c 'grep $0 $1 && echo $1:' $2 \{} \;
config.cache should always be removed if you have changed the CC, CXX, CFLAGS or CXXFLAGS environment vars."
grep -v -i -e ".com - - \[" -e ".net - - \[" -e ".co.uk - - \[" \
-e ".co.jp - - \[" -e ".com.au - - \[" -e ".com.br - - \[" \
-e "0 - - \[" -e "1 - - \[" -e "2 - - \[" -e "3 - - \[" -e "4 - - \[" \
-e "5 - - \[" -e "6 - - \[" -e "7 - - \[" -e "8 - - \[" -e "9 - - \[" \
october1999_resolved.log > filtered/october1999_resolved.log_educational
In article [80o0g8$siq$1@news.ccit.arizona.edu], David Chalmers wrote:
>Is there a simple way to convert IP numbers to hostnames in a standard
>httpd access log file? I.e., some sort of script that takes a file
>with lines like this:
>
> 128.196.137.19 xxx yyy zzz
>
>and converts it to a file with lines like this:
>
> nevis.u.arizona.edu xxx yyy zzz
Simple? You call it. Here is a sed expression which changes a dotted-quad
IP address into the rDNS name of that address.
s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\4.\3.\2.\1.in-addr.arpa./
That is, echo 128.196.137.19 | sed -e \
's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\4.\3.\2.\1.in-addr.arpa./'
produces 19.137.196.128.in-addr.arpa.
And
nslookup -query=ptr 19.137.196.128.in-addr.arpa. | \
grep 'name =' | sed -e 's/.* //'
produces the canonical name nevis.U.Arizona.EDU for that address.
So, the solution looks something like this.
#!/bin/sh
E="\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\4.\3.\2.\1.in-addr.arpa."
while read number junk
do
rD=`echo $number | sed -e "s/$E/"`
CNAME=`nslookup -query=ptr $rD | grep 'name =' | sed -e 's/.* //'`
echo $CNAME $junk
done
You should add some error checking. The program isn't robust against
nonsense input. It won't be happy if the nslookup fails, as often happens.
It's not very efficient, either. A more elegant
arrangement would only invoke sed twice, instead of twice per line.
Cameron
"A regular expression is a way of specifying a very general string. The following regular expression symbols are treated specially: ^ start of line $ end of line . any character \ quote next character * match zero or more + match one or more [aeiou0-9] match a, e, i, o, u, and 0 thru 9 [^aeiou0-9] match anything but a, e, i, o, u, and 0 thru 9"
" c any non-special character represents itself \\c turns off the meaning of any special character ^ beginning of a line $ end of a line . matches any single character except a newline [...] matches any of the enclosed characters [^...] matches any character that is not enclosed [n-n] matches any character in this range * matches any number of the preceding character"
Database directory: /var/lib/ HTDOCS directory: /var/www/htdocs CGI-BIN directory: /var/www/cgi-bin cd /var/lib tar cf - mysql | gzip -c > mysql_icsd.tar.gz cd /var/www/htdocs tar cf - icsd | gzip -c > icsd.tar.gz tar cf - phpMyAdmin | gzip -c > phpMyAdmin.tar.gz tar cf - xrdnotebook | gzip -c > xrdnotebook.tar.gz tar cf - c2notebook | gzip -c > c2notebook.tar.gz cd /var/www/cgi-bin tar cf - c2notebook | gzip -c > c2notebook.tar.gz tar cf - xrdnotebook | gzip -c > xrdnotebook.tar.gz tar cf - icsd | gzip -c > icsd.tar.gz
-copy the file where you want it uncompressed (with GUI or 'cp' or 'mv' unix commands, see 'man cp'). -'cd /../your_dir' command. -'tar xvf your_file.tar'
> >Hmmm...does IRIX provide any sort of process tracing utility? > > Will have to check this out. 'par' I generally use (well. 'used'. I no longer admin irix boxes, as I have changed jobs): par -isSS <command> or: par -isSS -p <pidof process) I honestly don't remember everything those flags to, but I do know that it's roughly comparable to 'strace -f -c'. --noah
Change Your Drive’s Letter In Vista right click Computer and select Manage. Under Storage, click Disk Management
mysqlcheck -A -1 --user=root mysql --password=mysqlrootpassword
mysqlcheck --all-databases --auto-repair
to check, repair, and optimize every db on the system.
Try these commands:
find /var/lib/mysql -name '*.MYI' -exec myisamchk -r {} \;
find /var/lib/mysql -name '*.MYI' -exec myisamchk -o {} \;
service mysqld start
01 04 * * * rdate -s time.nrc.ca
ClientAliveInterval 15
ClientAliveCountMax 5
http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html
Here's how we would change the settings:
# echo 600 > /proc/sys/net/ipv4/tcp_keepalive_time
# echo 60 > /proc/sys/net/ipv4/tcp_keepalive_intvl
# echo 20 > /proc/sys/net/ipv4/tcp_keepalive_probes
From the sshd_config manpage:
ClientAliveInterval
Sets a timeout interval in seconds after which if no data has
been received from the client, sshd will send a message through
the encrypted channel to request a response from the client. The
default is 0, indicating that these messages will not be sent to
the client. This option applies to protocol version 2 only.
Example (send "keep alive" messages every 5 minutes) on Red Hat Linux:
1. Add ClientAliveInterval 300 to /etc/ssh/sshd_config
2. Reload the sshd server configuration with /sbin/service sshd reload
Daily Crontab With Multiple Commands
The double-ampersand (&&) can also be used in the command section to run
multiple commands consecutively.
45 04 * * * /usr/sbin/chkrootkit && /usr/bin/updatedb
/etc/resolv.conf
/etc/hosts
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
Date: Tue, 25 Jun 2002 22:29:21 +1000 (EST)
From: Tony
To: Lachlan Cranswick [l.cranswick@dl.ac.uk]
Subject: Win98 (if you're using it anywhere)
Yo,
Did you realise that DMA for hard disc I/O is *off* by default in Win98?
I just ran "dskbench" and got 11Mb/sec + 97% CPU utilisation. After ticking
DMA, this is now 11Mb/sec + 5% CPU utilisation. (With XP, it looks like it is
on by default) I can hardly believe this being off (ie: PIO) by default!
--
Cheers,
Tony
Control Panel -> System -> Device Manager then open up [+]Disk Drives; right-click on each drive to get Properties, then click on Settings Tab. There's a little tick-box for DMA. When u tick it, you'll receive dire warnings that you're about to destroy your hard drive and possibly every other hard drive on the planet. With it unticked, uses PIO (Polled IO) mode, which means that CPU has move the data itself (DMA chips look after the move with no CPU work required)
ACER Laptop 1 Boot to Windows XP. 2 Press Alt + F10 to open the Acer eRecovery Management utility. 3 Enter the password to proceed. The default password is six zeros. 4 In the Acer eRecovery Management window, select Recovery settings and click Next. 5 In the Recovery settings window, select Burn image to disk and click Next. 6 In the Burn image to disk window, select 1. Factory default image or 2. Application CD and click Next. 7 Follow the instructions on screen to complete the process. this will save a complete image of xp from the drive as it was released from Acer.
Better Yet, get the mondorescue.repo from the website, install it in /etc/yum.repos.d and then run yum install mondo. ---------- In your browser, Firefox I hope, go to www.mondorescue.org. Down the page a little a click on ftp://ftp.mondorescue.org -> fedora -> 10. Click on mondorescue.repo. Save the text that is displayed as mondorescue.repo. Exit the browser and open a terminal window and cd to where ever you saved the file. Then "sudo cp mondorescue.repo /etc/yum.repos.d". Finally in the terminal window "sudo you install mondo", it should pick up all of the required dependencies. cd /etc/yum.repos.d/ touch mondorescue.repo yum install mondo (failed due to dependency) cd /download/ wget ftp://ftp.mondorescue.org/fedora/7/afio-2.4.7-1.i386.rpm from fedora7 wget ftp://ftp.mondorescue.org/fedora/7/buffer-1.19-1.i386.rpm from fedora7 rpm -Uvh afio-2.4.7-1.i386.rpm rpm -Uvh buffer-1.19-1.i386.rpm yum install mondo