Printing a sequence of letters or numbers

Bash - GNU Shell, Tips 1 Comment »

Some times, while scripting in your favorite shell (I mean Bash !! :) you need to print a sequence of letters or numbers. Don’t write it yourself ! Script it using seq or curly braces !

Print a sequence of number

nicolas@macvin:~$ seq 1 10

1 2 3 4 5 6 7 8 9 10

nicolas@macvin:~$ seq 0 2 10

0 2 4 6 8 10

nicolas@macvin:~$ echo {1..10}

1 2 3 4 5 6 7 8 9 10

Print a sequence of letters

nicolas@macvin:~$ echo {a..g}

a b c d e f g

Hope this will help you while doing a loop or building some hash directories :

nicolas@macvin:~$ mkdir -p test/{1..10}/{1..10}

Enjoy !

How to flush DNS Cache in Mac OS X ?

Mac OS X - Shell, Tips No Comments »

Joy ! I just get my new Mac Book Pro (2Go RAM / 2,4Ghz Core 2 Duo / 160Go HDD / etc.). So I’m playing a lot with VMware Fusion and multiple host (debian, ubuntu, solaris, windows, etc.) with a great fluidity ! A big improve for me who was working with an old DELL Laptop with 1Ghz Celeron and 512Mo of Ram…

But, while playing with my new laptop and my multiple virtual instances I needed to flush my DNS Cache. So, here come the tips :

With Mac OS X <= 10.4 :

macvin:~ root# lookupd -flushcache

With Mac OS X > 10.5 :

macvin:~ root# dscacheutil -flushcache

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login