*nix In a nutshell!

Fedora package belonging to group

querypackagegroup() {  local arglist=( "$@" )     for group in "${arglist[@]}"      do       repoquery -qi "$group" | awk ‘/Group /{gsub(/\//," ",$0); print tolower("rpm "$3" "$4)}’      done  }

Disable terminal bell FreeBSD

Disable annoying terminal bells under FreeBSD sysctl hw.syscons.bell=0 To make settings permanent you need to: printf ‘%s\n’ “hw.syscons.bell=0″ >> /etc/sysctl.conf Finally reboot

iptables forward ftp traffic

Forwarding ftp traffic using iptables.

Forward ssh connections using iptables

Forwarding an ssh connection to another host or port using `iptables` is quite easy. In fact there are only two lines needed. The first line defines the destination host and port where the ssh service is running e.g: iptables -A FORWARD -p tcp -d –dport 22 -j ACCEPT The second line will decide what […]

Enable jail quota using ZFS on FreeBSD

ZFS is best described here http://en.wikipedia.org/wiki/ZFS 1) Create the pool mkdir -p /raw/tank && dd if=/dev/null of=/raw/tank/disk0 bs=1m seek=30720 && zpool create tank /raw/tank/disk0 2) Mount the pool zfs create -omountpoint=/jails tank/jails 3) Create jail in tank/jails zfs create tank/jails/jailname zfs create -oquota=1G tank/jails/jailname 4) Migrate Jails rsync <switches> /usr/jails/jail01/ /tank/jails/jail01/ example:  rsync -azqrv /usr/jails/vivek/ […]

, , ,

Delete partition table using `dd`

The hard disk can be devided in more logical disks called partitions or slices under *BSD. The division of these partitions is found on the first sector of the disk (sector 0). In case you want to make your disk partition unusable, you could use dd. dd is well described on *nix systems and can […]

HE ipv6 tunnel configuration FreeBSD

This howto explains how to configure IPv6 tunnel provided by Hurricane Electric on a FreeBSD system. Configure the HE side 1) Create an account using this link http://tunnelbroker.net/ 2) After creating the account select the “IPv6 Tunnel” tab and provide the necessary details. See the example below 3) Click on the “Example Configuration” tab. Choose […]

backup retention script

Backups are important. Not keeping all backups is equallity important. Especially when you are taking backups of big databases, and you don’t have enough space to keep 500TB of data backups. Therefore I wrote a script that deletes old backups. I wanted to keep at least one back up / quarter for serveral years (untill […]


Glance is one of the three main cloud solutions of OpenStack Installing glance On an Ubuntu system you could run: sudo apt-get install glance python-glance-doc Once installed you can run glance as follow: sudo glance-control all start After starting Glance service, virtual disks can be added to it’s database. The command ‘glance index’ shows all […]

BASH one liners

Move field 1 from file1 to field 1 on file2 awk -F, ‘FNR==NR{array[NR]=$1;next}{$1=array[FNR]}1′ file1 file2 Find files within a specific directory files=(); while IFS= read -rd ” f; do files+=("$f"); done < <(find /var/lib/libvirt -name ‘ubuntu-*’ -print0) Find a certain pattern within files. E.g we’ll search for the pattern ‘hostname’ within /etc directory find /etc/ […]

Previous Posts