开发者学堂课程【Linux基本命令:Linux基本命令 - 4】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/584/detail/8067
Linux基本命令 - 4
内容介绍
一、命令 history
二、命令历史相关环境变量
三、命令帮助
四、--help 和-h 选项
五、man 章节
六、man 命令
七、man 命令
八、红帽全球技术支持服务
九、网站和搜索
一、命令 history
Ø history [-c] [-d offset] [n]
Ø history -anrw [filename]
Ø history -ps arg [arg.…]
-c:清空命令历史
-d offset:删除历史中指定的第 offset 个命令
n:显示最近的 n 条历史
-a:追加本次会话新执行的命令历史列表至历史文件
-r:读历史文件附加到历史列表
-w:保存历史列表到指定的历史文件
-n:读历史文件中未读过的行到历史列表
-p:展开历史参数成多行,但不存在历史列表中
-s:展开历史参数成一行,附加在历史列表后
Display the history list with line numbers,prefixing each modifiedentry with a`*'. An argument of N lists only the last N entries. -c clear the history list by deleting all of th -d offset delete the history entry at offset OFFSET. -a append history lines from this session to the history file -n read all history lines not already read from the history file -r read the history file and append the contents to the history List -w write the current history to the history file and append them to the history iist -p perform history expansion on each ARG and display the result without 'storing it in the history list -s append the ARGs to the history list as a single entry If FILENAMEis given,it is used as the history file. otherwise,if $HISTFILE has a value,that is used,else ~/.bash_history. If the $HISTTIMEFORMAT variable is set and not nul1, its value is usedas a format string for strftime(3) to print the time stamp associated with each displayed history entry.No time stamps are printed otherwise.Exit status : Returns success unless an invalid option is given or an error occurs. [root@centos7 ~]#cat .bash_history |
二、命令历史相关环境变量
Ø HISTSIZE:命令历史记录的条数
Ø HISTFILE:指定历史文件,默认为~/.bash_history
Ø HISTFILESIZE:命令历史文件记录历史的条数 HISTTIMEFORMAT=“%F %T“ 显示时间
Ø HISTIGNORE= "str1:str2*:...“忽略 str1 命令,str2 开头的历史
Ø 控制命令历史的记录方式:
环境变量:HISTCONTROL
ignoredups 默认,忽略重复的命令,连续且相同为“重复”ignorespace 忽略所有以空白开头的命令
ignoreboth 相当于 ignoredups, ignorespace的组合
erasedups 删除重复命令
export 变量名="值“
存放在 /etc/profile 或~/.bash_profile
三、命令帮助
Ø 内部命令:
help COMMAND 或 man bash
Ø 外部命令:
(1)COMMAND --help
COMMAND -h
(2)使用手册 (manual)
man COMMAND
(3)信息页
info COMMAND
(4)程序自身的帮助文档
README
INSTALLChangeLog
(5)程序官方文档
官方站点:Documentation
(6)发行版的官方文档
(7) Google
四、--help 和-h 选项
Ø 显示用法总结和参数列表
Ø 使用的大多数,但并非所有的
Ø 示例:
date --help
Usage: date [OPTION]..! [+FORMAT] or: date [-u]--utc]--universal][MMDDhhmm[[CC]YY][.ss]]
[]表示可选项
CAPS 或<>表示变化的数据
...表示一个列表
xly|z的意思是“x或y或z“
-abc的意思是-a -b -c
{}表示分组
五、man 章节
1:用户命令
2:系统调用
3: C 库调用
4:设备文件及特殊文件
5:配置文件格式
6:游戏
7:杂项
8:管理类的命令
9: Linux 内核 API
六、man 命令
Ø 提供命令帮助的文件
Ø 手册页存放在 / usr/share/man
Ø 几乎每个命令都有 man 的“页面” man 页面分组为不同的“章节”
Ø 统称为 Linux 手册
Ø man 命令的配置文件 :/etc/man.config |'man_db.conf
MANPATH /PATH/TO/SOMEWHERE:指明 man 文件搜索位置
Ø man -M/PATH/TO/SOMEWHERE COMMAND: 到指定位置下搜索 COMMAND命令的手册页并显示
Ø 中文 man 需安装包 man-pages-zh-CN
七、man 命令
Ø man 命令的操作方法:使用 less 命令实现
space,^v,^f,^F:向文件尾翻屏
b,^b:向文件首部翻屏
d,^d:向文件尾部翻半屏
u,^u:向文件首部翻半屏
RETURN,^N, e,^E or j or ^J: 向文件尾部翻一行 y or ^Y or ^P or kor ^K:向文件首部翻一行
q:退出
#:跳转至第 # 行 r1
G:回到文件首部
G:翻至文件尾部
通过在线文档获取帮助
Ø 第三方应用官方文档
Ø 通过发行版官方的文档光盘或网站可以获得
安装指南、部署指南、虚拟化指南等
红帽知识库和官方在线文档
八、红帽全球技术支持服务
Ø rhn.redhat.com 或者本地卫星服务器/代理服务器
基于网络管理的服务器
RHN 代理服务器为 RHN 流量提供缓存
RHN 卫星服务器提供自主的 RHN
Ø RHN 账户
为及其注册和基于网络管理的 RHN 用户
用于系统自动验证的系统 ID
Ø sosreport
收集所有系统上的日志信息的工具,并自动打成压缩包,方便技术支持人员和红帽全球支持提供分析问题依据
九、网站和搜索
Openstack filetype:pdf
rhca site:redhat.com/docs