script: get uptime from /proc/uptime

Just a simple script to get uptime from /proc/uptime (which is in seconds)

# get uptime from /proc/uptime


seconds=$(( uptime%60 ))
minutes=$(( uptime/60%60 ))
hours=$(( uptime/60/60%24 ))
days=$(( uptime/60/60/24 ))

echo "$days days, $hours hours, $minutes minutes, $seconds seconds"

Ofcourse in the same way you could add months, years, decades etc.
you got the idea.

script: rename dirs to sequentially numbered ones

# renames dirs to sequentially
# numbered ones starting from 00001
# ex. 00001 00002 00003 00004 etc.
# questions? suggestions? comments?
# grulosΨ

cd $1 || exit 1
typeset -a files=(*)
typeset -i j=1

for i in "${files[@]}"; do

if [ -d "$i" ]; then
# infinite loop until we find the next
# numbered dir we are going to use

while true; do

# we want only 5 digits
# why didn't i just use printf "%05d" ? :P
fname=${fname:$(( ${#fname}-5 ))};

# check if the dir is already numbered
# in that case move to next dir
[ "$fname" == "$i" ] && j=$(( j+1 )) && break

if [ -d "$fname" ]; then
j=$(( j+1 ));
mv -- "$i" "$fname"

Now just choose the directory holding all the dirs you want to rename and just run it

~$ cd testdir/
~/testdir$ mkdir a b c d e f g h i 1 2 3
~/testdir$ cd ..
~$ ./ testdir/
~$ ls testdir/
00001/ 00002/ 00003/ 00004/ 00005/ 00006/ 00007/ 00008/ 00009/ 00010/ 00011/ 00012/

shell tip: echo * and printf

~$ mkdir testdir
~$ cd testdir
~/testdir$ touch -- -e \\141
~/testdir$ ls
-e \\141
~/testdir$ echo *
note i used '--' with touch so '-e' would not be used as an option.
So what happened here?
-e was passed to echo as an option.
echo *
echo '-e' '\141'
which interpreted correctly the \141 escape sequence as 'a'
If you're going to use * be careful. Avoid echo try printf.
In this case:
~/testdir$ printf "%s\n" *

shell tip: get parts of a filename

# works in bash, zsh and ksh93
~$ f=file.tar.bz2
~$ echo "${f##*.}"
~$ echo "${f#*.}"
~$ echo "${f%.*}"
~$ echo "${f%%.*}"

shell tip: var of var

~$ a=1
~$ b=a
~$ echo $((b))

password cracker John the Ripper v1.7 released

~/john-1.7/doc$ cat CHANGES
The following major changes have been made since John 1.6:

* Bitslice DES code for x86 with MMX: more than twice faster than older
non-bitslice MMX code.
* Bitsliced the LM hash code as well: now several times faster.
* Significant improvements to the generic bitslice DES code: +20% on RISC.
* PowerPC G4+ AltiVec support (Mac OS X and Linux): effective 128-bitness
for bitslice DES, resulting in huge speedups.
* First attempt at generic vectorization support for bitslice DES.
* Two MD5 hashes at a time for extra ILP on RISC: up to +80% on Alpha EV5+.
* Generic Blowfish x86 assembly code in addition to the original Pentium
version: +15% on the Pentium Pro family (up to and including Pentium III),
+20% on AMD K6 (Pentium 4 and newer AMD CPUs are more happy running the
original Pentium code for Blowfish).
* Verbose logging of events to the global or a session-specific log file.
* Better idle priority emulation with POSIX.1b (POSIX.4) scheduling calls.
* System-wide installation support for *BSD ports and Linux distributions.
* AIX, DU/Tru64 C2, HP-UX tcb files support in unshadow.
* New make targets for Linux/x86-64, Linux/PowerPC, FreeBSD/Alpha,
OpenBSD/x86-64, OpenBSD/Alpha, OpenBSD/SPARC, OpenBSD/SPARC64,
OpenBSD/PowerPC, OpenBSD/PA-RISC, OpenBSD/VAX, NetBSD/VAX, Solaris/SPARC64,
Mac OS X (PowerPC and x86), SCO, BeOS.
* Bug and portability fixes, and new bugs.
* Bonus: "Strip" cracker included in the default john.conf (john.ini).

$Owl: Owl/packages/john/john/doc/CHANGES,v 1.13 2005/12/12 11:54:44 solar Exp $

src sig

GPL v3, Linus Torvalds "Conversion isn't going to happen."

"The Linux kernel is under the GPL version 2. Not anything else. Some
individual files are licenceable under v3, but not the kernel in general."

"And quite frankly, I don't see that changing. I think it's insane to
require people to make their private signing keys available, for example.
I wouldn't do it. So I don't think the GPL v3 conversion is going to
happen for the kernel, since I personally don't want to convert any of my

the post

GPLv3 draft

Why save $IFS to OIFS ?

A lot of people seem to get confused just because $IFS contains non printing characters. Many suggest that before changing IFS (while using a modern shell) it should be saved in a variable such as OIFS. Others suggest going into a subshell so the original IFS won'be changed. Looking at IFS as it is by default on my system it's just space tab and newline

~$ echo -En "$IFS"|hexdump -bc
0000000 040 011 012
0000000 \t \n

So if you know what IFS you need just set it to that. In bash, zsh, ksh93 the following works fine. IFS=$'\040\t\n' Do any IFS changing you want and then set it to that.

~$ string=a/b/c
~$ IFS='/'
~$ set -- $string
~$ IFS=$'\040\t\n'
~$ echo $1,$2,$3

1 pixel for $1.000.001 --a true bargain

No it's not a dead pixel dummy. It's the new trend everyone is talking about. It seems that everyone is gone crazy selling pixels. So here you go I bet I can make more than a million a lot faster and a lot easier than Alex Tew.
The pixel has a hex value of "#ffff33"
Believe me this pixel will remain in history. (once you buy it)

free shell with all the bells and whistles --I've been there for over a year

Some of the things that might interest you:
quota: 25MB
programming/scripting: gas, gcc, perl, python, ruby
shells: sh, csh, ksh, bash, zsh, tcsh
irc: epic, BitchX, irssi
icq: centericq
mail: pine, mutt
www: php, postgresql
web: lynx, links
editors: vi, emacs, pico

and that's just for users1. After a few months of 'good behavior', being a positive addition to the, you have a chance of being upgraded to users2/users3 which means you get even more. (for free).

Here is the table i got from

User Group HDD Space Max. Files BG Procs
users1 25 Mb 500 Files 0
users2 50 Mb 1000 Files 2
users3 100 Mb 5000 Files 5+

While other free shell providers come and go, metawire will be around for many years.
Best of all it will remain free (unlike others)