Check if a port is open or being listened

ARUN Post in PORT
0

root@server [~]# netstat -plan | grep :80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      19931/httpd
tcp        0      0 127.0.0.1:80                127.0.0.1:46098             TIME_WAIT   -
tcp        0      1 67.222.146.227:39274        128.61.111.9:80             SYN_SENT    13289/python

If LISTEN then UP

Find and replace string using VI editor

ARUN Post in LINUX COMMANDS, SEARCH COMMANDS
0

Open file in VI
vi filename
esc
:%s/old string/new String/

Create a folder inside a folder by a single command

ARUN Post in LINUX COMMANDS
0

Will create both folders data and db even though the folder data is not present

mkdir -p /data/db

Server architecture

ARUN Post in DISK RELATED, LINUX COMMANDS
0

[arun@localhost ~]$ uname -i

?i386            –> This means server is X86  32 bit

Clam Scan install

ARUN Post in HACK
0

WHM

Main >> cPanel >> Manage Plugins

***********************************************

*** Manuall install ***

cd /usr/local/src
rm -Rf clamav-*

wget http://downloads.sourceforge.net/clamav/clamav-0.96.tar.gz

tar -xzf clamav-*
cd clamav-*
if [ -d "/usr/lib64" ]; then libdir=”–libdir=/usr/lib64″ ; fi ; ./configure –prefix=/usr $libdir –sysconfdir=/etc –disable-ipv6 –disable-zlib-vcheck
make
make install
freshclam
echo “ClamAV update complete!”

Find cpanel version

ARUN Post in VERSION CHECK
0

/usr/local/cpanel/cpanel -V

cat /usr/local/cpanel/version

Service check file in cpanel

ARUN Post in WHM BACKEND
0

vi /etc/chkserv.d/chkservd.conf

exim:1  –> Service will be checked.

exim:0  –> Service will not be checked.

Change server time using command

ARUN Post in LINUX COMMANDS
0

date +%T -s “08:15:13″

Plesk domain folder & httpdocs permission

ARUN Post in FILE PERMISSIONS
0

cd /var/www/vhost

drwxr-xr-x    14    root     root       4096    Jan 21    09:45    domainname.com

cd domainname.com

drwxr-x—     6    UN    psaserv    4096    Dec 13    2008     httpdocs

Command to Find plesk version

ARUN Post in PLESK BACKEND
0

[root@myserver] #  rpm -q psa
psa-9.3.0-cos5.build93091230.06?

[root@myserver]#  cat /usr/local/psa/version
9.3.0 CentOS 5 93091230.06

Open Plesk CP in the browser, the version will be printed in the title bar.

rpm

ARUN Post in LINUX COMMANDS
0

To view all the instaled rpm

rpm -qa

To view if a specified rpm is instaled

rpm -qa | grep “NAME”

Direct admin mail folder path

ARUN Post in DIRECT ADMIN, FILE PATH ( conf, logs etc)
0

Path where the mails are stored in direct admin clients

/home/UN/imap/domain.com/email UN/Maildir/

updatedb

ARUN Post in DISK RELATED, LINUX COMMANDS
0

The database file updated by default while running “updatedb”  is

/var/lib/mlocate/mlocate.db   ( Can be cleared to free disk space )

Toggle php version in cpanel

ARUN Post in PHP
0

If you have both php 4 and php 5 installed on your cpanel server and you want to set, say php 5 as default for all the clients. Login to

Cpanel >> php configuration

( This can be viewed only if php 4 and php 5 is installed using easy apache )

Top

ARUN Post in LINUX COMMANDS
0

nice top -c    or  top -c

Shift M –> Sort process using max memory allocation

Shift P –> Sort process using max processor usage

To kill a process

Press K and then insert the PID