Creating and using Qemu for a virtual OS Installation
Create qemu virtual image file:
qemu-img create virt1 1G
On my laptop for some reasons, no cdrom boot was allowed for the virtual installation,
so the loopback device comes useful to do the installation:
dd if=/dev/cdrom of=sarge-netinst.iso
Now boot the new OS installation (I use Debian GNU/Linux for both real and virtual systems)
qemu virt1 -boot d -cdrom sarge-netinst.iso
Then boot the new system (root or sudoed, as you need root privileges for routing)
qemu virt1 -boot c -n /etc/qemu-ifup
Print all ANSI colors
(from http://wiki.splitbrain.org/shellsnippets)
for i in 30 31 32 33 34 35 36 37 39
do
for j in 40 41 42 43 44 45 46 47 49
do
# skip if same fore- and backgroundcolor
if [ $j -eq $[ i + 10 ] ]; then
continue
fi
echo -e $i $j "\033[${i};${j}mCOLOR\033[0m"
done
done
Simple bash calculator
Put the following little snippet in your .bashrc/.bash_profile and you'll have a handy little calculator:
? () { echo "$*" | bc -l; }
Use like this:
bash$ ? 2*2
4
Thanks textsnippets.com
How to list duplicate lines in a text file, with counts next to each unique line
from:
How to list duplicate lines in a text file, with counts next to each unique line - [spugbrap's random notes geek blog] [del.icio.us (bash)]
At some point, last year (it's been in my 'toblog' file all this time), I needed to analyze the lines in a text file, removing duplicate lines, while counting how many times each duplicated line occurred within the file, and sorting from most common to least common.
Unlimited Loop
Generate an infinite loop in the shell
while true ; do date ; sleep 5 ; done

