美文网首页
cut ,history命令使用

cut ,history命令使用

作者: 冰舞one | 来源:发表于2018-12-08 18:08 被阅读0次

cut

切割命令

【选项参数】 

-d指定分隔符

-f数字取第几列

-c按字符取

【实践操作】

[root@BingwuA atsshell]# w|sed -n 1p

 00:22:46 up 1 day,  6:35, 3 users,  load average: 0.00, 0.01, 0.05

[root@BingwuA atsshell]# w|sed -n 1p|cut -d ',' -f4-

  load average: 0.00, 0.01, 0.05

[root@BingwuA atsshell]#

[root@BingwuA atsshell]# w|sed -n 1p|cut -d ',' -f4,5,6,7

 load average: 0.00, 0.01, 0.05

history

查看终端用过的历史命令

【选项参数】 

-c删除用过命令

-w把缓存中的命令写入历史命令保存文件~/.bash_history

涉及到控制变量

TMOUNT=10 连接超时时间

HISTSIZE=5 命令行历史记录变量

[root@BingwuA ~]# echo $HISTSIZE

1000

HISTFILESZIZE 历史记录文件命令数量变量(~/.bash_history;[root@BingwuA ~]# cat ~/.bash_history

[root@BingwuA ~]# echo $HISTFILESIZE

1000

[root@BingwuA ~]#

设置export HISTTIMEFORMAT='%F %T';临时显示执行时间

历史命令默认保存文件修改HISTFILE=/path/FILENAME

历史命令剔除连续重复的条目HISTCONTROL=ignoredups

历史命令忽略指定命令HISTIGNORE=”pwd:ls:cd:”

相关文章

网友评论

      本文标题:cut ,history命令使用

      本文链接:https://www.haomeiwen.com/subject/avaqhqtx.html