Ubuntu20.04修改history记录条数

2022/2/7 7:12:28

本文主要是介绍Ubuntu20.04修改history记录条数,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

目录
  • Ubuntu20.04修改history记录条数
    • 1.修改当前用户目录下.bashrc文件第16行HISTSIZE
    • 2.重新初始化修改后的~/.bashrc
    • 3.修改成功

Ubuntu20.04修改history记录条数

1.修改当前用户目录下.bashrc文件第16行HISTSIZE

vim ~/.bashrc

  1 # ~/.bashrc: executed by bash(1) for non-login shells.
  2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3 # for examples
  4 
  5 # If not running interactively, don't do anything
  6 [ -z "$PS1" ] && return
  7 
  8 # don't put duplicate lines in the history. See bash(1) for more options
  9 # ... or force ignoredups and ignorespace
 10 HISTCONTROL=ignoredups:ignorespace
 11 
 12 # append to the history file, don't overwrite it
 13 shopt -s histappend
 14 
 15 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1),修改为10000条
 16 HISTSIZE=10000
 17 HISTFILESIZE=2000
 18 
 19 # check the window size after each command and, if necessary,
 20 # update the values of LINES and COLUMNS.
 21 shopt -s checkwinsize
 22 
 23 # make less more friendly for non-text input files, see lesspipe(1)
 24 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
 25 
 26 # set variable identifying the chroot you work in (used in the prompt below)
 27 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
:set nu

2.重新初始化修改后的~/.bashrc

source ~/.bashrc

3.修改成功

[root@master01 ~]# echo $HISTSIZE
10000



这篇关于Ubuntu20.04修改history记录条数的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程