Linux修改History历史命令数量

****打开  vim  /etc/profile

vim  /etc/profile

追加配置

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1=‘\h:\w\$ ‘
if [ -f /etc/bash.bashrc ]; then
| . /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
| PS1=‘# ‘
else
| PS1=‘$ ‘
fi
fi
fi

if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
| . $i
fi
done
unset i
fi

# history command max line config
export HISTSIZE=50000

export PATH=$PATH:/usr/local/go/bin
#set java environment
JAVA_HOME=/usr/java/jdk-10.0.1
CLASSPATH=$JAVA_HOME/lib/
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH PATH
export JRE_HOME=/usr/java/jdk-10.0.1/jre

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JRE_HOME/lib/amd64/server:$JRE_HOME/lib/amd64

export GOROOT=/usr/local/go

PATH=$GOROOT/bin:$PATH

*** 配置文件生效

source /etc/profile

原文地址:https://www.cnblogs.com/20170722-kong/p/12080252.html

时间: 2024-07-29 09:35:56

Linux修改History历史命令数量的相关文章

Linux中history历史命令使用方法详解

在/etc/profile里添加如下: #History export HISTTIMEFORMAT="[%F %T]" HISTDIR=/home/common/.hist if [ ! -d $HISTDIR ]; then         mkdir -p $HISTDIR         chmod 777 $HISTDIR fi export HISTSIZE=100000 export HISTFILE="$HISTDIR/${LOGNAME}.hist"

【转】Linux中history历史命令使用方法详解

原文网址:http://os.51cto.com/art/201205/335040.htm 当你在玩Linux的时候,如果你经常使用命令行来控制你的Linux系统,那么有效地使用命令历史机制将会使效率获得极大提升.事实上,一旦你掌握了我在下面给出的15个有关Linux history历史命令的例子,你就会发现使用history历史命令行将更有乐趣. 1.使用HISTTIMEFORMAT在历史中显示TIMESTAMP 通常情况下,当你在命令行中键入history时,终端中将显示你刚输入的命令及其

Linux中的历史命令

Linux中的历史命令一般保存在用户????/root/.bash_history history 选项 历史命令保存文件夹 选项 ????-c:清空历史命令 ????-w :把缓存中的历史命令写入历史命令保存文件/root/.bash_history 在.bash_history中看到的命令和用history命令看到的内容并不完全一样.在.bash_history文件中看到的是上次登录注销以后保存的命令,而histroy看到的包括这次登录执行的命令 1.将缓存中的命令写入历史命令保存文件 [[

history历史命令

1.history命令 history命令可以查看历史命令 2.history的用法 语法: history [选项] 选项: -c:清除内存中history的历史命令.不如写入history文件 -a:把内存中的history历史命令更新到history文件中去 -r:把文件中的history历史命令加载到内存中,用于-c之后想重新加载. 3.history的历史命令保存文件 history默认保存1000条历史命令.历史命令保存在家目录下的 .bash_history . 1000条历史命令

linux修改history记录数

在linux系统下.history命令会保存多少条命令呢?曾在一本书上说,如果注销系统,那么会将所有的历史命令都定入到~/.bash_history, 但只保留1000条命令(这个是由默认的shell变量所设置了的)但是为什么我们执行history命令后会出现大于1000条的历史记录呢, 其实当我们仔细一看只是序列大于1000.记录的条数还是1000条. 在此我是这样理解的: 1.~/.bash_histroy里面是记录的上次注销前的历史记录(最大保存1000条,且是上次注销前最近的1000条记

linux通过history查看命令执行时间

Linux的bash内部命令history就可以显示命令行的命令历史,默认环境执行 history 命令后,通常只会显示已执行命令的序号和命令本身.如果想要查看命令历史的时间戳,那么可以执行:# export HISTTIMEFORMAT='%F %T '# history | less1 2008-08-05 19:02:39 service network restart2 2008-08-05 19:02:39 exit3 2008-08-05 19:02:39 id

linux修改history

1.cat ~/.bash_history 2.history | more Enter 键盘  ----------一行一行 空格键盘---------------一页一页 3.!103 执行 第103条命令 问题 在使用 bash 的过程中,我们可能希望 .bash_history 文件记录更多更有用的历史命令, 方便我们日后查询,下面给出了解决方法. 更改默认历史记录 > vi ~/.bashrc # 添加 # 忽略[连续]重复命令 HISTCONTROL=ignoredups # 清除重

linux修改文件权限命令

先看个实例: [[email protected] opt]#ls -al ls -al 命令是列出目录的所有文件,包括隐藏文件.隐藏文件的文件名第一个字符为'.' -rw-r--r--  1 root root    81 08-02 14:54 gtkrc-1.2-gnome2 -rw-------  1 root root   189 08-02 14:54 ICEauthority -rw-------  1 root root    35 08-05 10:02 .lesshst dr

Linux修改字体背景色命令行

图文修改linux字体以及背景颜色 1. 打开终端,右侧点击黑色背景处,选择profiles,选择profile Preference2. 选择Colors3. 在Text color 和Bold color 以及Background color 中可以选择自己喜欢的颜色在Background中可以选择自己喜欢的图片如图所示 原文地址:http://blog.51cto.com/13865608/2141120