$ echo "$PATH"
/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/bin:.
$ # From above output I have removed my personal directories.
/usr/bin/top -n 1
to display current status.
-n representing iterations => -n : Number of iterations limit as: Â -n number
from man top
Inside manual search using
/-n
Enter
press n to go to next line having -n
press N to go to previous line having -N
press q to quit manual
https://lintut.com/best-command-line-tools-for-linux-performance-monitring/
$#From root user or
$ /usr/bin/yum -y install sysstat
$ /usr/bin/sudo /usr/bin/yum -y install sysstat
$ /usr/bin/sudo /usr/bin/yum -y install iotop
$ /usr/bin/yum -y install dstat
$ /usr/bin/top -n 1 -p 1 | /usr/bin/head -1 > delete.txt
Content of delete.txt[H[2J(B[mtop - 07:16:17 up 1:45, 2 users, load average: 0.00, 0.00, 0.00(B[m[39;49m[K
Using sed we can obtain that file content at readable format:$ /usr/bin/sed -i 's/^[//g;s/\[H//g;s/\[2J//g;s/(B//g;s/\[m//g;s/\[[0-9][0-9]\;[0-9][0-9]m\[K//g;' delete.txt
^[ => Ctrl v Ctrl => without spacetop - 07:16:17 up 1:45, 2 users, load average: 0.00, 0.00, 0.00
$ echo "Value of PS1 [$PS1]"
Value of PS1 [$ ]
$ export PS1='# '
# echo "Value of PS1 [$PS1]"
Value of PS1 [# ]
# ./29175082.sh
....
...
related output
....
#
$ echo "Value of PS1 [$PS1]"
I feel that $PS1 at your current terminal is #
reports &Â files are left in /var/log/sa
sysstat commands are: sar sadc . Â (iostat, mpstat, tapestat, etc.) Â and consists of some cron jobs &Â config files.
( /etc/sysstat  & /etc/sysstat.ioconf ).
sysstat commands are: sar sadc . Â (iostat, mpstat, tapestat, etc.) Â and consists of some cron jobs &Â config files.
( /etc/sysstat  & /etc/sysstat.ioconf ).
yum -y install sysstate
tapestat,, what is that command ?
yum installand
yum update
with sysstat -- use sadf ( man sadf  is your friend)
The  sadf  command is used for displaying the contents of data files created by the sar(1)
    command. But unlike sar, sadf can write its data in  many  different  formats  (CSV,  XML,
    etc.
https://www.youtube.com/watch?v=J7nCRDCmJM0
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
iotop just is iotop....
with sysstat -- use sadf ( man sadf  is your friend)
sa1 invokes the sadc (data collector), and sa2 invokes the reporting ("format") tool (sadf).
the cronjobs are sa1 (collection) &Â sa2 (report on yesterday).these 2 x cronjob created by yum install sysstate?
#!/bin/sh
# /usr/lib/sa/sa1
# (C) 1999-2019 Sebastien Godard (sysstat <at> orange.fr)
#
#@(#) sysstat-12.2.1
#@(#) sa1: Collect and store binary data in system activity data file.
#
# Set default value for some variables.
# Used only if ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} doesn't exist!
HISTORY=0
SADC_OPTIONS=""
SA_DIR=/var/log/sa
SYSCONFIG_DIR=/etc
SYSCONFIG_FILE=sysstat
UMASK=0022
[ -r ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} ] && . ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
umask ${UMASK}
[ -d ${SA_DIR} ] || SA_DIR=/var/log/sa
if [ ${HISTORY} -gt 28 ]
then
    SADC_OPTIONS="${SADC_OPTIONS} -D"
fi
ENDIR=/usr/lib/sa
cd ${ENDIR}
[ "$1" = "--boot" ] && shift && BOOT=y || BOOT=n
if [ $# = 0 ] && [ "${BOOT}" = "n" ]
then
# Note: Stats are written at the end of previous file *and* at the
# beginning of the new one (when there is a file rotation) only if
# outfile has been specified as '-' on the command line...
    exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} 1 1 ${SA_DIR}
else
    exec ${ENDIR}/sadc -F -L ${SADC_OPTIONS} $* ${SA_DIR}
fi
And sa2 as well:#!/bin/sh
# /usr/lib/sa/sa2
# (C) 1999-2019 Sebastien Godard (sysstat <at> orange.fr)
#
#@(#) sysstat-12.2.1
#@(#) sa2: Write a daily report
#
S_TIME_FORMAT=ISO ; export S_TIME_FORMAT
prefix=/usr
exec_prefix=${prefix}
SA_DIR=/var/log/sa
SYSCONFIG_DIR=/etc
SYSCONFIG_FILE=sysstat
HISTORY=7
COMPRESSAFTER=10
ZIP="xz"
UMASK=0022
ENDIR=
# Read configuration file, overriding variables set above
[ -r ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} ] && . ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
umask ${UMASK}
[ -d ${SA_DIR} ] || SA_DIR=/var/log/sa
# if YESTERDAY=no then today's summary is generated
if [ x$YESTERDAY = xno ]
then
    DATE_OPTS=
else
    DATE_OPTS="--date=yesterday"
fi
if [ ${HISTORY} -gt 28 ]
then
    DATE=`date ${DATE_OPTS} +%Y%m%d`
else
    DATE=`date ${DATE_OPTS} +%d`
fi
CURRENTFILE=sa${DATE}
CURRENTRPT=sar${DATE}
RPT=${SA_DIR}/${CURRENTRPT}
DFILE=${SA_DIR}/${CURRENTFILE}
if [ -z "${ENDIR}" ];
then
    ENDIR=${exec_prefix}/bin
fi
[ -f "${DFILE}" ] || exit 0
cd ${ENDIR}
if [ x${REPORTS} != xfalse ]
then
    ${ENDIR}/sar $* -f ${DFILE} > ${RPT}
fi
SAFILES_REGEX='/sar?[0-9]{2,8}(\.(Z|gz|bz2|xz|lz|lzo))?$'
find "${SA_DIR}" -type f -mtime +${HISTORY} \
    | egrep "${SAFILES_REGEX}" \
    | xargs  rm -f
UNCOMPRESSED_SAFILES_REGEX='/sar?[0-9]{2,8}$'
find "${SA_DIR}" -type f -mtime +${COMPRESSAFTER} \
    | egrep "${UNCOMPRESSED_SAFILES_REGEX}" \
    | xargs  "${ZIP}" > /dev/null
exit 0
yum install epel-releasebut still can't run :
no match for argument: python-pip
error: Unable to find a match: python-pip
sa1 &Â sa2 are delivered WITH sysstat.
the cronjobs are sa1 (collection) &Â sa2 (report on yesterday).
sa1 &Â sa2 are delivered WITH sysstat.
sar
The IO system is completely different from Windows (which look a bit more like OpenVMS 's IO model)
Try: find / -name sa1 Â Â and find / -name sa2
top -n 1 -p $$ -b 2>&1 > delete.txt
$ ps -eaf | grep sendmail
smmsp 5619 1 0 13:34 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root 5769 5298 0 13:55 pts/1 00:00:00 grep sendmail
$ ps -eaf | grep -E "sendmail|PID" | grep -E -v "grep|ps|awk"
UID PID PPID C STIME TTY TIME CMD
smmsp 5619 1 0 13:34 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
$ ps -eaf | grep -E "sendmail" | grep -E -v "grep|ps|awk" | awk '{ print $2}'
5619
$ SENDMAILPID=$(ps -eaf | grep -E "sendmail" | grep -E -v "grep|ps|awk" | awk '{ print $2}')
$ top -n 1 -b -p $SENDMAILPID
top - 13:56:31 up 47 min, 3 users, load average: 0.00, 0.00, 0.05
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.6%us, 1.3%sy, 0.0%ni, 96.4%id, 0.5%wa, 1.1%hi, 0.1%si, 0.0%st
Mem: 2572484k total, 809872k used, 1762612k free, 165120k buffers
Swap: 1048568k total, 0k used, 1048568k free, 479616k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5619 smmsp 15 0 57732 1764 600 S 0.0 0.1 0:00.00 sendmail
$ top -n 1 -b -p $SENDMAILPID > delete.txt
$ cat delete.txt
top - 13:56:47 up 47 min, 3 users, load average: 0.00, 0.00, 0.05
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.5%us, 1.3%sy, 0.0%ni, 96.4%id, 0.5%wa, 1.1%hi, 0.1%si, 0.0%st
Mem: 2572484k total, 809960k used, 1762524k free, 165128k buffers
Swap: 1048568k total, 0k used, 1048568k free, 479616k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5619 smmsp 15 0 57732 1764 600 S 0.0 0.1 0:00.00 sendmail
Sample commands to get parent process id$ ps -eaf | grep -E "sendmail|PID"
UID PID PPID C STIME TTY TIME CMD
smmsp 5619 1 0 13:34 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root 5811 5298 0 13:57 pts/1 00:00:00 grep -E sendmail|PID
$ ps -eaf | grep -E "sendmail|PID" | grep -E -v "awk|ps|grep"
UID PID PPID C STIME TTY TIME CMD
smmsp 5619 1 0 13:34 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
$ ps -eaf | grep -E "sendmail" | grep -E -v "awk|ps|grep" | awk '{ print $3}'
1
$ PARENTPID=$(ps -eaf | grep -E "sendmail" | grep -E -v "awk|ps|grep" | awk '{ print $3}')
$ ps -lp $PARENTPID
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 1 0 0 75 0 - 2590 - ? 00:00:03 init
$ top -n 1 -b -p $PARENTPID
top - 13:58:56 up 49 min, 3 users, load average: 0.00, 0.00, 0.04
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.5%us, 1.2%sy, 0.0%ni, 96.6%id, 0.5%wa, 1.1%hi, 0.1%si, 0.0%st
Mem: 2572484k total, 810112k used, 1762372k free, 165224k buffers
Swap: 1048568k total, 0k used, 1048568k free, 479620k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 10360 760 632 S 0.0 0.0 0:03.42 init
we cannot use PPID variable since $ echo $$
5853
$ ps -lp $$
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 5853 5851 0 75 0 - 16679 wait pts/2 00:00:00 bash
$ echo $PPID
5851
5851 => parent process of current bash shell.
Need to know your comments given at:
https://www.experts-exchange.com/questions/29175082/linux-command-for-adminstration.html?anchorAnswerId=43044555#a43044555
if looking for a particular process => Example: process id of current shell  => $$
Try: find / -name sa1 Â Â and find / -name sa2
tks.
I see these file, and when I go to that directory, how can I run it ? type sa1.sh ?
once sa1 is collecting data, where it store it ?
Assume that I want to get the pid of sendmail
top -n 1 -b -p $SENDMAILPID
$ top -n 1 -b -p $SENDMAILPID
top - 13:56:31 up 47 min, Â 3 users, Â load average: 0.00, 0.00, 0.05
Tasks: Â 1 total, Â 0 running, Â 1 sleeping, Â 0 stopped, Â 0 zombie
Cpu(s): Â 0.6%us, Â 1.3%sy, Â 0.0%ni, 96.4%id, Â 0.5%wa, Â 1.1%hi, Â 0.1%si, Â 0.0%st
Mem: Â 2572484k total, Â 809872k used, Â 1762612k free, Â 165120k buffers
Swap: Â 1048568k total, Â Â Â Â 0k used, Â 1048568k free, Â 479616k cached
 PID USER    PR  NI  VIRT  RES  SHR S %CPU %MEM   TIME+  COMMAND
 5619 smmsp   15  0 57732 1764  600 S  0.0  0.1  0:00.00 sendmail
$ sudo fdisk -l 2>&1 | sort -u | grep dev | grep -E "^\/dev"
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 783 6185025 8e Linux LVM
/dev/hda3 784 1958 9438187+ 83 Linux
/dev/hdb1 1 130 1044193+ 8e Linux LVM
/dev/hdc1 1 261 2096451 8e Linux LVM
/dev/hdd1 1 130 1044193+ 8e Linux LVM
/dev/hde1 1 391 3140676 8e Linux LVM
/dev/hdf1 1 391 3140676 8e Linux LVM
When I press Ctrl D at vmplayer.exe => Virtual machine settings => it is having following HARD Disk:df -h
f looking for a particular process => Example: process id of current shell  => $$
you can use
top -n 1 -p $$
if you want to check performance of process whose process is 1023
top -n 1 -p 1023
top -n 1 -p <pid>for it?
df -h
sudo sfdisk -l /dev/sd[a-f]
sudo fdisk -l 2>&1 | sort -u | grep dev | grep -E "^\/dev"
/usr/bin/top -n 1
/usr/bin/free -b
/usr/bin/free -k
/usr/bin/free -m
/usr/bin/man vmstat 2>&1 | /usr/bin/col -bx >Â vmstat.txt
/usr/bin/man free
/usr/bin/man top
/usr/bin/df
# or
/usr/bin/bdf
if [ -f /proc/meminfo ]; then /usr/bin/grep Free /proc/meminfo;fi
/usr/bin/cat /proc/meminfo