Linux(命令的帮助用法+各种帮助用法 图片+大白话)

后面也会持续更新,学到新东西会在其中补充。

建议按顺序食用,欢迎批评或者交流!

缺什么东西欢迎评论!我都会及时修改的!

在这里真的很感谢这位老师的教学视频让迷茫的我找到了很好的学习视频

王晓春老师的个人空间-王晓春老师个人主页-哔哩哔哩视频

会查看命令是非常重要的!

whatis

简短解释该命令是啥意思

[root@RockyLinux9 ~]#whatis rm
rm (1)               - remove files or directories
rm (1p)              - remove directory entries

刚装好系统帮助不存在

centos7 以后
mandb
cento6 之前
makewhatis
whatis cal == man -f cal
[root@RockyLinux9 ~]#whatis cal
cal (1)              - display a calendar
cal (1p)             - print a calendar

help 

内部命令:

  • help command
  • man bash

外部命令:

  • --help 或 -h

格式说明:

  • [] 表示可选项
  • CAPS或<>表示变化的数据
  • ...表示多个列表
  • x|y|z 意思是x或y或z
  • -abc 意思是-a -b -c
  • {} 表示分组
[root@RockyLinux9 ~]#type help
help is a shell builtin
[root@RockyLinux9 ~]#help echo
echo: echo [-neE] [arg ...]
    Write arguments to the standard output.
...

[-neE]中的是可选的选项 [arg]中的是可选的参数 ...是多个参数

echo: echo [-neE] [arg ...]
[root@RockyLinux9 ~]#help history
If the HISTTIMEFORMAT variable is set and not null

help显示的不太全man显示的很全面 

[root@RockyLinux9 ~]#help history
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
    Display or manipulate the history list.

    Display the history list with line numbers, prefixing each modified
    entry with a `*'.  An argument of N lists only the last N entries.

    Options:
      -c        clear the history list by deleting all of the entries
      -d offset delete the history entry at position OFFSET. Negative
                offsets count back from the end of the history list

      -a        append history lines from this session to the history file
      -n        read all history lines not already read from the history file
                and append them to the history list
      -r        read the history file and append the contents to the history
                list
      -w        write the current history to the history file

      -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 FILENAME is 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 null, its value is used
    as 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@RockyLinux9 ~]#echo $HISTSIZE
1000

HISTSIZE这个变量在help 命令下并没有显示 

--help

[root@RockyLinux9 ~]#date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

Mandatory arguments to long options are mandatory for short options too.
  -d, --date=STRING          display time described by STRING, not 'now'

 -h 

[root@RockyLinux9 ~]#cal -h

Usage:
 cal [options] [[[day] month] year]
 cal [options] <timestamp|monthname>

Display a calendar, or some part of it.
Without any arguments, display the current month.

Options:
 -1, --one             show only a single month (default)

 有些命令可以-h 可以 --help

[root@RockyLinux9 ~]#date -h
date: invalid option -- 'h'
Try 'date --help' for more information.
[root@RockyLinux9 ~]#date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

 常用的是--help 不行再用-h

多选一

date [-u|--utc|--universal]

 -u|--utc|--universal 都是三个功能一样的选项选出其中一个

man

shell 里面什么都有

[root@RockyLinux9 ~]#man bash
      HISTSIZE
              The number of commands to remember in the command  history  (see  HISTORY
              below).   If  the value is 0, commands are not saved in the history list.
              Numeric values less than zero result in every command being saved on  the
              history  list  (there  is no limit).  The shell sets the default value to
              500 after reading any startup files.
       HISTTIMEFORMAT
              If this variable is set and not null, its  value  is  used  as  a  format
              string  for strftime(3) to print the time stamp associated with each his‐
              tory entry displayed by the history builtin.  If this  variable  is  set,
              time  stamps  are  written  to  the history file so they may be preserved
              across shell sessions.  This uses the history co

有5千多行

 man 页面分组为不同“章节”,统称Linux手册

[root@RockyLinux9 ~]#man 1 man

运维比较关注的是1 4 5 8

1 普通用户使用的 8 管理员使用的

[root@RockyLinux9 ~]#whatis rm
rm (1)               - remove files or directories
rm (1p)              - remove directory entries

(1)表示所在的章节编号第一章

我们打开man帮助也就是打开文件 man1就是章节1

[root@RockyLinux9 ~]#whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz

不写man + 章节号 默认是从小开始 这里的话就是passwd (1)

[root@RockyLinux9 ~]#whatis passwd
passwd (5)           - password file
passwd (1ossl)       - OpenSSL application commands
passwd (1)           - update user's authentication tokens
[root@RockyLinux9 ~]#man passwd

[root@RockyLinux9 ~]#man 5 passwd

 关于/etc/issue的文件解释

[root@RockyLinux9 ~]#whatis issue
issue (5)            - prelogin message and identification file
[root@RockyLinux9 ~]#man issue

[root@RockyLinux9 ~]#man 8 agetty

 参考着手册写一下文件

[root@RockyLinux9 ~]#vi /etc/issue
[root@RockyLinux9 ~]#cat /etc/issue
Time at \t
Terminal on \l

xiaowang
\S
Kernel \r on an \m

man -a

[root@RockyLinux9 ~]#man -a passwd

man -k

想做一件事但是不知道那个命令可以用man -k

[root@RockyLinux9 ~]#man -k passwd
chgpasswd (8)        - update group passwords in batch mode
chpasswd (8)         - update passwords in batch mode
...

man -w

列出文件位置

[root@RockyLinux9 ~]#man -w ls
/usr/share/man/man1/ls.1.gz
[root@RockyLinux9 ~]#whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[root@RockyLinux9 ~]#man -w 5 passwd
/usr/share/man/man5/passwd.5.gz

范例:

[root@RockyLinux9 ~]#man 7 ascii
[root@RockyLinux9 ~]#man 7 utf-8

info

[root@RockyLinux9 ~]#info ls

总结

所有命令都需要反复敲来实验来记忆,本人基本上是个人理解加参考其他大佬的肯定有很多问题欢迎指正,我会及时修改。

参考文献

3命令的帮助用法详解_哔哩哔哩_bilibili

4各种帮助用法详解_哔哩哔哩_bilibili

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值