当前位置:网站首页>Use of rhcsa simple commands (LS, date, timedatectl, file, STAT), file type
Use of rhcsa simple commands (LS, date, timedatectl, file, STAT), file type
2022-07-22 10:12:00 【Remancy0429】
One 、 Complete commands and parameters
Tab key
Two 、 Terminate the current process
Ctrl+C
3、 ... and 、 Order help
Commands are divided into internal commands or external commands ,shell( command interpreter ) The built-in command becomes an internal command , Others are external commands ;
Command options : Just enter a command , The content displayed by default can not meet user requirements , Users can add corresponding options , Customize the output ;
Arguments to the command : The operation object of the command , Such as ls The summary of is "ls [ Options ] [ file name …]",[ file name ] Namely ls Arguments to the command
1、man command
- man To provide online help , Permissions are all users , Use man Command to access help information
- man command 【 Options :-C config_file: Specify profile man.conf, The default value is /etc/man.conf】

stay man In the interface of command help information , The common operation keys included are as follows :
Key | effect |
Space bar ,page down | Turn down a page |
page up,b | Page up |
home | Go directly to the home page |
end | Go directly to the end page |
/ | Search a keyword from top to bottom , Such as “/linux” |
? | Search for a keyword from the bottom up , Such as “?linux" |
n | Navigate to the next keyword found |
N | Navigate to the last keyword found |
q | Exit help document |
man The structure of the help information of the command is as follows :
Structure name | Representative significance |
name | Name of the command |
synopsis | General usage of parameters |
description | Introduction |
examples | demonstration ( With a brief explanation ) |
overview | summary |
defaults | Default features |
options | Specific options available |
environment | environment variable |
files | Documents used |
see also | Relevant information |
history | Maintenance history and contact information |
man Several parts of the manual

2、 see bash Internal commands help
The order is bash Built in command , Used for display bash Help information for built-in commands .
help The command can only display bash Help information for built-in commands , For the help information of external commands, you can only use man perhaps info Command view .
help [ Options ] [ Parameters ]
Options
-d: Displays a brief description of the built-in command .
-m: according to man Output help information of built-in commands in the format of manual .
-s: Only output the command format of built-in commands .
Parameters :bash Built in command ( Can be for more than one , Please separate with a space )
3、help command
4、info page
info page And man It's used for the same purpose , Are used to query the command usage or file format , But with the man The difference is info page It is to split the file data into paragraphs , Each paragraph is written on its own page , And in each page there are similar pages 【 Hyperlinks 】 To jump to different pages , Each individual page is also called a node (node)
However, the description file of the target data to be queried must be info Only when it is written in the format of info Special features of ( Like hyperlinks ). And this support info By default, the file of the command is placed in /user/share/info/ In this directory .
Four 、 View the files in the directory ls(list)
Options | function |
-l | Displays the details of files and directories in a long grid , |
-d | Displays information about the specified directory itself , Instead of the information of each file and subdirectory in the directory |
-c | After sorting by the modification status time of the file , Display |
-h | Show the size of a directory or file in a more user-friendly way , The default size is in bytes , Use -h Option will be displayed as K、M Equal unit . This option requires and -l Options can be used in combination to reflect the results |
-R | Recursively displays all contents of the specified directory and its subdirectories |
-a | Display information about all subdirectories and files , Include name to “.” The hidden file of the hidden directory at the beginning |
-A | And -a Options work similarly , However, it does not display... Representing the current directory “.” And identify the parent directory “..” |
-i | Show file index node number (inode); An index node represents a file , stay Linux All the files saved in the disk partition are assigned a number , Become the inode number inode |
-s | Sort by file size |
[[email protected] ~]# ls /
bin boot dev etc home lib lib64 media mnt opt proc root run sbin
srv sys test tmp usr var
[[email protected] ~]# ls -dl /root/
dr-xr-x---. 2 root root 203 Jun 9 15:30 /root/
5、 ... and 、date command
Input date --help
date Common parameters in commands and their functions :
Parameters | effect |
%Y | Full month ( for example :2022) |
%m | month (1~12) |
%d | The day of the month |
%H | Hours (00~23) |
%M | minute (00~59) |
%j | The day of the year |
Time now :
6、 ... and 、timedatectl command
- timedatectl The command is used to set the system time , English full name :“ time date control ”
- The grammar format is :timedatectl [OPTIONS...] COMMAND ...
- If the computer time is found to be inconsistent with the actual , If it's only a few minutes away , We can directly adjust , But if it's a few hours away , So besides adjusting the current time , It is also necessary to check the time zone .
Input timedatectl --help
Parameters | effect |
status | Displays the current time setting |
show | Display the characteristics of system timing |
set-time TIME | Set system time |
set-timezone ZONE | Set the system time zone |
list-timezones | Displays the known time zone |
set-local-rtc BOOL | control RTC Is it in local time |
set-ntp BOOL | Enable / Disable network time synchronization |
- Check the system time and time zone :timedatectl status
- If the time zone found is not Shanghai (Asia/Shanghai), It can be set manually :
timedatectl set-timezone Asia/Shanghai
- If the time is still incorrect , You can manually modify the system date :
timedatectl set-time 2022-07-15
- Modification time :
timedatectl set-time 14:00
7、 ... and 、file Use of commands
- file The command is mainly used for : By reading the contents of the document in detail , To identify the type of document
- Command format :file [OPTION...] [FILE...]
- Exhibition file Type of file : Input file --help
Options | describe | |
-v | --version | View help documents |
-m | --magic-file LIST | Use LIST Specify the file name of the magic file |
-z | --uncompress | Check the file types in the compressed package |
-b | --brief | The file name is not displayed in the result |
-c | --checking-printout | Display the parsing format of magic file , and -m Together, you can debug new magic files before installation |
-e | --exclude TEST | from test Select a parameter from the list as TEST, Do not show the selected type . legal test list :ascii,apptype,compress,elf ,soft ,tar ,tokens ,troff15 |
-f | --file-from FILE | from FILE Read the file name in , Show the file types separately |
-F | --separator STRING | Use STRING As a separator , instead of ‘:’ |
-i | --mime | Output MIME Type string ( amount to --mime-type and --mime-encoding) |
--apple | Output APPLE CREATOR/TYPE20 | |
--mime-type | Output MIME type | |
--mime-encoding | Output MME code | |
-k | --keep-going | Continuous matching |
-L | --dereference | Follow the soft link ( Default parameters ) |
-h | --no-dereference | Do not follow soft links |
-n | --no-buffer | Do not cache output |
-N | --no-pad | Do not fill the output |
-0 | --print0 | Use ASCII NUL As the end of the file name |
-p | --preserve-date | Keep the file atime |
-r | --raw | Do not convert unprintable characters into \ooo |
-s | --special-files | Put special documents ( Block device / Character device ) As an ordinary document |
-C | --compile | Compiled by -m Output file |
-d | --debug | Display debug information |
-l | --list | List magic intensity |
file Command determines the order of file types :
- Inquire about Device, Directory, Symbolic And so on
- Query compressed files
- Inquire about tar file
- be based on Magic Query of database file
- Inquire about ASCII,UNICODE And other types of text files
- If none of the above meets , Then the file is binary
8、 ... and 、stat Use of commands
1、stat The command is used to display the details of a file or file system ; When displaying file information , Than ls The command is more detailed
2、 Command format :stat [OPTION]... FILE..
3、 Command options :-L: Display the information of the file pointed to by the symbolic link ;
-f: Displays information about the file system where the file is located ;
-t: Output information in a concise way ;
-c: Output some information of the file in a specific format
4、 About stat Three times of the file in the command
Access Time: Shorthand for atime, Represents the access time of the file , When file content is accessed , Update this time
Modify Time: Shorthand for mtime, Indicates the modification time of the document content , When the data content of a file is modified , Update this room .
Change Time: Shorthand for ctime, Indicates the state time of the file , When the state of the file is modified , Update this time , For example, the number of links to a file , size , jurisdiction ,Blocks Count .
Verify through code :
atime File access time update
By using cat Command to view the contents of the file , It is equivalent to accessing the contents of the file , So the access time is updated , The other two times remain the same
mtime The modification time of the file is updated
adopt echo The command will string 456 Input to file In file , Thus, the contents of the file are modified , therefore mtime change
ctime The status time of the file is updated
adopt chmod The command changes the permissions of the file , therefore ctime Time changes
Nine 、Linux File types in
Use ls -l The first character you see after the command
1、- Ordinary documents , Be similar to Windows notepad
2、d Directory file (directory), Be similar to Windows Folder
3、c Character device file (char), Serial port devices , Sequential reading and writing , keyboard
4、b Block device file (block), Interface devices available for storage , Random, speaking, reading and writing , Hard disk
5、p Pipeline files (pipe), For interprocess communication
6、s Socket file (socket), For communication on the network . You can start a program to listen to the client's request , The client can communicate data through socket .
7、l Symbolic links are also called soft links , And the original file is not a file (link), for example Windows Shortcut to , If the original file is deleted , All symbolic links to it are destroyed . Soft links have their own node, yes Linux A kind of special document , As a document , Its data is the path of the file to which it is connected . Symbolic links can span file systems , You can also create a directory .
8、 Hard links , Only files in the same file system can be referenced . It refers to the physical index of the file in the system ( Also known as inode). When the original file is moved or deleted , Hard links will not be broken , Because it refers to the physical data of the file rather than the location of the file in the structure .
边栏推荐
- How to efficiently backup local data to Tencent cloud
- Use epoll to manage or golang multiprocess in case of a large number of connections
- Moonbeam创始人解读多链新概念Connected Contract
- Set exercise program
- 别闹了,想进大厂还不知道提升哪些方面的能力吗?(赶快收藏)
- 对WEB标准以及w3c的理解与认识?
- Let me show you eight fallacies in software design
- Resume in 2022 is dead in the sea. Don't vote. Software testing positions are saturated
- Différences entre les liens durs et les liens souples de rhcsa, interprétation des répertoires de premier niveau, redirection, création de fichiers et de répertoires, suppression de fichiers et de rép
- 银河证券vip链接开户安全吗,佣金最低多少的?
猜你喜欢
AutoJs学习-实现抽屉效果
"Everything is interconnected, enabling thousands of industries", the 2022 open atom global open source summit openatom openharmony sub forum is about to open
别闹了,想进大厂还不知道提升哪些方面的能力吗?(赶快收藏)
After leaving Google, the former head of go language changed to a small company
Microsoft gives up "blocking" commercial open source!
[error reporting] valueerror: it seems that you are using the keras 2 and you are passing both
“万物互联,使能千行百业”,2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛即将开幕
Highly concerned, list of the latest agenda of 2022 open atom open source Summit
初识 JS
这项比赛有点逆天!鲲鹏应用创新大赛openEuler赛道全面开启
随机推荐
UOB camera registers the detailed configuration of easycvr platform through gb28181 protocol
简单的一个盒子移动到另一个盒子,你用什么方式实现动画效果
Fast-SCNN的解释以及使用Tensorflow 2.0的实现
MxCAD5.2 20190704更新
直播预告 | NFT, AIGC/UGC工具与元宇宙产品带来的新的设计创意与生产方法
2022百度世界大会收官 希壤元宇宙露天巨幕&定制会场首秀
Redis Client集成Prometheus指标
Google Chrome browser will support taking notes on any web page and multi device synchronization
[Arduino] raspberry pie rp2040 on-board ws2812 lamp transformation effect and breathing lamp effect example
Robot slam navigation core technology and practice Season 1: Chapter 1_ Necessary knowledge for ROS entry
AutoJs学习-实现抽屉效果
Différences entre les liens durs et les liens souples de rhcsa, interprétation des répertoires de premier niveau, redirection, création de fichiers et de répertoires, suppression de fichiers et de rép
day02
[information system project manager] Chapter IV comprehensive management knowledge structure
Web crawler crawls the inspirational bullet screen of station B and generates word cloud (careful note summary)
What is cloud rendering? How fast is the rendering speed? Yiwen tells you
Vinco Ventures任命Ted Farnsworth为联合首席执行官
Set集合
对WEB标准以及w3c的理解与认识?
Autojs learning - achieve file download progress