基础命令history
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的更多相关文章
- 【Linux基础】history查看历史命令
1.history命令 “history”命令就是历史记录.它显示了在终端中所执行过的所有命令的历史. history //显示终端执行过的命令 history //显示最近10条终端执行过的命令 C ...
- Linux Shell基础 Bash常见命令 history、alias命令以及常用快捷键
概述 shell中常见命令history 历史纪录命令:history 命令格式如下: [root@localhost ~]# history [选项] [历史命令保存文件] -c:清空历史命令: ...
- Docker - Docker基础命令及使用
Docker Docker - 官网 Docker - Hub GitHub - Docker Docker中文社区 Docker基础命令 Docker 查看帮助信息:docker --help 查看 ...
- Linux最常用的基础命令
Linux最常用的基础命令个人总结 计算机基础知识: 32bit和64bit系统的区别.系统运行机制 32bit=内存的最大寻址空间是2**32,也就是说最大只能使用4GB的内存64bit=内存的最大 ...
- docker 应用-1(安装以及基础命令)
Docker 安装 还是看官方文档吧TAT https://docs.docker.com/engine/getstarted/step_one/ 理解docker镜像和容器 镜像就是docker容器 ...
- Linux基础知识与基础命令
Linux基础知识与基础命令 系统目录 Linux只有一个根目录,没有盘符的概念,文件目录是一个倒立的树形结构. 常用的目录功能 bin 与程序相关的文件 boot 与系统启动相关 cdrom 与Li ...
- 【第四课】Linux的基础命令使用
目录 一.passwd重置密码 二.单用户模式 三.救援模式 四.设置SElinux 五.Linux的常用基础命令详解 5.1.mkdir命令 5.2.ls命令 5.3.cd命令 5.4.chmod命 ...
- linux基础(2)-基础命令和基础特性
基础命令 命令历史 命令历史的管理 登陆 shell 时,会读取命令历史文件中记录下的命令: ~/.bash_history . 登陆进 shell 后,新执行的命令只会记录在缓存中,这些命令会在用户 ...
- 1. Docker基础命令
本文简要介绍Docker的基础命令,目的在于快速入门Dokcer,Docker的完整命令可以参考Docker官方手册. 0. 安装Docker Docker当前分为企业版(Docker Enterpr ...
随机推荐
- 6.6 random--伪随机数的生成
本模块提供了生成要求安全度不高的随机数.假设须要更高安全的随机数产生.须要使用os.urandom()或者SystmeRandom模块. random.seed(a=None, version=2) ...
- Index statistics collected bug
SQL运行引擎会从pg_stats.pg_class等相关系统字典表.视图获取生成最佳运行计划的数据,假设相关字典视图的数据不准确就没有办法生成良好的运行计划. 发现下面Bug一枚. 0. 插入数据之 ...
- ios8--加载图片
// // ViewController.m // 06-资源存放问题 #import "ViewController.h" /** 加载图片的方式: 1. imageNamed: ...
- JavaScript Patterns 1 Introduction
1.1 Pattern "theme of recurring events or objects… it can be a template or model which can be u ...
- ssh连接超时问题解决方案,每一种方案都可以
1.服务端修改 vim /etc/ssh/sshd_config 修改 ClientAliveInterval 60 ClientAliveCountMax 40 60秒,向客户端发送一次请求. 超过 ...
- Java转大数据开发全套视频资料
大数据在近两年可算是特别火,有很多人都想去学大数据,有java转大数据的,零基础学习大数据的.但是大数据真的好学吗. 我们先来了解一下什么是大数据. 大数据是指无法在一定时间内用常规软件工具对其内容进 ...
- Centos 7 安装google 浏览器(yum 方式)
过程: 1 vim /etc/yum/repo.s/google_chrome.repo 2 添加如下内容: [google-chrome] name=google-chrome ...
- Codeforces 792D
题意:给定一棵拥有n个节点的满二叉树(即n==2^x-1),q个查询,每次给出一个节点的编号,再给出一个由L,R,U组成的字符串序列,依次表示向左子节点.右子节点.父节点移动,如果移动不合法,则忽略. ...
- 【Leetcode 166】 Fraction to Recurring Decimal
Description: Given two integers representing the numerator and denominator of a fraction, return the ...
- 我的github教程
这篇文章记录个人常用的一些命令,和记不住的一些命令. 安装 在 Windows 上安装 Git ,有个叫做 msysGit 的项目提供了安装包: http://msysgit.github.io/ 完 ...