How to check load average for a day using sar

ARUN Posted in LINUX COMMANDS, LOAD
0

sar -q

sar -f /var/log/sa/sa …  –> To view load average for previous days

Find and replace string using VI editor

ARUN Posted 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 Posted 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 Posted in DISK RELATED, LINUX COMMANDS
0

[[email protected] ~]$ uname -i

?i386            –> This means server is X86  32 bit

Change server time using command

ARUN Posted in LINUX COMMANDS
0

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

rpm

ARUN Posted in LINUX COMMANDS
0

To view all the instaled rpm

rpm -qa

To view if a specified rpm is instaled

rpm -qa | grep “NAME”

updatedb

ARUN Posted 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 )

Top

ARUN Posted 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

screen

ARUN Posted in LINUX COMMANDS
0

TO install

yum install screen  —> will install and setup screen in your machine

In command prompt type “screen” to activate that

# screen

# Cntrl A D –> To quit from screen

# screen -ls  –> To view the screens running

# screen -r “give id u got from above command”

To close screen

Login to screen and then press  Cntr C D

Example

# screen -ls
There are screens on:
31516.pts-0.v1    (Detached)
31289.pts-0.v1    (Detached)
2 Sockets in /tmp/screens/S-root

# screen -r 31516.pts-0.v1

Command to check if selinux is enabled

ARUN Posted in LINUX COMMANDS
0

# getenforce

[[email protected]] # getenforce
Disabled

Change permission of a file

ARUN Posted in LINUX COMMANDS
0
chmod 644 filename

Turn OFF service even after reboot

ARUN Posted in LINUX COMMANDS
0
To turn OFF the service completely. Even after restart the service wont be started.
cd /etc/init.d
chkconfig httpd off

SCP

ARUN Posted in LINUX COMMANDS
0

[[email protected] Desktop]$ scp filename [email protected]:/usr/src/

From remote to local pc

[[email protected] Desktop]$  scp [email protected]:/path of file    Path on localmachine

SCP USING PORT

scp -P 233 /home/cpmove-user.tar.gz [email protected]_IP:/backup/

To find the path of loaded php.ini configuration file

ARUN Posted in LINUX COMMANDS, PHP
0

php -i | grep php.ini

View the various cron jobs running in the server

ARUN Posted in CRON, LINUX COMMANDS
0

cd /var/spool/cron/

There will be a file with username which has all the crons for that user.

tail -f /var/log/cron

crontab -u Un -l   —> List cron jobs of user UN.  Should be logged in as root to view this.

crontab -l   –> List cron jobs of the user logged in

crontab -e  –>  Edit cron jobs of the user logged in.