第一周作业

1、常见Linux的发行版有哪些?并描述不同发行版之间的联系与区别

 https://www.cnblogs.com/bj-mr-li/p/11080812.html

2、打印显示当前时间,格式是:20181209211008 

date +%Y%m%d%H%M%S

3、实现晚上20:30自动关机,并提示用户

shutdown -h 20:30 "The computer shuts down at 20:30"
或
[root@centos7 ~]$ at 20:30
at> wall "will shutdown"
at> sleep 10
at> shutdown
at> <EOT>

  

4、总结历史命令管理以及用法

history的作用:
    保存你输入的命令历史。可以用它来重复执行命令
    登录shell时,会读取命令历史文件中记录下的命令~/.bash_history
    登录进shell后新执行的命令只会记录在缓存中;这些命令会用户退出时“追加”至命令历史文件中
    历史命令默认保存1000条,全局可以在环境变量配置文件/etc/profile中修改,个人可以在t  ~/.bash_profile 中修改。

历史命令的调用:
    使用上、下箭头调用以前的历史命令
    使用"!:0" 执行前一条命令(去除参数)
    使用"!n"执行history命令输出对应序号n的命令
    使用"!-n"执行history历史中倒数第n个命令
    使用"!!"重复执行上一条命令
    使用"!"字符串”重复执行最后一条以该字符串开头的命令。
    使用ctrl+r 搜索历史命令

[root@centos7 ~]$ type history
history is a shell builtin
history [n]:列出最近的n条命令
[root@centos7 ~]$ history 2
190  history 185
191  history 2
    history -c				        #删除所有的history记录
    history -d offset		                #删除指定编号的history记录
    history -anrw [filename]#
		-a				#追加新增的history记录写入historyfile中
		-n				#将指定historyfile记录中未读过的行读入到当前session中的history记录中
		-r				#将指定historyfile中的记录附加到当前session中的history记录中
		-w				#将当前session中的history记录写入指定的文件中,如不指定filename则默认写入.bash_history中
                -p                              #展开历史参数成多行,但不存在历史列表中
                -s                              #展开历史参数成一行,附加在历史列表后 

5、总结Linux帮助用法 

在Linux下常用的帮助有man,info,help等工具
    其中man命令通过调用系统的帮助文档来实现,一般都存放于/usr/share/man目录下(除手动编译指定)
    man命令通常配合whatis命令来使用,确定命令指定章节再进行查看

type				#判断是否是内置命令
help				#适用于内置命令,显示简单帮助信息
--help/-h		        #适用于外部命令,显示简单帮助信息
info				#显示info文档信息
man				#显示命令手册
which			        #显示命令所在目录
whereis		                #显示命令所在目录、手册等信息



[root@centos7 ~]$ whatis df
df (1)               - report file system disk space usage
df (1p)              - report free disk space
[root@centos7 ~]$ man 1p df
DF(1P)                         POSIX Programmer's Manual                        DF(1P)

PROLOG
       This manual page is part of the POSIX Programmer's Manual.  The Linux implemen‐
       tation of this interface may differ (consult  the  corresponding  Linux  manual
       page for details of Linux behavior), or the interface may not be implemented on
       Linux.

NAME
       df - report free disk space

  

posted @ 2019-06-25 09:28  李卓航  阅读(378)  评论(1编辑  收藏  举报