In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Linux systems use the History command to view the operating history of the system and identify problems. However, the output data of History often has no information such as time. This article will teach you how to customize the History output format for Linux systems.
specific methods are as follows
Log in to the server as root and create a file history_command under/etc/profile.d/
vim /etc/profile.c/history_commandexport HISTFILE=$HOME/.bash_historyexport HISTSIZE=1200export HISTFILESIZE=1200export HISTCONTROL=ignoredupsexport HISTTIMEFORMAT="`whoami` %F %T "shopt -s histappendtypeset -r HISTTIMEFORMAT
source /etc/profile.c/history_command to make it effective, and then hit the history command to see:
#history 51008 root 2015-09-11 08:54:20 vim /etc/profile1009 root 2015-09-11 09:13:17 history | less1010 root 2015-09-11 09:15:49 vim /etc/profile1011 root 2015-09-11 09:43:20 cat /etc/profile.d/history_command1012 root 2015-09-11 09:44:59 history 5
The time has already been set, and the files under/etc/profile and/etc/profile.d/will be automatically executed when the user interacts with login, so every command typed by the user after logging in to the machine will be recorded in the file specified by HISTFILE, and it is written in an appended manner.
The most critical part of the configuration is export HISTTIMEFORMAT="`whoami` %F %T ", which specifies the output format of history.
The above is how to customize the Linux system History output format, so that History can display more information you want to know.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.