下载安卓APP箭头
箭头给我发消息

客服QQ:3315713922

Linux系统教程_Linux系统怎样定制History输出格式

作者:Linux系统教程     来源: www.kokojia.com点击数:570发布时间: 2015-09-30 11:32:41

标签: Linux系统教程history

  Linux体系利用History号令去检察体系的运转记实,从而找出一些题目。可是History输出的数据中经常出偶然间等疑息。本文便去教年夜家Linux系统教程体系若何定造History输特别式。


Linux系统教程_Linux系统怎样定制History输出格式
  详细方式以下
  以root用户登录办事器,正在/etc/profile.d/下新建一个文件history_command
  vim /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 ,使其死效,再敲history号令看看:
  #history 5
  1008 root 2015-09-11 08:54:20 vim /etc/profile
  1009 root 2015-09-11 09:13:17 history | less
  1010 root 2015-09-11 09:15:49 vim /etc/profile
  1011 root 2015-09-11 09:43:20 cat /etc/profile.d/history_command
  1012 root 2015-09-11 09:44:59 history 5
  时候已有了,/etc/profile战/etc/profile.d/下的文件会正在用户interactive login的时辰主动履行,以是用户登录机械后每敲一个号令城市被记实到HISTFILE指定的文件中,并且是以逃减的体例写进的。
  设置装备摆设中最关头的处所是export HISTTIMEFORMAT=“`whoami` %F %T ” , 那一止指定history的输特别式。


  以上便是Linux系统教程体系若何定造History输特别式的先容了,如许就可以让History显现更多本身念要晓得的疑息了。

赞(117)
踩(0)
分享到:
华为认证网络工程师 HCIE直播课视频教程