Skip to content

Entries from November 2013.

Check current network bandwidth used on a Linux/Unix box

Sometimes you need to quickly measure current bandwidth used by your Linux box and don't have dedicated command installed. You can use standard /proc/ file entries to get that info from the system.

Example of a embedded device with a TS stream as an input: ( cat /proc/net/dev; sleep 1; cat /proc/net/dev; ) | awk '/eth0/ { b=$1; sub(/eth0:/,"",b); if(bp){ print (b-bp)/1024/1024, "MB/s" }; bp=b }' 1.00053 MB/s

The simplest MySQL setup, ever

logo-mysqlFirst of all: you have to install the server (I assume you use Debian / Ubuntu): apt-get install mysql-server Then you have to create database, user and password (for sake of simplicity, not security, name, login and password are the same): N=<DB_NAME>; echo "create database $N; grant usage on . to $N@localhost identified by '$N'; grant all privileges on $N.* to $N@localhost ;" | mysql -u root Then you should configure your program:

  • db_name=<DB_NAME>
  • db_user=<DB_NAME>
  • db_password=<DB_NAME>
  • host=localhost

Beware (SECURITY): I assume you have MySQL external connection closed (only local) and you trust every user from your Linux installation, they will have access to your database easily in such setup.