第一周--Centos7中的 at 使用技巧及其历史命令管理和用法

                 **Centos 7 中的at 使用技巧及其历史命令管理和用法**

            我将在本文讲述如下内容:
  1. 关于Linux的发行版及不同发行版间的联系和区别
  2. 实现晚上20:30自动关机,并提示用户
  3. 总结历史命令管理以及用法
  4. 总结Linux帮助用法 *

----------------------------- 大片如下 ------------------------------------------------------------------------------------------

       第一章:关于Linux的发行版及不同发行版间的联系和区别

    目前市场上的主流Linux发行版如下图所示:

第一周--Centos7中的 at 使用技巧及其历史命令管理和用法

其主要区别在于发行的公司不同或有些版本同样是开源的,但也是商用的,如 SUSE和Redhat。
商用版会提供更强大的功能和售后服务。
非商用版,如Centos,没有任何售后服务,自己承担使用的bug风险。
----------------------------------------------------------------------------------

      第二章:用at 的计划任务设定功能来实现晚上20:30自动关机,并提示用户

[root@Franklin13 ~]# at 20:30
at> shutdown +3 "Server will be shutdown in 3 min!" ( 然后要 ctrl+d 后at 任务才能加上)
at> <EOT>
job 10 at Tue Mar 26 20:30:00 2019
[root@Franklin13 ~]#
[root@Franklin13 ~]# at -l ( 用-l 参数来查看刚才的at 计划任务是否设定成功 )
10 Tue Mar 26 20:30:00 2019 a root
[root@Franklin13 ~]# at -c 10( 这个数字表该 at 任务的job号, 来看该任务的具体内容 )

第一周--Centos7中的 at 使用技巧及其历史命令管理和用法

该计划任务运行时的实况-----------> , 看下图:

第一周--Centos7中的 at 使用技巧及其历史命令管理和用法


             **第三章: 总结历史命令管理以及用法**

  Centos 7中历史命令的管理通过一个内置的命令  history 并结合如下3个bash下的环境变量来进行管理:

1- HISTSIZE: shell进程可保留的命令历史的条数
2- HISTFILE: 持久保存命令历史的文件
.bash_history
3- HISTFILESIZE: 命令历史文件的大小

--------------------------------------------------------------------------------> go

[root@Franklin13 ~]# type history
history is a shell builtin
[root@Franklin13 ~]# echo $HISTSIZE
1000
[root@Franklin13 ~]# echo $HISTFILE
/root/.bash_history
[root@Franklin13 ~]#
[root@Franklin13 ~]# echo $HISTFILESIZE
1000

第一周--Centos7中的 at 使用技巧及其历史命令管理和用法

history #:显示最近的# 条命令
!# : 再一次执行历史列表中的第# 条命令
!!: 再一次执行上一条命令
!$ 或 ESC, . : 引用上一条命令中的最后一个参数

history -d 304 / history -d 66 5 (删除66开始的5条命令)
-c: 清空命令历史
-d offset: 从制定位置删除该历史记录


   **第四章: 总结Linux帮助用法**

  首先,Centos 7中的命令分为两类, 一种为shell程序自带的命令:内置命令( builtin )
        另一种为独立的可执行程序文件,文件名即命令名:外部命令

举例如下:
[root@Franklin13 ~]# type history
history is a shell builtin
[root@Franklin13 ~]#
[root@Franklin13 ~]# type rm
rm is aliased to rm -i'<br/>[root@Franklin13 ~]# <br/>[root@Franklin13 ~]# type ls<br/>ls is aliased tols --color=auto'

    内置命令的帮助查看方法如下---

root@Franklin13 ~]# help history

外部命令的帮助查看方法如下----

[root@Franklin13 ~]# ls --help

Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
.......

或者用 
[root@Franklin13 ~]# man diff

[root@Franklin13 ~]#
[root@Franklin13 ~]# man ls

                                   全文完

马哥门徒 宏

猜你喜欢

转载自blog.51cto.com/xiaoluogoal/2372714
今日推荐