Monday, October 16, 2006

*nix commands

Common daily use commands (to me ^^)
#show all system info
uname -a

#check distributions
cat /etc/*issue
cat /etc/*release*

#check who is online and ip
w

#Check username and working directory
cat /etc/passwd

#Get ip
ifconfig {eth0 etc}

#You know what this is
cat /etc/shadow

#find a file
locate file.ext

#find machine on the subnet
arp -a

#compile c code
gcc in_file -o out_file

#change file permission, x -[1-9]
chmod xxx filename

#show running process
ps aux

#calculate MD5 sum for every file on the system (assume md5sum is on the system)
find / -type f -xdev -exec md5sum -b {} \;

#find readble files
find / -type f -perm -4 -print 2> /dev/null

#find writable files
find / -type f -perm -2 -print 2> /dev/null

#find system time and date stamps
find / -printf "%m;%Ax;%AT;%Tx;%TT;%Cx;%CT;%U;%G;%s;%p\n"

#display system variables
set

#echo current path
echo $PATH

#clean screen (windows cls)
clear

#dump kernel modules
lsmod

#check mouted file sys
mount/df

#Check patch level for RedHat 7.0
rpm -qa

#list Open Files
lsof (lsof `which file`)

#hardware info
dmesg

#usual place for logging
cat /etc/syslog.conf

#how can we miss this, this can be couple pages of essay,brief example
grep str *
grep -r -i "\-a"

#check current user info
id

#figure out how long the host is up
uptime

#some system hardware info
cat /proc/meminfo
cat /proc/cpuinfo

No comments: