This is a list of command that useful for System Admin.
To get the list of username with its user ID in formatted way:
# awk -F”:” ‘{ print “username: ” $1 “\t\tuid:” $3 }’ /etc/passwd
Find the particular string from the list of files in current directory:
# cd /etc
# for i in $(find -type f); do grep -iH nfsnobody $i; done
Or
# grep -iH nfsnobody *
Get the no of occurrences of particular word in file:
# awk ‘/ServerName/ {i=i+1} END {print i}’ /etc/httpd/conf/httpd.conf
# grep ServerName /etc/httpd/conf/httpd.conf
To delete resources of semaphore arrays from memory:
# ipcs -s | grep apache | perl -e ‘while (
) { @a=split(/\s+/); print`ipcrm sem $a[1]`}’
To check whether perl module is installed correctly or not:
If all is correct then output of this command nothing
# perl -e ‘require Mail::SPF::Query’
To install CPAN module:
#cpan
cpan> install Mail::SPF::Query
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Thu, 24 Nov 2005 14:54:20 GMT
Mail::SPF::Query is up to date.
To get the list of IP addresses in the server:
#ifconfig | grep -vw inet6 | grep -w inet | cut -d : -f 2 | cut -d \ -f 1
Find list of IP address along with eth device and network mask:
# ifconfig | cut -d ” ” -f1,12,16 | grep -A 1 eth | tr -d - | tr -s “\n” |sed -e :a -e N -e ’s/\n/ /’
Know the performance of your HardDisk:
Change the device address as per your servers configuration
# hdparm -Tt /dev/sda
Get the customized output of raw accesslog of httpd:
Navigate the folder where your http access log reside
# tail -f access_log | awk ‘{if ($11 ~”\”-\”") print $1, $7, $12; else print $1, $10, $11, $12}’
The details of the present http connections can be found by using:
# netstat -plan | grep “:80 ” | awk {’print $5′} |awk -F: {’print $1′}|sort
# cat /proc/net/ip_conntrack | grep “port=80″ | wc -l
Number of connection from perticular IP addfess:
# netstat -ntu | awk ‘{print $5}’| cut -d: -f1 | sort | uniq -c | sort -nr | more
No of connections:
# netstat -alntp
# /sbin/ldconfig /usr/local/lib - Update the system linker cache
Port scanning using nmap:
You can customized it to get more informative output
# nmap -sS localhost -
Instead host localhost, it could be IP address of another server which is in question.
|
Print This Post
Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post | TrackBack URI for this post
Related Post:
- Howto Backup and Restore a Plesk Domain
- Disable Direct Root Logins
- Howto Install HyperVM
- Howto Install LxAdmin
- Howto Install ISPConfig
