Skip to Content

command line

Base64 Decode String

Base64 decode string with Perl on the command line.

perl -MMIME::Base64 -ne 'print
> decode_base64("PGRpdj4tLTxicj5UaGVzZSBIVE1MHNpZ25hdHVyZXMgYXJlIGdyZWF0Ljxicj48L2Rpdj4=")'

Zimbra stores mail signatures base64 encoded in the directory as objectClass zimbraSignature.

If you just need something quick, will do it for you.

Zimbra environment variable usage

Posted in

Release 5.0.9_GA_2533.UBUNTU6 UBUNTU6 NETWORK edition

You are becoming a more esteemed Zimbra admin, but are tired of manually fetching environment variables from zmlocalconfig. Simply put the values into your shell environment.

su - zimbra
source ~/bin/zmshutil

Now you can run your ldapsearch command like this:
ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password "(cn=*)"

The date command

Posted in

All values in "seconds" is the number of seconds from Epoch, Jan 1, 1970.

  1. Current time in seconds.
    date +%s
  2. Convert 1220815239 seconds to a human readable date.
    date -d @1220815239
    Sun Sep 7 15:20:39 EDT 2008
  3. Convert 1220815239687 milliseconds to a human readable date.
    date -d @$[1220815239687/1000]
    Sun Sep 7 15:20:39 EDT 2008

Recipes for tcpdump

Posted in

tcpdump is a great tool for protocol traffic analysis and troubleshooting. I'm sure by now you know you need it, but you just need to know how to effectively use it. This post will be updated ongoing.

Have a look here You'll find some great tips on tcpdump and other things nix.

  1. man tcpdump
  2. tcpdump -AvvvSs 1500 -i eth0 host

Bash Loops


Counting to 3 and doing something along the way right on the command line.

# i=1; while [ "$i" -lt 4 ]; do echo $i; i=$(($i+1)); done

The same command in a script:

while [ "$i" -lt 10 ]
   echo $i


Iterate through lines in a file with a for loop on the command line.

# for a in $(cat /tmp/users); do echo $a; done

In a script:

for a in $(cat /tmp/users)

Creating ISO Filesystems

ISO filesystems are helpful for creating disk images for burning CDs.

On Nix:

mkisofs /tmp/isoname.iso -R -V "Volume Name" /path/to/iso/dir

If you have a DMG file you would like to convert to an ISO, you might find this article helpful on
Syndicate content