当前位置:网站首页>Rhce8 Learning Guide Chapter 4 getting help
Rhce8 Learning Guide Chapter 4 getting help
2022-07-19 02:49:00 【Lao Duan studio】
We have already talked about the use of many commands , But there are many commands in the system that we haven't seen , There are many options in each command . We can't put every order 、 Remember every option of the command , Then if you encounter an unknown command or an unknown option , Then we need to get help to solve the problem .
Here is the command to get help :whatis command 、–help Options 、man command .
4.1 whatis
whatis Commands can help you view the function of a command , Usage is as follows .
whatis command
for example , To see ls The role of , The order is as follows .
[[email protected] ~]# whatis ls
ls: No, appropriate.
[[email protected] ~]#
If we encounter this problem , Just use root User execution mandb command .
[[email protected] ~]# mandb
Deleting /usr/share/man/overrides Old database entries in ...
... Large output ...
0 stray cats were added.
19 old database entries were purged.
[[email protected] ~]#
And then execute it again whatis command .
[[email protected] ~]# whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
[[email protected] ~]#
In the second column of the result , We just need to focus on the line with pure numbers in parentheses . You can see from the above results ,ls The function of is to list the contents in the directory .
see date Role of command , The code is as follows .
[[email protected] ~]# whatis date
date (1) - print or set the system date and time
date (1p) - write the date and time
[[email protected] ~]#
Here you can see ,date The command is used to display or set the system date and time .
Execute the following command , You can see cal The command is used to display the calendar .
[[email protected] ~]# whatis cal
cal (1) - display a calendar
cal (1p) - print a calendar
[[email protected] ~]#
whatis The output of is actually from man Intercepted from , About man The back can speak .
adopt whatis We know what orders do , But it doesn't tell us how to use this command and what options are available . The following describes the command –help Options .
4.2 --help Options
–help The usage of options is as follows .
command --help
Let's check the order first ls Specific usage of .
[[email protected] ~]# ls --help
usage :ls [ Options ]... [ file ]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Required parameters apply to both long and short options .
-a, --all Don't hide anything to . Starting projects
-A, --almost-all In addition to the listed . and .. Any project outside
... Large output ...
[[email protected] ~]#
This shows ls The usage of ls Available options . for example ,-a Equate to –all, Is to list all files including hidden files .
[[email protected] ~]# ls -a
. aa.txt .bash_logout .cache .dbus .tcshrc yy
.. anaconda-ks.cfg .bash_profile .config hosts .viminfo
11 .bash_history .bashrc .cshrc initial-setup-ks.cfg .Xauthority
[[email protected] ~]#
There are many files that start with a dot to indicate hidden files , It also includes . And representing the upper level directory ….
ls -A Equate to ls --almost-all, It means to list other than the current directory . And all other files outside the upper directory .
[[email protected] ~]# ls -A
11 .bash_history .bashrc .cshrc initial-setup-ks.cfg .Xauthority
aa.txt .bash_logout .cache .dbus .tcshrc yy
anaconda-ks.cfg .bash_profile .config hosts .viminfo
[[email protected] ~]#
If you want to prioritize the directory , By checking the help, you can know which options should be used –group-directories-first.
[[email protected] ~]# ls --group-directories-first
11 yy aa.txt anaconda-ks.cfg hosts initial-setup-ks.cfg
[[email protected] ~]#
here 11 and yy Is a directory , If you want to sort in chronological order , It can be used -t Options .
[[email protected] ~]# ls -t
aa.txt hosts 11 yy initial-setup-ks.cfg anaconda-ks.cfg
[[email protected] ~]#
The newer the file is, the higher the ranking , Readers can use ls -lt To view the .
If you want to sort by the flashback of time, you can add -r Options .
[[email protected] ~]# ls -t -r
anaconda-ks.cfg initial-setup-ks.cfg yy 11 hosts aa.txt
[[email protected] ~]#
Tips : You can use ls -ltr To view the . About ls The other options , Readers can check and practice by themselves according to their needs .
So let's see date Usage of .
If direct input date command , The current date and time will be displayed .
[[email protected] ~]# date
2021 year 11 month 20 Japan Saturday 15:34:57 CST
[[email protected] ~]#
See below date More use of .
[[email protected] ~]# date --help
usage :date [ Options ]... [+ Format ]
or :date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
... Large output ...
Or use it locally :info '(coreutils) date invocation'
[[email protected] ~]#
This shows date There are two uses : The first is “date [ Options ]… [+ Format ]” Used to view date or time . If using format , The format should be preceded by a plus sign “+”, stay date --help All supported formats are listed in the results of , You can check and practice by yourself , Let's demonstrate some .
%Y Indicates the year .
[[email protected] ~]# date +%Y
2021
[[email protected] ~]#
%F It means the day and year of .
[[email protected] ~]# date +%F
2021-11-20
[[email protected] ~]#
%R Express “ when : branch ”.
[[email protected] ~]# date +%R
15:47
[[email protected] ~]#
%T Express “ when : branch : second ”.
[[email protected] ~]# date +%T
15:47:24
[[email protected] ~]#
We can also combine multiple formats , Usage is date +“ Format 1 Format 2”, Format 1 And format 2 You can specify any separator between .
If the “ year - month - Japan when : branch : second ” The format of , The order is as follows .
[[email protected] ~]# date +"%F %T"
2021-11-20 15:47:53
[[email protected] ~]#
date There's another usage , It is used to set the time , Usage is as follows .
date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]]
The format here is “ Month, day, second, year . second ”, Enclosed in brackets in the format , It means you can't write . here “ year ” Don't write , Not writing means this year , It can be written in four digit years, such as 2021, You can also write two digit years, such as 21.“ second ” The position may not be written , If write , It needs to be added in front “.”. But here's the thing , If it is a single digit, fill in the front 0, Such as 1 To write 01.
Suppose the system time is set to “2012-12-21 10:00:08”, The order is as follows .
[[email protected] ~]# date 122110002012.08
2012 year 12 month 21 Japan Friday 10:00:08 CST
[[email protected] ~]#
[[email protected] ~]# date
2012 year 12 month 21 Japan Friday 10:00:09 CST
[[email protected] ~]#
Because by date Changing the time is just changing the system time , It hasn't changed BIOS Time on . adopt hwclock -s Change the system to and BIOS The time on is the same as the current time .
[[email protected] ~]# hwclock -s
[[email protected] ~]#
If you pass date After modifying the system time, I also want to write BIOS in , Then execute the command hwclock -w that will do .
This method of setting time just now doesn't seem to conform to our habits , By checking the help, you can see that there is a -s Options .
The format is date -s " year - month - Japan when : branch : second ".
Next, set the time to “2012-12-21 10:00:08”, You can use the following command .
[[email protected] ~]# date -s "2012-12-21 10:00:08"
2012 year 12 month 21 Japan Friday 10:00:08 CST
[[email protected] ~]# date
2012 year 12 month 21 Japan Friday 10:00:09 CST
[[email protected] ~]#
This is much more convenient .
adopt hwclock -s Change the system to current .
[[email protected] ~]# hwclock -s
[[email protected] ~]#
About hwclock Use of commands , Please consult the help by yourself .
4.3 man Use
man yes manual Abbreviation , Is the meaning of the manual , Generally known as manpage. If the same command has multiple meanings ,man Put in different “ chapter ” To show , Pass below whatis see passwd result .
[[email protected] ~]# whatis passwd
openssl-passwd (1ssl) - compute password hashes
passwd (1) - update user's authentication tokens
passwd (5) - password file
[[email protected] ~]#
The numbers in parentheses in the second column refer to man It is explained in detail in the chapters of .passwd As a command to change user password , stay man There is a detailed explanation in the first chapter of ,passwd As a password file in man Of the 5 Explained in Chapter .
If you want to look at passwd As the explanation of password file , It can be used man 5 passwd To view the , As shown in the figure below .
Press q sign out .
If you want to look at passwd As an explanation of an order , It can be used man 1 passwd To view the , As shown in the figure below .
Press q sign out , This can be written as man passwd.
Homework
Now I want to set the system time to 2022 year 12 month 23 Japan In the morning 10 spot 23 branch 27 second , Which of the following commands is wrong ?
a. date 12231023202227
b. date -s “2022-12-23 10:23:27”
c. date 20221223102327
d. timedatectrl set-time “2022-12-23 10:23:27”Which of the following commands can list all the files in the current directory , And in reverse chronological order, that is, the first file created , At the end of the line ?
a. ls -lRt
b. ls -lrt
c. ls -alrt
d. ls -alr
边栏推荐
- Firewalld 防火墙
- PHP pseudo protocol for command execution
- Shell programming specifications and variables
- 使用Grafana8.5.2显示zabbix6.0的信息
- Shell script case branch statement, pick the max address of anonymous login FTP
- Image quality evaluation indicators: SNR, PSNR, MSE and SSIM
- 认识交换机以及作用
- RIP综合实验
- MySQL backup and recovery
- 描述DNS解析的工作过程
猜你喜欢

echo -e用法

安装软件提示无法定位程序输入点AddDllDirectory于动态链接库Kernel32.dll上(文末有下载地址)

静态路由综合实验
![[unity Editor Extension] find all objects of a script attached in the scene and resources](/img/c2/ea07a227535755945100dc80a43658.png)
[unity Editor Extension] find all objects of a script attached in the scene and resources

NFS服务

正则表达式

Sword finger offer 48 The longest substring without repeated characters

RHCE8学习指南 第7章 服务管理

二进制安装kubernetes 1.23.2

Firewall firewall
随机推荐
正则、扩展表达式,sed文本处理器与awk工具、用脚本改IP地址
Leetcode 70:Climbing Stairs
高质量的子程序
Lamp platform deployment and Application
SSH远程控制与访问
HCIA第一次静态路由实验
DHCP服务
regular expression
解决WIN10连接共享打印机出现0x00000709的错误
D - parity game discretization + weighted union search set
InnoDB, MySQL structure, and the difference between the three kinds of deletion
Sword finger offer 48 The longest substring without repeated characters
Dirty reading, unreal reading, non repeatable reading
Test knowledge preparation
Make a simple record and check the set
Shell脚本变量、脚本编写和执行(部署Apache与远程备份MySQL数据库)
PXE自动化安装
Understanding of array and bubbling
This article only commemorates the modulus of negative numbers
Redisson实现分布式锁的实战案例-锁单key-锁多key-看门狗