Linux Sawing Tools
Last edited September 13, 2008
More by Maxim Veksler »
Disk / File system tools
----------------------------------

man e2label
man tune2fs 
nohup
disown -h
Network tools
---------------------

dpkg -L net-tools | grep bin
/usr/sbin/arp
/sbin/ifconfig
/sbin/nameif
/sbin/plipconfig
/sbin/rarp
/sbin/route
/sbin/slattach
/sbin/ipmaddr
/sbin/iptunnel
/sbin/mii-tool
/bin/netstat 

ethtool 
mii-diag
mii-tool  
xorg setup on debian:

xresprobe 
Linux archive utilities
------------------------------

ar
tar
cpio
afio
pax
LZW
compress

gzip
bzip
lzop
lzma
zip
rar
arj
Lha
p7zip
BsdTar

shar
unshar 
Linux hardware information
---------------------------------------

cat /proc/meminfo
cat /proc/cpuinfo  
lspci (-n)
lsusb
dmesg
hdparm -i /dev/hd? and hdparm -I /dev/hd? 
dmidecode
lshw
hwinfo
lm-sensors
mbmon
cfg2html
http://servdoc.sourceforge.net/
lsdev
socklist
procinfo
phpsysinfo
hardinfo
x86info
cardctl
pccardctl
lsusb
lspcmcia  

GtkSysinfo
Hardware status collection systems :

http://packages.debian.org/testing/utils/collectd
Network bandwidth tools
------------------------------------

iptraf
iftop
bandwidthd
vnstat
darkstat
/proc/net/dev

Harddrive (storage || I/O) related
----------------------------------------------

vmstat -d 1 
badblocks 
smartctl
iostat -m 1 <interval>

VNC Stuff
---------------

linuxvnc - allows you to export shell session (ALA tty) to remote machine using VNC 
xmove - Change the X11 server an application is using on the fly
vnc4server - The standard way to get a new X11 screen from a linux server
x11vnc - Export your current work environment to a remote VNC session.
vino - Gnome vnc binding utility.

Reference:
---------------
1. http://www.debian-administration.org/articles/135
2. http://gentoo-wiki.com/HOWTO_Use_VNC_to_connect_to_existing_X_Sessions
3. http://www.vanemery.com/Linux/VNC/vnc-over-ssh.html

Other remote desktop implementations:
---------------------------------------------------------

http://sourceforge.net/projects/synergy2
http://freenx.berlios.de/
http://tldp.org/HOWTO/XDMCP-HOWTO/

conspy (For viewing ``physical console'' on the server)


binary install :

makeself 
diff and merge tools
-----------------------------

rcsmerge_emacs
gvim
vim
kdiff3
xxdiff
opendiff
TortoiseMerge
emacs
xemacs
meld 

http://www.venge.net/monotone/docs/Default-hooks.html
NTP Stuff
--------------

For debian:

http://www.debian-administration.org/articles/25

#!/bin/bash
/usr/sbin/ntpdate -s
/sbin/hwclock --adjust
/sbin/hwclock --systohc

packages:
ntpdate
ntp
chrony
Memory Utilization
---------------------------

free
top
cat  /proc/meminfo
torsmo
vmstat
sar -r
sar -R
mpstat
 
Useful development libraries libraries
-------------------------------------------------------------

 
Trouble Shooting 
------------------------

++ Network

.......... http://freshmeat.net/redir/scapy/39016/url_homepage/scapy

++ FileSystem
.......... http://www.pixelbeat.org/fslint/

++ Process
.......... http://www.opersys.com/LTT/
.......... http://oprofile.sourceforge.net/
.......... http://sourceware.org/systemtap/
.......... http://sourceware.org/frysk
Process memory analyses:

pmap 
library analyses:

ldd 
from man 7 signal 

       Signal     Value     Action   Comment
       -------------------------------------------------------------------------
       SIGHUP        1       Term    Hangup detected on controlling terminal
                                     or death of controlling process
       SIGINT        2       Term    Interrupt from keyboard
       SIGQUIT       3       Core    Quit from keyboard
       SIGILL        4       Core    Illegal Instruction
       SIGABRT       6       Core    Abort signal from abort(3)
       SIGFPE        8       Core    Floating point exception
       SIGKILL       9       Term    Kill signal
       SIGSEGV      11       Core    Invalid memory reference
       SIGPIPE      13       Term    Broken pipe: write to pipe with no readers
       SIGALRM      14       Term    Timer signal from alarm(2)
       SIGTERM      15       Term    Termination signal
       SIGUSR1   30,10,16    Term    User-defined signal 1
       SIGUSR2   31,12,17    Term    User-defined signal 2
       SIGCHLD   20,17,18    Ign     Child stopped or terminated
       SIGCONT   19,18,25    Cont    Continue if stopped
       SIGSTOP   17,19,23    Stop    Stop process
       SIGTSTP   18,20,24    Stop    Stop typed at tty
       SIGTTIN   21,21,26    Stop    tty input for background process
       SIGTTOU   22,22,27    Stop    tty output for background process

       The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
 
# kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL
 5) SIGTRAP      6) SIGABRT      7) SIGBUS       8) SIGFPE
 9) SIGKILL     10) SIGUSR1     11) SIGSEGV     12) SIGUSR2
13) SIGPIPE     14) SIGALRM     15) SIGTERM     16) SIGSTKFLT
17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU
25) SIGXFSZ     26) SIGVTALRM   27) SIGPROF     28) SIGWINCH
29) SIGIO       30) SIGPWR      31) SIGSYS      34) SIGRTMIN
35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3  38) SIGRTMIN+4
39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12
47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14
51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10
55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7  58) SIGRTMAX-6
59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX

Unit Testing 

C Unit Tester - http://www.falvotech.com/content/cut/ 
TAU (Tuning and Analysis Utilities)
- http://freshmeat.net/projects/tau/
prof
gprof
CUTEE
http://freshmeat.net/projects/cutee/
C-XML UnitTest System
- http://freshmeat.net/projects/cxmlunittest/

General Testing

http://staf.sourceforge.net/index.php
 

Pure professional Development
----------------------------------------------

State machine compiler - http://smc.sourceforge.net/ 
System load info
------------------------ 

dstat - http://dag.wieers.com/home-made/dstat/
Interrupt handling
-------------------------

watch -d cat /proc/interrupts 
Traffic monitoring by owner / process ID







Amos Shapira
 
to linux-il
show details
 Sep 6 
On 15/08/06, Nadav Har'El <nyh@math.technion.ac.il> wrote:
suggested, is to use iptables: Run Skype, and then use iptables'
"--pid-owner" or "--cmd-owner" option to add an iptables rule which will
allow traffic from this process. Then use "iptables -nvL" to get the count
of packets and bytes that passed through this rule.

OK, so I took Nadav's advise which turned out to be pretty simple:

1. " addgroup skype" and "chown skype /usr/bin/skype; chmod g+s skype /usr/bin/skype" in order to run skype in its own group. That way I hope to:
  a. avoid multi-cpu troubles (though my current system is single-core)
  b. speed things up by having to match gid's instead of command names.

2. setup iptables rules to the effect of:
# match all outgoing packets from gid skype and mark their connection
iptables -A OUTPUT -m owner --gid-owner skype --out-interface eth0 --protocol tcp -j CONNMARK --set-mark 1
iptables -A OUTPUT -m owner --gid-owner skype --out-interface eth0 --protocol udp -j CONNMARK --set-mark 2

# all packets which match the connection should go through the skype rule
iptables -A OUTPUT -m connmark --mark 1 -m comment --comment skype-out-tcp
iptables -A OUTPUT -m connmark --mark 2 -m comment --comment skype-out-udp

# match all packets on Skype's public TCP port and mark their connection
iptables -A INPUT -p tcp -m tcp --dport 31673 --in-interface eth0 -j CONNMARK --set-mark 1
iptables -A INPUT -p udp -m udp --dport 31673 --in-interface eth0 -j CONNMARK --set-mark 2

# all packets which match the connection will be counted by these
iptables -A INPUT -m connmark --mark 1 -m comment --comment skype-in-tcp
iptables -A INPUT -m connmark --mark 2 -m comment --comment skype-in-udp

This allows me to distinguish in vs. out traffic and tcp vs. udp traffic.  A simple perl script that uses IPTables::IPv4 perl module (i.e. direct access to the syscalls) and looks up at the comments gives me all 8 numbers (tcp/udp, in/out and packets/bytes).

I'll provide the scripts if anyone is interested. If you see an error in what I did then I'd appreciate a howler.

I'm now trying to find a way to identify the "Port Unreachable" ICMP packets which I see to be sent back to Skype's UDP port (and are currently dropped together with other ICMP packets). Current plan is to use the "u32" extension. If someone knows how to achieve that (the ICMP packet recognition, either using u32 or whatever) I'd appreciate a pointer.

And double-thanks to Nadav for pointing me to read the iptables manual more carefully - I found the geoip module mentioned there very promising.

Cheers,

--Amos
 
NAT rules for iptables 2.6

srv-il iptables rules

# HTTP
iptables -t nat -A PREROUTING --dst 80.74.119.211 -p tcp --dport 80 -j DNAT --to-destination 80.74.119.194
iptables -t nat -A POSTROUTING -p tcp --dst 80.74.119.194 --dport 80 -j SNAT --to-source 80.74.119.211
iptables -t nat -A OUTPUT --dst 80.74.119.211 -p tcp --dport 80 -j DNAT --to-destination 80.74.119.194

# POP3
iptables -t nat -A PREROUTING --dst 80.74.119.211 -p tcp --dport 110 -j DNAT --to-destination 80.74.119.194
iptables -t nat -A POSTROUTING -p tcp --dst 80.74.119.194 --dport 110 -j SNAT --to-source 80.74.119.211
iptables -t nat -A OUTPUT --dst 80.74.119.211 -p tcp --dport 110 -j DNAT --to-destination 80.74.119.194

# HTTPS
iptables -t nat -D PREROUTING --dst 80.74.119.211 -p tcp --dport 443 -j DNAT --to-destination 80.74.119.194
iptables -t nat -D POSTROUTING -p tcp --dst 80.74.119.194 --dport 443 -j SNAT --to-source 80.74.119.211
iptables -t nat -D OUTPUT --dst 80.74.119.211 -p tcp --dport 443 -j DNAT --to-destination 80.74.119.194

# SMTP (BLOCK)
iptables -A INPUT -p tcp --dport 25 -j DROP

echo 1 > /proc/sys/net/ipv4/ip_forward
unpackage various distribution packages

- rpm2cpio foo.rpm | cpio -idmv --no-absolute-filenames
 

 Network performance tools
--------------------------------------------


mtr
ping
traceroute
netdiag
The content on this page is provided by a Google Notebook user, and Google assumes no responsibility for this content.