tail -100 /var/log/messages | tee /var/log/messages
find /olddir -depth | cpio -pdvm ./newdir
[root@abc123 ~]# dumpe2fs /dev/cciss/c0d0p9
dumpe2fs 1.37 (21-Mar-2005)
Filesystem volume name:
Last mounted on:
Filesystem UUID: a525996f-d183-45bc-bb39-1dc4d5d82825
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Default mount options: (none)
...
cool.
Monday, December 3, 2007
cool stuffs
Posted by kapla.hodot at 11:52 1 comments
Tuesday, September 11, 2007
Thursday, August 23, 2007
HP-UX: Processors
[ROOT abc24]usr/sam # /usr/sbin/diag/contrib/pdcinfo -no_banner | grep "CPU("
CPU(0) PA8700 3.1
CPU(1) PA8700 3.1
CPU(2) PA8700 3.1
CPU(3) PA8700 3.1
CPU(0) PA8700 3.1
CPU(1) PA8700 3.1
CPU(2) PA8700 3.1
CPU(3) PA8700 3.1
[ROOT abc24]/tmp # echo "selclass qualifier cpu;info;wait;infolog" | cstm > /tmp/cpuinfo
[ROOT abc24]/tmp # more cpuinfo | grep "CPU Slot Number"
CPU Number: 0 CPU Slot Number: 0
CPU Number: 1 CPU Slot Number: 1
CPU Number: 2 CPU Slot Number: 2
CPU Number: 3 CPU Slot Number: 3
CPU Number: 8 CPU Slot Number: 0
CPU Number: 9 CPU Slot Number: 1
CPU Number: 11 CPU Slot Number: 3
[ROOT abc24]var/sam # icod_stat -p
Version: 4.0
Contract type: iCOD-purchase
License applied: yes
Hostname: abc24
DNS domain name: abc24.def.hij.com
IP address: 12.34.56.78
NIS domain name: .
System model: 9000/800/SD64000
Serial number: XX123456XX
Software ID: deadbeef
Contact name: UNIX Support
Contact e-mail: ux@gggi.com
Contact phone: (12)3456-6777
Total processors: 8
Active processors: 7
Inactive processors that can be activated: 1
Inactive processors that cannot be activated: 0
Deconfigured processors: 0
Requested active processors: 7
Requested active processors specified for all partitions:
Requested
Active Total
Processors Processors Partition
========== ========== =========
0 4 ux123 (par0)
7 8 Database abc24 (par1) (local)
4 4 App6 abc26 (par2)
2 4 QA App abc21 (par4)
n/a 0 Unassigned cells
---------------------------------------------------------
13 total requested active processors specified for complex
[ROOT abc24]var/sam #
PS: PA-8700 - single core CPU
Posted by kapla.hodot at 22:10 0 comments
Labels: HP-UX, UNIX/Linux Tips and Tricks
Wednesday, August 22, 2007
Commandszz
One command looks like interesting, worth to look up for this:
pax - Extracts, writes, and lists archive files; copies files and directory hierarchies
Nothing here yet!
Posted by kapla.hodot at 11:39 0 comments
Labels: UNIX/Linux Tips and Tricks
Tuesday, August 21, 2007
HP-UX, bdf, du and ...
If you ever encounter a file system full, say, at this particular partition:
[ROOT gitu2]Z24/X41 # uname -a
HP-UX gitu2 B.11.11 U 9000/800 170187401 unlimited-user license
[ROOT gitu2]Z24/X41 # bdf /usr/sap/Z24/X41
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol30 4620288 4610752 9038 100% /usr/sap/Z24/X41
[ROOT gitu2]Z24/X41#
and you have been trimming, deleting files like crazy, say, you've delete a 1.7G file but when you issue bdf, the utilization still at 100%. But when you checked with du, it shows the current utilization on that particular partition/directory has been reduced. WTF?!
Don't worry dude/dudette. Basically, there are some processes running that currently writing on some files on that directories and until those processes are stopped finishing writting you will not see the free space in bdf.
To identify the processes, run this:
[ROOT gitu2]Z24/X41 # fuser -cu /usr/sap/Z24/X41
/usr/sap/Z24/X41: 7314co(z24adm) 15790co(z24adm) 24426co(z24adm) 10374co(z24adm) 8094mcto(z24adm) 10514co(z24adm) 24418co(z24adm) 24433co(z24adm) 24458co(z24adm) 24432co(z24adm) 24446co(z24adm) 22457co(z24adm) 24385co(z24adm) 12656co(z24adm) 24444co(z24adm) 24439co(z24adm) 24442co(z24adm) 24451co(z24adm) 24438co(z24adm) 24386co(z24adm) 26313co(z24adm) 4756co(z24adm) 24428co(z24adm) 24435co(z24adm) 17512co(z24adm) 24459co(z24adm) 20846co(z24adm) 24431co(z24adm) 24460co(z24adm) 9184co(z24adm) 3585co(z24adm) 24440co(z24adm) 24448co(z24adm) 24417co(z24adm) 24430co(z24adm) 24443co(z24adm) 24338c(z24adm) 24441co(z24adm) 12555co(z24adm) 24461co(z24adm) 24434co(z24adm) 24436co(z24adm) 24445co(z24adm) 24429co(z24adm) 4539c(root) 24437co(z24adm) 11852co(z24adm) 24449co(z24adm) 24450co(z24adm) 26830co(z24adm) 28242c(root)
[ROOT gitu2]Z24/X41 #
Ah-ha! It will listed all the eeeviiilll processes. What you need to do is kill all those processes and voila!, you'll get your free space back.
** ACHTUNG **
Don't simply kill the processes until you pretty sure it is safe to kill with the owner of the processes (backup team, or whatever). Use j00r brain d00dz.
** ACHTUNG **
Posted by kapla.hodot at 11:21 0 comments
Labels: HP-UX, UNIX Troubleshooting, UNIX/Linux Tips and Tricks
Thursday, August 16, 2007
Nifty...
Are you a Firefox fan? You might wanna try this: Roll Your Own Firefox™ Search Bar
I've added search to USENET Internet FAQs Archive. Really nifty, I like!
Posted by kapla.hodot at 13:16 0 comments
Monday, August 13, 2007
Mari Tolak Beskal Session #1: FRIM "Dream Trail"
Yesterday my friend and I went to our first Bash (bike hash) at FRIM Dream Trail. Later lah full details.
Later lah, later. Sakit bontot+bahu lagi ni.
Posted by kapla.hodot at 11:34 1 comments
Labels: General Pot-Pet-Pot-Pet, Hash, MTB
Lesson Learned
Spending on more that 13 hrs in the office last Saturday gave us some real good lessons.
Lesson Learned:
1. Never worked on a RemoteConsole using init 5.
2. When try to trigger a system crash (echo c > /proc/sysrq-trigger - to test kdump), do it on a RemoteConsole terminal.
3. Use "Alt-Lock" on RemoteConsole for ease of navigating installation GUI.
Posted by kapla.hodot at 11:23 0 comments
Friday, August 10, 2007
Linux "grep -A1 -B1" in HP-UX
cat syslog.*.gz | gzip -d - | sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h
The cat syslog.*.gz | gzip -d - can also be replaced by using this command: gzcat < syslog.*.gz
Posted by kapla.hodot at 18:10 0 comments
HP-UX: kthread: table is full
If you ever encounter this error in dmesg or syslog.log
[root abc12]home/root # dmesg | tail
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
kthread: table is full
[root abc12]home/root #
[root abc12]home/root # cat /var/adm/syslog/syslog.log | grep kthread
Aug 9 21:37:12 abc12 vmunix: kthread: table is full
Aug 9 21:37:14 abc12 vmunix: kthread: table is full
Aug 10 14:07:18 abc12 vmunix: kthread: table is full
Aug 10 14:07:20 abc12 vmunix: kthread: table is full
[root abc12]home/root #
Then what you need to do is increase the maxusers kernel param in /stand/system
Steps:
1. Log in as root and edit/add maxusers 200 (16-way systems) or maxusers 400 (large 64-way systems i.e. SuperDome) in /stand/system
2. Run these commands:
mk_kernel -v -o /stand/vmunix
kmupdate
reboot -r
3. For God sake don't copy and paste the above commands, as the last command is reboot! Make sure you're safe/authorized to do a reboot before hitting the last command, or else, you're SuperDOOM.
To monitor the processes utilization, issue this command:
[root abc12]home/root # sar -v 1 5
HP-UX abc12 B.11.11 U 9000/800 08/10/07
17:58:07 text-sz ov proc-sz ov inod-sz ov file-sz ov
17:58:08 N/A N/A 172/664 0 1087/7360 0 1209/12018 0
17:58:09 N/A N/A 172/664 0 1087/7360 0 1209/12018 0
17:58:10 N/A N/A 172/664 0 1087/7360 0 1207/12018 0
17:58:11 N/A N/A 172/664 0 1087/7360 0 1207/12018 0
17:58:12 N/A N/A 172/664 0 1087/7360 0 1207/12018 0
[root abc12]home/root #
Look under proc-sz column, the 172/664 values represent the current number of processes (172) and the maximum number of processes (664).
To view the current value of maxusers:
[root abc12]home/root # cat /stand/system | grep maxusers
maxusers 200
[root abc12]home/root #
or
[root abc12]home/root # kmtune | sed q;kmtune | grep maxusersParameter Current Dyn Planned Module Version
maxusers 200 - 200
[root abc12]home/root #
*2nd option tu nampak cam terrer la sikit
If you wanna choose a less-headache version, use SAM. Don't know how to use SAM? Eat yourself.
Posted by kapla.hodot at 17:47 0 comments
Removing blank lines using grep
When you have something like this:
[root abcux]/tmp # cat lines.txt
line 1
line 3
line 4
line 9
line 10
#line 12
#line 15
line 16
[root abcux]/tmp #
but you want to exclude the blank lines and line starting with "#", do this...
[root abcux]/tmp # cat lines.txt | egrep -v "^#" | egrep -v "^$"
line 1
line 3
line 4
line 9
line 10
line 16
[root abcux]/tmp #
--- Update at 15:19
Another set of trick is to issue this command (thanks yoe!)
[root abcux]/tmp # cat lines.txt | egrep -v "^#" | egrep "."
line 1
line 3
line 4
line 9
line 10
line 16
[root abcux]/tmp #
Tadaa.
Posted by kapla.hodot at 09:00 1 comments
Thursday, August 9, 2007
Wednesday, August 8, 2007
Command History
Linux (BASH):
1. At the terminal, press CTRL+r and type in your command to search, i.e. vi (thanks yoe)
HP-UX (POSIX):
1. At the terminal, press ESC or > arrow and press k for up or j for down.
2. You can search your command history by pressing ESC key and / followed by your command and press ENTER.
Geddit?
Posted by kapla.hodot at 15:10 0 comments
Labels: UNIX/Linux Tips and Tricks
Monday, August 6, 2007
HP-UX Stuffs
1. List installed HP-UX patches
swlist -l product 'PH??_*'
2. ioscan command hang/slow.
Check for zombie processes of ioscan, try to kill 'em (if you know how to kill a ghost), or kill PPID (make sure PPID != 1 !!)
Posted by kapla.hodot at 18:15 0 comments
Thursday, August 2, 2007
Wednesday, August 1, 2007
File name completion in HP-UX
Since HP-UX using POSIX shell, the file name completion is different than Linux's.
To do a file name completion, simply press ESC and =
Example:
[ux]home/saya $ cd .s<ESC>=
1) .sh_history
2) .ssh/
[ux]home/saya $ cd .s
It will list down possible filename/directory available in the pwd. Note that a directory will have trailing char "/"
To find out which shell your using, simply type:
[ux]home/saya$ echo $SHELL
/sbin/sh
[ux]home/saya$Pathname Shell sh Bourne shell csh C shell tcsh TC shell ksh Korn shell bash Bourne Again SHell
--- Update 22 August 2007
Boleh jugak wat camnih (ESC twice):
[ux]home/saya$ cat abc<ESC><ESC>
[ux]home/saya$ cat abcdef.txt
saya suka makan nasik
[ux]home/saya$
Posted by kapla.hodot at 11:08 1 comments
Labels: UNIX/Linux Tips and Tricks
SSH weirdness
Since this is my first time encounter this type of SSH error, so it was weird.
abc123 % ssh def456
Secure connection to def456 refused; reverting to insecure method.
Using rsh. WARNING: Connection will not be encrypted.
Password:
I was like, wtf?
As usual, I asked Google and got some insights. Basically those error generated if you're trying to ssh to a Windows NT(?) or maybe the ssh daemon on the remote server is not running.
In my case, I found out that def456 was pointing to a different IP and my intelligent guess would be that IP belongs to a Winblows machine.
Posted by kapla.hodot at 09:20 0 comments
Tuesday, July 31, 2007
LVM
[ROOT abc123]home/root # uname -a
HP-UX abc123 B.11.11 U 9000/800 170187401 unlimited-user license
[ROOT abc123]home/root # lvextend -L 600 /dev/vgs12xyz/lvxyz
[ROOT abc123]home/root # fsadm -F vxfs -b $((600*1024)) /db99/S99/db
Note: If you encounter "errno 28" then you need to free up some space before extending the fs
Posted by kapla.hodot at 17:15 0 comments
Labels: UNIX/Linux Tips and Tricks
Monday, July 30, 2007
SunOS: Route delete problem
If you ever encouter problem deleting routing in SunOS, make sure you specify the netmask.
For example:
1. add routing:
root@xyz # route add -net 123.45.57.0 34.56.78.1 -netmask 255.255.255.192
2. out of no reason, you want to delete routing that u just add:
root@xyz # route delete -net 123.45.57.0 34.56.78.1
delete net 123.45.57.0: gateway 34.56.78.1: not in table
root@xyz #
you will received error msg as above.
So, what you need to do is to specify the netmask, such as:
root@xyz # route delete -net 123.45.57.0/26 34.56.78.1
* to check netmask for the specific entry, use command: root@xyz # netstat -rvn
Voila!
Posted by kapla.hodot at 13:39 0 comments
Labels: UNIX Troubleshooting
Friday, July 27, 2007
..
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
'Nuff said.
Posted by kapla.hodot at 18:41 5 comments
Monday, July 23, 2007
Still... haven't started my engine..
For the past 2 weeks, I've done nothing but trained myself to familiarize with new surroundings, new tasks that I'm gonna be in deep shit later, and finding the right food(s) to eat when it is time to eat.
I would say, I enjoy the every bit of that moment, saving it up for the future.
Well, today, I started to get bored. So I took up some problem(s) and put it in my basket.
I'm not much of a writer, so if you found my writing sucks, put your socks in your mouth.
One interesting problem that I found is on system running UNITED Linux on IBM BladeCenter. Apprarently, some weird error(s) were generated that makes us engineers annoyed.
It all started when one lucky engineer stumbled upon syslog message that looks like this:
Jul 13 14:26:34 abc123 kernel: sdb : READ CAPACITY failed.
Jul 13 14:26:34 abc123 kernel: sdb : status = 1, message = 00, host = 0, driver = 08
Jul 13 14:26:34 abc123 kernel: Current sd00:00: sense key Not Ready
Jul 13 14:26:34 abc123 kernel: Additional sense indicates Medium not present
Jul 13 14:26:34 abc123 kernel: sdb : block size assumed to be 512 bytes, disk size 1GB.
Jul 13 14:26:34 abc123 kernel: sdb: Write Protect is on
Jul 13 14:26:34 abc123 kernel: sdb: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 2097144
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 2097144
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: unable to read partition table
Jul 13 14:26:35 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:35 abc123 kernel: sdb : READ CAPACITY failed.
Jul 13 14:26:35 abc123 kernel: sdb : status = 1, message = 00, host = 0, driver = 08
Jul 13 14:26:35 abc123 kernel: Current sd00:00: sense key Not Ready
Jul 13 14:26:35 abc123 kernel: Additional sense indicates Medium not present
Jul 13 14:26:35 abc123 kernel: sdb : block size assumed to be 512 bytes, disk size 1GB.
Jul 13 14:26:35 abc123 kernel: sdb: Write Protect is on
At first I thought the harddisk went into the toilet already, but, is there any harddisk that can enable Write Protect? When I checked the hardware dbase, the /dev/sdb is *NOT* a harddisk. So I started to dig deeper and found out that /dev/sdb is a device from TEAC with model no. FD-05PUB. What the f..? *FD*? FD == Floppy Disk? The right place to ask is here. So I Google up and found this one interesting PDF document.
In that document, under section 4.5 "Issues related to Red Hat AS 2.1/3.0 and Blades" stated that:
[quote]
When a blade boots and the media tray is assigned to during boot up, the floppy drive in the media tray is assigned as (in this example) /dev/sdc. However, since there is no diskette in the drive, we see the following errors (beginning at READ CAPACITY FAILED):
Nov 5 09:44:30 spencerooni kernel: hub.c: new USB device 00:0f.2-1.1, assigned address 3
Nov 5 09:44:30 spencerooni kernel: usb.c: USB device 3 (vend/prod 0x644/0x0) is not claimed by any active driver.
Nov 5 09:44:30 spencerooni kernel: hub.c: new USB device 00:0f.2-1.3, assigned address 4
Nov 5 09:44:30 spencerooni kernel: usb.c: USB device 4 (vend/prod 0x5ab/0x30) is not claimed by any active driver.
Nov 5 09:44:30 spencerooni kernel: Initializing USB Mass Storage driver...
Nov 5 09:44:30 spencerooni kernel: usb.c: registered new driver usb-storage
Nov 5 09:44:30 spencerooni kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Nov 5 09:44:30 spencerooni kernel: Vendor: TEAC Model: FD-05PUB Rev: 2000
Nov 5 09:44:30 spencerooni kernel: Type: Direct-Access ANSI SCSI revision: 02
Nov 5 09:44:30 spencerooni kernel: Attached scsi removable disk sdc at scsi1, channel 0, id 0, lun 0
Nov 5 09:44:30 spencerooni kernel: sdc : READ CAPACITY failed.
Nov 5 09:44:30 spencerooni kernel: sdc : status = 1, message = 00, host = 0, driver = 08
Nov 5 09:44:30 spencerooni kernel: Current sd00:00: sense key Not Ready
Nov 5 09:44:30 spencerooni kernel: Additional sense indicates Medium not present
Nov 5 09:44:30 spencerooni kernel: sdc : block size assumed to be 512 bytes, disk size 1GB.
Nov 5 09:44:30 spencerooni kernel: sdc: I/O error: dev 08:20, sector 0
Nov 5 09:44:30 spencerooni kernel: I/O error: dev 08:20, sector 0
Nov 5 09:44:30 spencerooni kernel: unable to read partition table
Now, that wouldn't be the end of the world, necessarily, However, ANYTIME the KVM is switched on the Bladecenter to/from that blade, the USB "stuff" (KVM and media tray) get re-hotplugged, for lack of a better term, and the sdc errors are generated. They occur even after switch the media tray owner to a different blade. The result is too many spurious errors which is making the internal support team cranky.
Modification 1: Do not boot blade with media tray assigned in order to avoid errors when someone takes the media tray away AND when the floppy drive is empty. NOTE: "alias floppy off" should be added to modules.conf to avoid floppy drive errors when media tray not assigned on boot.
One final note on this item: currently the media tray is required for installing Linux on the blades, but should only be needed in rare circumstances after that. Additionally, since there appear to be several combinations of events that will cause the EFI shell boot option to be restored in the boot sequence on a blade (see item 4), it is recommended that boot sequence be confirmed when an HS40 is rebooted until the firmware fix is released. This can be done by simply confirming that the
HS40 boots from the HBA during a restart. So these items should be included as required steps for building a Linux blade.
Modification 2: Leave read-only floppy diskette in the drive. This prevents the "Medium not present" errors from occurring. This is not a complete solution but is a good start. See #3 for more.
Modification 3: When media tray is assigned to a blade, it will automatically hotplug itself and the cdrom and floppy drive will be available for use. When use
media tray should be unassigned from the blade and/or the usb-storage module should be removed. The command for this is "rmmod usb-storage".
This step should also be performed when the IBM Remote Disk is used. The IBM Remote Disk is the feature where an image, or even the local floppy or CDROM drive can be mounted on the blade from the local machine.
I have not seen anything to indicate that a Red Hat kernel fix can be completed to prevent these error messages from being generated.
[/quote]
Pfft.
-- Updates on 27 July 2007
The modification 1 didn't work. Didn't have nerve to do "rmmod usb-storage", but it will be my last resort. Currently opting to disable the drive in the BIOS. Heh.
-- Updates on 30 July 2007
Gave advice to ignore the error message since it didn't effect the system performance. Kapisch?
Posted by kapla.hodot at 22:38 2 comments
Labels: Linux Troubleshooting
Sunday, July 22, 2007
300 new servers? By next Tuesday?
(In following examples, we will substitute the name "Ted" as the System Administrator)
8th Annual System Administrator Appreciation Day
Advice to employees on the proper use of the System Administrator's valuable time
* Make sure to save all your MP3 files on your network drive. No sense in wasting valuable space on your local drive! Plus, Ted loves browsing through 100+ GB of music files while he backs up the servers.
* Play with all the wires you can find. If you can't find enough, open something up to expose them. After you have finished, and nothing works anymore, put it all back together and call Ted. Deny that you touched anything and that it was working perfectly only five minutes ago. Ted just loves a good mystery. For added effect you can keep looking over his shoulder and ask what each wire is for.
* Never write down error messages. Just click OK, or restart your computer. Ted likes to guess what the error message was.
* When talking about your computer, use terms like "Thingy" and "Big Connector."
* If you get an EXE file in an email attachment, open it immediately. Ted likes to make sure the anti-virus software is working properly.
* When Ted says he coming right over, log out and go for coffee. It's no problem for him to remember your password.
* When you call Ted to have your computer moved, be sure to leave it buried under a year-old pile of postcards, baby pictures, stuffed animals, dried flowers, unpaid bills, bowling trophies and Popsicle sticks. Ted doesn't have a life, and he finds it deeply moving to catch a glimpse of yours.
* When Ted sends you an email marked as "Highly Important" or "Action Required", delete it at once. He's probably just testing some new-fangled email software.
* When Ted's eating lunch at his desk or in the lunchroom, walk right in, grab a few of his fries, then spill your guts and expect him to respond immediately. Ted lives to serve, and he's always ready to think about fixing computers, especially yours.
* When Ted's at the water cooler or outside taking a breath of fresh air, find him and ask him a computer question. The only reason he takes breaks at all is to ferret out all those employees who don't have email or a telephone.
* Send urgent email ALL IN UPPERCASE. The mail server picks it up and flags it as a rush delivery.
* When the photocopier doesn't work, call Ted. There's electronics in it, so it should be right up his alley.
* When you're getting a NO DIAL TONE message at your home computer, call Ted. He enjoys fixing telephone problems from remote locations. Especially on weekends.
* When something goes wrong with your home PC, dump it on Ted's chair the next morning with no name, no phone number, and no description of the problem. Ted just loves a good mystery.
* When you have Ted on the phone walking you through changing a setting on your PC, read the newspaper. Ted doesn't actually mean for you to DO anything. He just loves to hear himself talk.
* When your company offers training on an upcoming OS upgrade, don't bother to sign up. Ted will be there to hold your hand when the time comes.
* When the printer won't print, re-send the job 20 times in rapid succession. That should do the trick.
* When the printer still won't print after 20 tries, send the job to all the printers in the office. One of them is bound to work.
* Don't use online help. Online help is for wimps.
* Don't read the operator's manual. Manuals are for wussies.
* If you're taking night classes in computer science, feel free to demonstrate your fledgling expertise by updating the network drivers for you and all your co-workers. Ted will be grateful for the overtime when he has to stay until 2:30am fixing all of them.
* When Ted's fixing your computer at a quarter past one, eat your Whopper with cheese in his face. He functions better when he's slightly dizzy from hunger.
* When Ted asks you whether you've installed any new software on your computer, LIE. It's no one else's business what you've got on your computer.
* If the mouse cable keeps knocking down the framed picture of your dog, lift the monitor and stuff the cable under it. Those skinny Mouse cables were designed to have 55 lbs. of computer monitor crushing them.
* If the space bar on your keyboard doesn't work, blame Ted for not upgrading it sooner. Hell, it's not your fault there's a half pound of pizza crust crumbs, nail clippings, and big sticky drops of Mountain Dew under the keys.
* When you get the message saying "Are you sure?", click the "Yes" button as fast as you can. Hell, if you weren't sure, you wouldn't be doing it, would you?
* Feel perfectly free to say things like "I don't know nothing about that boneheaded computer crap." It never bothers Ted to hear his area of professional expertise referred to as boneheaded crap.
* Don't even think of breaking large print jobs down into smaller chunks. God forbid somebody else should sneak a one-page job in between your 500-page Word document.
* When you send that 500-page document to the printer, don't bother to check if the printer has enough paper. That's Ted's job.
* When Ted calls you 30 minutes later and tells you that the printer printed 24 pages of your 500-page document before it ran out of paper, and there are now nine other jobs in the queue behind yours, ask him why he didn't bother to add more paper.
* When you receive a 130 MB movie file, send it to everyone as a high-priority mail attachment. Ted's provided plenty of disk space and processor capacity on the new mail server for just those kinds of important things.
* When you bump into Ted in the grocery store on a Sunday afternoon, ask him computer questions. He works 24/7, and is always thinking about computers, even when he's at super-market buying toilet paper and doggie treats.
* If your son is a student in computer science, have him come in on the weekends and do his projects on your office computer. Ted will be there for you when your son's illegal copy of Visual Basic 6.0 makes the Access database keel over and die.
* When you bring Ted your own "no-name" brand PC to repair for free at the office, tell him how urgently he needs to fix it so you can get back to playing EverQuest. He'll get on it right away, because everyone knows he doesn't do anything all day except surf the Internet.
* Don't ever thank Ted. He loves fixing everything AND getting paid for it!
Posted by kapla.hodot at 15:49 0 comments
Labels: General Pot-Pet-Pot-Pet
Wednesday, July 11, 2007
Gentlemen, start your engines!
Well, basically I haven't started mine. Just got my new laptop on Monday and had been messing around this new gadget for 2 days already. But today is even better, I started to read, alot. So, don't expect any intelligent post(s) for today.
The new environment is, of course, different. But kinda like it here. Hopefully this gonna be my next long stop.
There's a lot of new things that I need to digest real quick and pray to God my brain won't explode. Those 'things' are most welcome by my brain, maybe because I'm new here, or maybe because of my willingness to accept that 'things'. I've been waiting for a very long time to learn that new 'things'!! Have you ever seen so damn many 'things' in one para? I know I did.
New friends, new workplace, new cubicle, new laptop, and (soon) new headache(s).
Oo-lala.
Posted by kapla.hodot at 18:50 1 comments
Labels: General Pot-Pet-Pot-Pet
Sunday, July 8, 2007
The new beginning
Well, last Friday was my last day at SXXX. I missed my colleagues already. I missed the sweet old days I had with em and yah, the bitter days. But, a man's gotta do what a man's gotta do.
Tomorrow will be the new era of my life. I'm gonna start doing system administration, the one that has been one of my passion all this time. All that I hope is that my passion will eventually lead me somewhere far.
I'm not the type who has a lot of idea to write/type, especially when I'm started to write, so I'm gonna stop right here, for today of course.
Wish me luck, and God Bless you all.
Posted by kapla.hodot at 11:04 5 comments
Labels: General Pot-Pet-Pot-Pet
Tuesday, July 3, 2007
awk notes
AWK syntax:
awk [-Fs] "program" [file1 file2...] # commands come from DOS cmdline
awk 'program{print "foo"}' file1 # single quotes around double quotes
# NB: Don't use single quotes alone if the embedded info will contain the
# vertical bar or redirection arrows! Either use double quotes, or (if
# using 4DOS) use backticks around the single quotes: `'NF>1'`
# NB: since awk will accept single quotes around arguments from the
# DOS command line, this means that DOS filenames which contain a
# single quote cannot be found by awk, even though they are legal names
# under MS-DOS. To get awk to find a file named foo'bar, the name must
# be entered as foo"'"bar.
awk [-Fs] -f pgmfile [file1 file2...] # commands come from DOS file
If file1 is omitted, input comes from stdin (console).
Option -Fz sets the field separator FS to letter "z".
AWK notes:
"pattern {action}"
if {action} is omitted, {print $0} is assumed
if "pattern" is omitted, each line is selected for {action}.
Fields are separated by 1 or more spaces or tabs: "field1 field2"
If the commands come from a file, the quotes below can be omitted.
Basic AWK commands:
-------------------
"NR == 5" file show rec. no. (line) 5. NB: "==" is equals.
{FOO = 5} single = assigns "5" to the variable FOO
"$2 == 0 {print $1}" if 2d field is 0, print 1st field
"$3 < 10" if 3d field < 10, numeric comparison; print line
'$3 < "10" ' use single quotes for string comparison!, or
-f pgmfile [$3 < "10"] use "-f pgmfile" for string comparison
"$3 ~ /regexp/" if /regexp/ matches 3d field, print the line
'$3 ~ "regexp" ' regexp can appear in double-quoted string*
# * If double-quoted, 2 backslashes for every 1 in regexps
# * Double-quoted strings require the match (~) character.
"NF > 4" print all lines with 5 or more fields
"$NF > 4" print lines where the last field is 5 or more
"{print NF}" tell us how many fields (words) are on each line
"{print $NF}" print last field of each line
"/regexp/" Only print lines containing "regexp"
"/text|file/" Lines containing "text" or "file" (CASE SENSITIVE!)
"/foo/{print "za", NR}" FAILS on DOS/4DOS command line!!
'/foo/{print "za", NR}' WORKS on DOS/4DOS command line!!
If lines matches "foo", print word and line no.
`"/foo/{print \"za\",NR}"` WORKS on 4DOS cmd line: escape internal quotes with
slash and backticks; for historical interest only.
"$3 ~ /B/ {print $2,$3}" If 3d field contains "B", print 2d + 3d fields
"$4 !~ /R/" Print lines where 4th field does NOT contain "R"
'$1=$1' Del extra white space between fields & blank lines
'{$1=$1;print}' Del extra white space between fields, keep blanks
'NF' Del all blank lines
AND(&&), OR(||), NOT(!)
-----------------------
"$2 >= 4 || $3 <= 20" lines where 2d field >= 4 .OR. 3d field <= 20
"NR > 5 && /with/" lines containing "with" for lines 6 or beyond
"/x/ && NF > 2" lines containing "x" with more than 2 fields
"$3/$2 != 5" not equal to "value" or "string"
"$3 !~ /regexp/" regexp does not match in 3d field
"!($3 == 2 && $1 ~ /foo/)" print lines that do NOT match condition
"{print NF, $1, $NF}" print no. of fields, 1st field, last field
"{print NR, $0}" prefix a line number to each line
'{print NR ": " $0}' prefix a line number, colon, space to each line
"NR == 10, NR == 20" print records (lines) 10 - 20, inclusive
"/start/, /stop/" print lines between "start" and "stop"
"length($0) > 72" print all lines longer than 72 chars
"{print $2, $1}" invert first 2 fields, delete all others
"{print substr($0,index($0,$3))}" print field #3 to end of the line
END{...} usage
--------------- END reads all input first.
1) END { print NR } # same output as "wc -l"
2) {s = s + $1 } # print sum, ave. of all figures in col. 1
END {print "sum is", s, "average is", s/NR}
3) {names=names $1 " " } # converts all fields in col 1 to
END { print names } # concatenated fields in 1 line, e.g.
+---Beth 4.00 0 #
input | Mary 3.75 0 # infile is converted to:
file | Kathy 4.00 10 # "Beth Mary Kathy Mark" on output
+---Mark 5.00 30 #
4) { field = $NF } # print the last field of the last line
END { print field }
PRINT, PRINTF: print expressions, print formatted
print expr1, expr2, ..., exprn # parens() needed if the expression contains
print(expr1, expr2, ..., exprn) # any relational operator: <, <=, ==, >, >=
print # an abbreviation for {print $0}
print "" # print only a blank line
printf(expr1,expr2,expr3,\n} # add newline to printf statements
FORMAT CONVERSION:
------------------
BEGIN{ RS=""; FS="\n"; # takes records sep. by blank lines, fields
ORS="\n"; OFS="," } # sep. by newlines, and converts to records
{$1=$1; print } # sep. by newlines, fields sep. by commas.
PARAGRAPHS:
-----------
'BEGIN{RS="";ORS="\n\n"};/foo/' # print paragraph if 'foo' is there.
'BEGIN{RS="";ORS="\n\n"};/foo/&&/bar/' # need both
;/foo|bar/' # need either
PASSING VARIABLES:
------------------
gawk -v var="/regexp/" 'var{print "Here it is"}' # var is a regexp
gawk -v var="regexp" '$0~var{print "Here it is"}' # var is a quoted string
gawk -v num=50 '$5 == num' # var is a numeric value
Built-in variables:
ARGC number of command-line arguments
ARGV array of command-line arguments (ARGV[0...ARVC-1])
FILENAME name of current input file
FNR input record number in current file
FS input field separator (default blank)
NF number of fields in current input record
NR input record number since beginning
OFMT output format for numbers (default "%.6g")
OFS output field separator (default blank)
ORS output record separator (default newline)
RLENGTH length of string matched by regular expression in match
RS input record separator (default newline)
RSTART beginning position of string matched by match
SUBSEP separator for array subscripts of form [i,j,...] (default ^\)
Escape sequences:
\b backspace (^H)
\f formfeed (^L)
\n newline (DOS, CR/LF; Unix, LF)
\r carriage return
\t tab (^I)
\ddd octal value `ddd', where `ddd' is 1-3 digits, from 0 to 7
\c any other character is a literal, eg, \" for " and \\ for \
Awk string functions:
`r' is a regexp, `s' and `t' are strings, `i' and `n' are integers
`&' in replacement string in SUB or GSUB is replaced by the matched string
gsub(r,s,t) globally replace regex r with string s, applied to data t;
return no. of substitutions; if t is omitted, $0 is used.
gensub(r,s,h,t) replace regex r with string s, on match number h, applied
to data t; if h is 'g', do globally; if t is omitted, $0 is
used. Return the converted pattern, not the no. of changes.
index(s,t) return the index of t in s, or 0 if s does not contain t
length(s) return the length of s
match(s,r) return index of where s matches r, or 0 if there is no
match; set RSTART and RLENGTH
split(s,a,fs) split s into array a on fs, return no. of fields; if fs is
omitted, FS is used in its place
sprintf(fmt,expr-list) return expr-list formatted according to fmt
sub(r,s,t) like gsub but only the first matched substring is replaced
substr(s,i,n) return the n-character substring of s starting at i; if n
is omitted, return the suffix of s starting at i
Arithmetic functions:
atan2(y,x) arctangent of y/x in radians in the range of -ã to ã
cos(x) cosine (angle in radians)
exp(n) exponential eü (n need not be an integer)
int(x) truncate to integer
log(x) natural logarithm
rand() pseudo-random number r, 0 ó r ó 1
sin(x) sine (angle in radians)
sqrt(x) square root
srand(x) set new seed for random number generator; uses time of day
if no x given
[end-of-file]
Er, I forgot where I got this notes. Sorry.
Posted by kapla.hodot at 10:15 0 comments
Labels: Shell Scripting
sed and awk notes
Some useful notes:
Chart of similar operations with sed and awk
--------------------------------------------
string
======
sed "s/from/to/" awk '{sub("from","to"); print}'
sed "s/from/to/g" awk '{gsub("from","to"); print}'
sed "s/from/to/3" awk '{$0=gensub("from","to",3); print}'
regex
=====
sed "s/reg.*$/_&_/" awk '{sub(/reg.*$/, "_&_"); print}'
sed "s/reg[ex]/YY/g" awk '{gsub(/reg[ex]/, "YY"); print}'
sed "s/reg[ex]/ZZ/4" awk '{$0=gensub(/reg[ex]/, "ZZ", 4); print}'
awk variable "var"
==================
sed "s/bang/boom/" awk -v var="bang" '{sub(var,"boom");print}'
sed "s/.*=/equ/5" awk -v var=".*=" '{$0=gensub(var,"equ",5);print}'
DOS variable "XY" with awk variable "z"
=======================================
[DOSPROMPT] C:\path> set xy=bangg*
sed "s/%XY%/boom/" awk -v z="%XY" '{sub(z,"boom"); print}'
sed "s/%XY%/boom/g" awk -v z="%XY" '{gsub(z,"boom"); print}'
sed "s/%XY%/boom/5" awk -v z="%XY" '{$0=gensub(z,"boom",5); print}'
interval expression, \{M,N\}
============================
sed "s/fo\{3,8\}/bar/" awk --re-interval '{sub(/fo{3,8}/, "bar");print}'
sed "s/fo\{3,8\}/bar/g"
awk --re-interval -v a="fo{3,8}" '{gsub(a,"bar");print}'
or
awk --re-interval -v a="fo\{3,8\}" '{gsub(a,"bar");print}'
DOS variable "HI", awk variable "j" with interval expression
============================================================
[DOSPROMPT] C:\path> set hi=Whe\{2,7\}!*
sed "s/%hi%/Zow!/" awk --re-interval -v j="%hi" '{sub(j,"Zow!"); print}'
sed "s/%hi%/Zow!/g" awk --re-interval -v j="%hi" '{gsub(j,"Zow!");print}'
[DOSPROMPT] C:\path> REM ... using a disk file ...
[DOSPROMPT] C:\path> echo {$0=gensub(j,"Zow!",5); print} >myfile.awk
sed "s/%hi%/Zow!/5" awk --re-interval -v j="%hi" -f myfile.awk
--
compiled by Eric Pement
on 03/20/2001 07:11pm
[end-of-file]
Taken from: http://www.student.northpark.edu/pemente/awk/awk_sed.txt
Posted by kapla.hodot at 09:49 0 comments
Labels: Shell Scripting
Monday, July 2, 2007
marriages
Lately, I received a lot of marriage invitations.. yeah of course, it's my friends that are getting married. Here some interesting excerpt of the ym conversation I just had with my friend:
kawanku: weih
kawanku: akad yg betul macam mana?
me: kitorang bukan forensic org bunuh2 org
kawanku: aku terima nikahnya blablaba dengan mas kahwinnya 80 ringgit tunaiiii?
kawanku: camtu ka?
me: ikut tok kadi la
me: lain imam lain akad
kawanku: takde la...korang takkan takde kaki kat mindef ke etc
kawanku: oo
kawanku: imam bagitau dulu cara nak jawab?
me: aah
me: dia bagitau dulu
me:
me: rilek aaaa
kawanku:
kawanku: elek aa ni
me:
me: aku nak letak dlm blog aku la conversation nih
me: hahaha
kawanku: hek ele
kawanku: haha
kawanku: ko ade blog ke weh?
kawanku: haha
kawanku: sial senyap2 tak kasitau
me: ok i'm putting it now
Hehe.
Posted by kapla.hodot at 17:28 0 comments
Labels: General Pot-Pet-Pot-Pet
Wednesday, June 27, 2007
yet another blog by another *NIX admin
The new beginning...
So far, I don't have any good idea what to write, so don't expect any intelligent post for the next couple of days (or maybe months!).
Stay tune for more updates!
Posted by kapla.hodot at 11:02 5 comments
Labels: General Pot-Pet-Pot-Pet