history   记录历史命令

  环境变量:

    HISTSIZE: 命令历史记录的条数;

    HISTFILE:  命令历史记录的文件,~/.bash_history;

    HISTFILESIZE: 命令历史文件记录历史的条数;

  常用参数:

    删除一条历史记录:   history -d OFFSET

[root@web1 ~]# history
ssh mysql1
history
history
history
history
[root@web1 ~]# history -d
[root@web1 ~]# history
history
history
history
history -d
history

    清空所有历史记录: history -c

[root@web1 ~]# history -c
[root@web1 ~]# history
history

    显示历史中最近的#条命令;history #

[root@web1 ~]# history
ssh mysql1
history
history
history
history

    手动追加当前会话缓冲区的命令历史致历史文件中: history -a

[root@web1 ~]# history
more /root/.bash_history
history
sadfdasf
history
history
[root@web1 ~]# tail -n ~/.bash_history
vim test.sh
sh test.sh
mysql_config
cat /etc/hosts
ssh mysql1
[root@web1 ~]# history -a
[root@web1 ~]# tail -n ~/.bash_history
sadfdasf
history
history
tail -n ~/.bash_history
history -a
[root@web1 ~]#

    调用历史中的命令:

      !#

      !!: 上一个命令

      !string

      !$:调用上一条命令的最后一个参数

    控制命令历史的记录方式: 修改环境变量

      环境变量:HISTCONTROL

        ignoredups 忽略连续且重复的命令;    

        ignorespace 忽略所有以空白开头的命令;

        ignoreboth:ignoredups,ignorespace

基础命令history的更多相关文章

  1. 【Linux基础】history查看历史命令

    1.history命令 “history”命令就是历史记录.它显示了在终端中所执行过的所有命令的历史. history //显示终端执行过的命令 history //显示最近10条终端执行过的命令 C ...

  2. Linux Shell基础 Bash常见命令 history、alias命令以及常用快捷键

    概述  shell中常见命令history 历史纪录命令:history 命令格式如下: [root@localhost ~]# history [选项] [历史命令保存文件] -c:清空历史命令: ...

  3. Docker - Docker基础命令及使用

    Docker Docker - 官网 Docker - Hub GitHub - Docker Docker中文社区 Docker基础命令 Docker 查看帮助信息:docker --help 查看 ...

  4. Linux最常用的基础命令

    Linux最常用的基础命令个人总结 计算机基础知识: 32bit和64bit系统的区别.系统运行机制 32bit=内存的最大寻址空间是2**32,也就是说最大只能使用4GB的内存64bit=内存的最大 ...

  5. docker 应用-1(安装以及基础命令)

    Docker 安装 还是看官方文档吧TAT https://docs.docker.com/engine/getstarted/step_one/ 理解docker镜像和容器 镜像就是docker容器 ...

  6. Linux基础知识与基础命令

    Linux基础知识与基础命令 系统目录 Linux只有一个根目录,没有盘符的概念,文件目录是一个倒立的树形结构. 常用的目录功能 bin 与程序相关的文件 boot 与系统启动相关 cdrom 与Li ...

  7. 【第四课】Linux的基础命令使用

    目录 一.passwd重置密码 二.单用户模式 三.救援模式 四.设置SElinux 五.Linux的常用基础命令详解 5.1.mkdir命令 5.2.ls命令 5.3.cd命令 5.4.chmod命 ...

  8. linux基础(2)-基础命令和基础特性

    基础命令 命令历史 命令历史的管理 登陆 shell 时,会读取命令历史文件中记录下的命令: ~/.bash_history . 登陆进 shell 后,新执行的命令只会记录在缓存中,这些命令会在用户 ...

  9. 1. Docker基础命令

    本文简要介绍Docker的基础命令,目的在于快速入门Dokcer,Docker的完整命令可以参考Docker官方手册. 0. 安装Docker Docker当前分为企业版(Docker Enterpr ...

随机推荐

  1. PHP正则表达式-从文本中提取URL

    1.从文本中提取URL的正则表达式 '/https?:\/\/[\w-.%#?\/\\\]+/i'

  2. research plan2222

    Thank you for calling. I've been looking forward to this call for a long time.Now, let me introduce ...

  3. IEC61131-3——数据类型

    1. 摘要 列出IEC61131-3支持的几种常用数据类型. 2. 内容 使用USB-CAN接口卡调试从站,SDO发送使用的功能码与字节的关系如下. 2f表示8位,2b表示16位,23表示32位数据. ...

  4. common upload乱码

    request.setCheracterEncoding("utf-8"); DiskFileUpload.setHeaderEncoding("utf-8") ...

  5. jsp ajax 数据库Demo

    转自:http://blog.csdn.net/rushkid02/article/details/7515058 下面介绍JSP前台表单内容通过Ajax异步提交到后台Servlet进行校验(校验方式 ...

  6. bzoj4821

    线段树 这题真是无聊 把式子拆开,然后可知维护xi,yi,xi^2,xi*yi,重点在于标记下传,当我们进行2号操作时,直接累加进答案和标记即可,进行3号操作时,update时先把自己这层赋值成要改变 ...

  7. [Apple开发者帐户帮助]八、管理档案(4)

    您可以编辑,下载或删除在开发人员帐户中创建的配置文件.例如,如果您撤消了证书或禁用了配置文件中包含的设备,请编辑配置文件.或重新置备的个人资料,如果因为你它是无效的功能的应用程式服务. 注意: Xco ...

  8. [Swift通天遁地]六、智能布局-(1)给视图添加尺寸和中心点的约束

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  9. 1.1输出“hello,world”

    #include<iostream> using namespace std; int main() { cout<<"Hello, World!"< ...

  10. ACM_Ruin of Titanic(简单贪心)

    Ruin of Titanic Time Limit: 2000/1000ms (Java/Others) Problem Description: 看完Titanic后,小G做了一个梦.梦见当泰坦尼 ...