How to customize the History output format for Linux systems

  
                

The Linux system uses the History command to view the system's log records to identify some issues. However, there is often no time and other information in the data output from History. This article will teach you how to customize the History output format for Linux systems.

Specific methods are as follows

root user to the server, a new file history_command

vim at /etc/profile.d//etc/profile.c /history_command

export HISTFILE=$HOME/.bash_history

export HISTSIZE=1200

export HISTFILESIZE=1200

export HISTCONTROL=ignoredups

export HISTTIMEFORMAT=“`whoami` %F %T ”

shopt -s histappend

typeset -r HISTTIMEFORMAT

source /etc/profile.c/History_command, make it effective, and then click on the history command to see:

#history 5

1008 root 2015-09-11 08:54:20 vim /etc/profile

1009 root 2015-09-11 09:13:17 history

Copyright © Windows knowledge All Rights Reserved