1、HISTTIMEFORMAT record the time stamp of the command.
Be default the history command output only shows the command number and command line. Enabling the time stamp would help on auditing purpose.
# export HISTTIMEFORMAT=’%F %T ‘
It can be put into /etc/profile by administartor to enable globally.
# history
…
4 2017-02-20 21:50:11 exit
5 2017-02-20 21:50:11 id
6 2017-02-20 21:50:11 vi /etc/passwd
7 2017-02-20 21:50:11 exit
8 2017-02-20 21:50:11 sudo su –
9 2017-02-20 21:50:11 exit
…
2、search history with ctrl + r
(reverse-i-search)`cat’: cat authorized_key
with left or right arrow key, you can edit the search command result.
3、run previous command with different approach.
a, use up or down arrow key to roll back or forward previous commands.
b, use !! to run last command.
c, use !-1, !-2 or !-3… to run previous comand.
d, use ctrl + p to display last command
4、use !<number> to run previous command in the history
在下面的例子中,如果你想再次执行第四条命令,执行!4即可
#history
….
297 2017-02-20 22:03:39 id
298 2017-02-20 22:04:54 history
[me@linux01 ~]$ !297
id
uid=500(me) gid=500(me) groups=500(me),0(root)
The following article show a simple method to use Glance binary log for resource bootleneck identification. The '''extract''' command is used to export the glance binary data to ASCII text, that can be use for tabular or plot reports.
Shutting down Perf Agent collection software
Shutting down scopeux, pid(s) 5418
Waiting on 5418 (10 more tries)
The Perf Agent collector, scopeux has been shut down successfully.
The ARM daemons ttd, midaemon and Glance programs glance and xglance will be terminated (if running).
Shutting down the alarm generator perfalarm, pid(s) 5456
The perfalarm process has terminated
Shutting down coda daemon
Shutting down coda, pid(s) 5450 # /opt/perf/bin/perfstat
**********************************************************
*** perfstat for delta on Tue Nov 24 13:23:26 CST 2009
*** HP-UX delta B.11.31 U 9000/800 510254130 unlimited-user license
**********************************************************
list of performance tool processes:
———————————-
Perf Agent status:
WARNING: scopeux is not active (Perf Agent data collector)
WARNING: midaemon is not active (Measurement Interface daemon)
WARNING: ttd is not active (ARM registration daemon)
Perf Agent Server status:
Running ovcd (OV control component) pid 1849
Running ovbbccb (BBC5 communication broker) pid 1860
WARNING: coda is not active (perf component)
WARNING: perfalarm is not active (alarm generator)
******** (end of perfstat output: note above warning) ********
== Backup System Binary Logs ==# tar -cvf – /var/opt/perf/datafiles/log* | /usr/contrib/bin/gzip > /tmp/glancelogs.tgz
a /var/opt/perf/datafiles/logappl 129 blocks
a /var/opt/perf/datafiles/logdev 884 blocks
a /var/opt/perf/datafiles/logglob 183 blocks
a /var/opt/perf/datafiles/logindx 11 blocks
a /var/opt/perf/datafiles/logpcmd0 1 blocks
a /var/opt/perf/datafiles/logproc 15 blocks
a /var/opt/perf/datafiles/logtran 489 blocks
== Extract Source System Binary Logs ==# /usr/contrib/bin/gzcat /var/tmp/glancelogs.tgz | tar -xvf –
x /var/opt/perf/datafiles/logappl, 17041748 bytes, 33285 tape blocks
x /var/opt/perf/datafiles/logdev, 19638408 bytes, 38357 tape blocks
x /var/opt/perf/datafiles/logglob, 28038808 bytes, 54764 tape blocks
x /var/opt/perf/datafiles/logindx, 46576 bytes, 91 tape blocks
x /var/opt/perf/datafiles/logpcmd0, 15 bytes, 1 tape blocks
x /var/opt/perf/datafiles/logproc, 30438534 bytes, 59451 tape blocks
x /var/opt/perf/datafiles/logtran, 10205840 bytes, 19934 tape blocks
Perform any required reports. See next sections for additional information.
The Perf Agent scope collector is being started.
The ARM registration daemon
/opt/perf/bin/ttd has been started.
The Performance collection daemon
/opt/perf/bin/scopeux has been started.
The coda daemon /opt/OV/lbin/perf/coda has been started.
It will be fully operational in a few minutes.
The Perf Agent alarm generator is being started.
The alarm generator /opt/perf/bin/perfalarm
has been started. # /opt/perf/bin/perfstat
**********************************************************
*** perfstat for delta on Tue Nov 24 13:28:36 CST 2009
*** HP-UX delta B.11.31 U 9000/800 510254130 unlimited-user license
**********************************************************
On larger reports, for example when reviewing whole days or weeks, identification of resource bottleneck is better assisted using graphics charts. Data can be ploted to charts imported it to spreadsheets software ot using the GNUplot plugin to plot the required data. For example, to plot the CPU %, Memory % and User Memory % together, the following script can be usedcat > global_cpumem.plot << EOF
set size 1, 0.5
set yrange [0:120]
set xlabel “Samples”
plot ‘-‘ using 1:2 title ‘CPU %’ with lines, \\
‘-‘ using 1:3 title ‘Memory %’ with lines, \\
‘-‘ using 1:4 title ‘User Memory %’ with lines
EOF