Thursday, April 19, 2007

linux Handy commands

OS Version
uname -r

Overall tools
top, sar,vmstat, vmstat 3 5, top -c -p 16514

CPU
/proc/cpuinfo, mpstat, top, iostat -xtc 5 3
grep "model name" /proc/cpuinfo

To get the count of physical CPUs, this works by counting the unique physical ids
grep "physical id" /proc/cpuinfo |sort -u|wc -l

Memory
/proc/meminfo, /proc/slabinfo, free
grep MemTotal /proc/meminfo

swap
grep SwapTotal /proc/meminfo

Disk IO

iostat

Network
/proc/net/dev, netstat, mii-tool, netstat -i

Kernel Version
/proc/version

Types of IO cards
lspci –vv

Startup changes
/etc/sysctl.conf, /etc/rc.local

OS Log
/var/log/messages, /var/log/dmesg

OS Error codes
/usr/src/linux/include/asm/errno.h

Process Management
/usr/sbin/strace -p
strace -tt -o /tmp/ckpt.out -p


kernel setting
/etc/sysctl.conf

User id and group id
id oracle

ulimit -a

IP addresses and Names
/etc/hosts

Network
oifcfg iflist

# general info
private bonding : bond0
public : eth0
vip : eth0:1

Linux Command Syntax examples

Display the number of CPUs cat /proc/cpuinfo|grep processor|wc –l
Show top CPU% ps aux|sort -n +2
Display top-10 CPU consumers ps aux|sort -rn +2|head -10
RAM memory display free

Shutdown server as root /sbin/shutdown -r now
Kill all xxx processes pkill [-9] “xxx”
Show swap paging space /sbin/swapon -s
Show Linux syslog errors tail /var/log/messages
Show swap disk details swapon -s
See held memory segments ipcs -m
Show Linux system parms sysctl -a
Linux command history files history|more



RAM Size in Linux : free