rigadicomando.org

Whatever you can cat

Random Quote

When people see things as beautiful,
ugliness is created.
When people see things as good,
evil is created.

• Lao Tzu

Secondary links

  • About
  • Contacts
  • Disclaimer

New Blog for Rigadicomando's contents

Submitted by admin on Wed, 2009-04-29 14:01.
  • administrivia
  • web

Dear reader, for convenience I'm moving the content of this blog
and the future posts in a subsection of my personal blog, so you
can continue following this thematic posts here:

http://www.fabiopedrazzoli.com/category/ict/

  • admin's blog

Quick System Backup via Netcat

Submitted by admin on Tue, 2008-09-23 15:18.
  • bash
  • scripts

Sometimes a backup is needed but the server storage is not enough, in this case you must backup your data on the fly via the net, without the facility of storing locally and then transfer the data.

There are many methods to backup your data on the fly, using rsync via ssh is one for example, but this post is about using netcat for a quick solution.

Listening side, where the backup data will be stored, or destination:

~# mkdir /whatever_the_name_of_your_backup_dir
~# cd !$
~# netcat -l -p 12345 | pv | tar xjf -

Sending side, where the original data are, or source:

~# cd /
~# tar cjf - --ignore-failed-read bin boot cdrom dev/ etc/ home/ initrd* lib/ root/ sbin/ usr/ var/ vmlinuz*  | pv | netcat -q 2 <YOUR_DESTINATION_IP> 12345

Don't forget to create: /bin /media /mnt /opt /proc /selinux /srv /sys /tmp
and chmod 1777 /tmp
(This FHS is for a Debian Etch, please take care of different directories in your setup)

  • admin's blog

Column width in bash environment

Submitted by admin on Sat, 2008-03-29 22:42.
  • bash
  • Debian GNU/Linux OS

export COLUMNS=150

  • admin's blog

USB Stick GNU/Linux mini howto with Fix for "Boot error" Buggy BIOSes

Submitted by admin on Wed, 2008-03-05 23:50.
  • Debian GNU/Linux OS
  • howto

I was reading some articles around the web about how building your persistent GNU/Linux system on usb stick, I found many howtos but I had problems with my BIOS.

It seems that certain versions of Award BIOS, one of the major BIOS vendor, are Buggy and misbehave with syslinux, to fix this you should give a USB-ZIP drive compatible geometry to the USB Stick. I found this useful info into the documentation inside the syslinux tarball (doc/usbkey.doc).

  • admin's blog
  • Read more

Clear the whole Postfix mail queue

Submitted by admin on Fri, 2008-02-22 15:07.
  • bash

~# for i in `mailq|grep '@' |awk {'print $1'}|grep -v '@'`; do postsuper -d $i ; done

Thomas Sewell from coolsewell.com contributed with this helpful notes:

  • admin's blog
  • Read more

Split big files for editing

Submitted by admin on Tue, 2008-01-15 14:13.
  • bash
  • emacs

If you need to edit a big file, for example a mysql full dump for recover a single database, and your editor, for example emacs, say
something like "Maximum buffer size exceeded" you can split it in many smaller files.

~$ split -b 100m ORIGINAL_BIG_FILE OUTPUT_FILE_NAME

Output files will be:

OUTPUT_FILE_NAMEaa
OUTPUT_FILE_NAMEab
OUTPUT_FILE_NAMEac

and on ... every one 100MB weight.

Then you can edit and just keep your DB for restore.

  • admin's blog
  • Read more

How do you rename files with a certain pattern in bash?

Submitted by admin on Mon, 2006-05-29 09:25.
  • bash
  • scripts

How do you rename files with a certain pattern in bash?

for i in *ABC*
do
new=$ ( echo $i | sed ’s/ABC/DEF/’ )
mv $i $new
done

Thanks Live from Yokohama

  • admin's blog

Creating and using Qemu for a virtual OS Installation

Submitted by admin on Mon, 2006-05-22 14:20.
  • Debian GNU/Linux OS

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

  • admin's blog
  • Read more

Print all ANSI colors

Submitted by admin on Mon, 2006-05-08 07:59.
  • bash
  • scripts

(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

  • admin's blog

Simple bash calculator

Submitted by admin on Mon, 2006-05-08 07:50.
  • bash

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

  • admin's blog

How to list duplicate lines in a text file, with counts next to each unique line

Submitted by admin on Mon, 2006-05-08 07:40.
  • bash
  • scripts

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.

  • admin's blog
  • Read more

Unlimited Loop

Submitted by fabio on Fri, 2006-02-10 14:22.
  • bash

Generate an infinite loop in the shell

while true ; do date ; sleep 5 ; done

  • fabio's blog

"Leggi Argomenti" template per script

Submitted by fabio on Tue, 2006-01-31 13:55.
  • bash
  • scripts

Template per script che legge argomenti da riga di comando:

#!/bin/bash

# FUNCTIONS

function help () {
cat <<EOF
Command:         `basename $0`
Syntax:          `basename $0` [ -h ]
Description:     Descrizione script
Options:         -h help (questo help)
                 -a Opzione "A"
                 -b Opzione "B"
EOF
}

# VARIABILI

# OPZIONI

while getopts ha:b: var
do
  case $var in
      h) help; exit
          ;;
      a) echo "Opzione "-a" con argomento $OPTARG";
          ;;
      b) echo "Opzione "-b" con argomento $OPTARG";
  esac
done
shift ` expr $OPTIND - 1 `

  • fabio's blog
  • Read more

fuser + proc

Submitted by fabio on Tue, 2006-01-10 15:54.

Path completo dell'eseguibile che sta occupando una determinata
porta con un determinato protocollo

cat /proc/`fuser -n $2 $1 | gawk \'{}{printf\"%s\\n\",$2}{}\'`/cmdline && echo -e \"\\n\"

Whoix

Questo sulla mia Debian non gira ... mi sono permesso di modificarlo un po':

cat /proc/`fuser -n tcp 80|gawk {'print $2'}`/cmdline && echo

Fabio

  • fabio's blog

passless users

Submitted by fabio on Tue, 2006-01-10 15:52.
  • bash

Volete vedere quali utenti nel vostro sistema NON hanno una password?

cat /etc/passwd |cut -f1,2 -d:| grep -v :x |cut -f1 -d:

Whoix

  • fabio's blog
12next ›last »

tags in Arguments

administrivia bash Debian GNU/Linux OS emacs howto perl scripts web
more tags

Navigation

  • Feedback
  • News aggregator

ICT users' rights

  • Why free software shouldn't depend on Mono or C#
  • FSF welcomes AdBard network for free software advertising
  • Job opening on the FSF campaigns team
  • FSF Settles Suit Against Cisco
  • War on Sharing: RIAA moves to block new FSF court brief
more

High Scalability Architecture

  • It Must be Crap on Relational Dabases Week
  • Product: Hbase
  • Hypertable is a New BigTable Clone that Runs on HDFS or KFS
  • Product: Facebook's Cassandra - A Massive Distributed Store
  • Product: Project Voldemort - A Distributed Database
more

Debian Security

  • DSA-1824 phpmyadmin
  • DSA-1823 samba
  • DSA-1822 mahara
  • DSA-1821 amule
  • DSA-1820 xulrunner
more

Drupal Security

  • SA-CORE-2009-007 - Drupal core - Multiple vulnerabilities
  • SA-CORE-2009-006 - Drupal core - Cross site scripting
  • SA-CORE-2009-005 - Drupal core - Cross site scripting
  • New pages and RSS feeds for security announcements
more

EFF

  • FBI Withdraws Unconstitutional National Security Letter After ACLU and EFF Challenge
  • EFF and Sheppard Mullin Defend Wikipedia in Defamation Case
  • Congress Must Investigate Electronic Searches at U.S. Borders
  • Betrayed MSN Music Customers Deserve More from Microsoft
  • EFF Report: FBI Slowed Terror Investigation with Improper NSL Request
more

Invent Geek

  • Invent Geek Gets RSS!
  • the ion cooler 2.0
  • the mold resistant bread box
  • the ultimate dance pad v1.0
  • thermaltake sponsors inventgeek
more

 Privacy | Disclaimer | Drupal | Creative Commons

All content on this site is ditributed under Creative Commons License, each individual author is responsible for its own posts.

RoopleTheme