Glibc / Kernel
How to know what is defined by gcc for this host ?
gcc -dM -E - < /dev/null
NTPL or LINUXTHREAD ?
Sometimes you need to know what is the thread mecanism used in your Linux Distribution. Two versions exists (NPTL or linuxthreads).
[root@myhost] getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.5 # Means I'm using a NTPL kernel/glibc
or
linuxthreads-0.10 #Means I'm using the linuxthreads implementation
How to generated a sysrq via a serial line ?
If you like to send some sysrq via a serial line you must :
activate a getty by adding the following line in /etc/inittab
s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100
115200 represent the speed of your serial line. Don't forget do reload inittab by running "init q"
Then, send the sysrq "s" you want using :
chat '' BREAK SAY "s\n" &>/dev/ttyS13 </dev/ttyS13
to send another sysrq, please change s\n by b\n i.e for rebooting.
How to find the mount points of usb mass-storage devices
ls -al /dev/sd* | awk '{print $5$6 " " $10}' | sed "s/,/:/g" | grep `cat /sys/bus/usb/drivers/usb-storage/*/host*/target*/*:*/block*/dev` | awk '{print $2}
Networking
How to setup a static route to my network interface ?
You must create a file called /etc/sysconfig/network-scripts/ethx.route.
The older configuration scheme is to put in this file the parameters you want to give to "/sbin/ip route add"
The newest scheme uses 3 values stored in ADDRESSx=, GATEWAYx= and NETMASKx= like
ADDRESS0=192.168.100.0
GATEWAY0=81.25.36.21
If you need more routes, just add a new set with ADDRESS1 and GATEWAY1
In this scheme, the netmask is automaticaly computed using ipcalc.