In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what are the commonly used text view commands in CentOS", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn what are the commonly used text view commands in CentOS.
1. Commonly used text viewing commands
Show the commands one by one, and then introduce cat---- more- less-head- tail
I usually use more cat when I actually use it. I'm used to it. Look at the picture.
The benefits of more can be shown according to% of what you want to see.
Use relatively free that is less various keyboard shortcuts to help you achieve, you want to complete the adjustment! (you can actually do it yourself.)
The letter j k turns the page up and down
G jump to end of line
G reaches the beginning of the line
The space bar is also easy to use!
So head and tail, when we go this way, they display the output in the opposite direction-the first ten lines of text (head) and the last ten lines of text.
At the same time, you can specify how many lines to display (compare the cat display above, you can see the difference)
One displays the last line of the file text and the other displays the first line.
If you write it in full, it is head-n / etc/passwd | | tail-n / etc/passwd (- n represents a number)
! Just add the numbers!
two。 Types of files and basic permissions
Everyone remembers the command when learning ls. In order to see the file details, they will use ls-l or ll.
Look at such a long section, don't hurry and take your time!
The previous one I marked-rw-r--r--. Let's take a look at it separately-
This one represents the file type.
-ordinary files
D directory file
L link file
B block equipment
S socket
C character device
P pipe file
After knowing such a long section, we can judge the file type according to this.
Then rw-r--r-- will not talk about it at the moment, but he will say later.
The one that appeared after centos 6. Related to selinux, some are followed by + this is the problem of acl as long as you know.
So looking back, the two root represent the owner: the ownership group and an other user.
Ok can finally tell you rw-r--r-- at this point.
Rw- is the owner's root permission-- is the permission to own the group-- is the permission of other users.
The meaning of r w x expression
RMui Mui-read permission
Wmurmuri-write permission
XMui Mutual-Executive
Eg:
Drwxr-xr-x 10 root root 4096 December 26 09:49 source 1
-rw-r--r-- 1 root root 1161 December 26 09:49 search.php 2
Look at example 1 and explain x. It says it's execution permission.
X can usually be said to have execution permissions (some ordinary files also have). For directories,'x'is very important, and he decides whether we can enter the directory (cd).
After that, the number 4096 in eg:1 represents the size of the file.
The number followed by 09:49 on December 26 represents the latest modification time of the document.
And then there's the file name.
-tell me about drwxr-xr-x. The number behind that is 2. That's inode. You can see the inode number with ls-I
The meaning of the number is (several files use the same inode node number)
Since it is said that r-read w-write x-execute, that is to say, these permissions can be changed, the command is chmod
The question is how to change it and how to express it?
-just say one number to indicate that in the permission, I want to change the 1.txt I created myself. So this way.
The default permission of the directory is 755, i.e. (rwxr-xr-x)
File default permission 644, that is, (rw-r--r--)
So the default conversion of 1.txt I created is 644 (rw-r--r--) = 644.
I want to change my 1.txt permission to 666. Look at the picture (see my arrow)
Look at another one about the catalog.
I added a parameter-R so that when used in the directory, I can recursively modify the permissions under the entire directory! Just look at my picture.
Then let's move on to owners and ownership groups.
File owners and ownership groups can also be modified using the chown command
Also use the test1 file, I also set up two users test1 and test2 to look at the picture and talk
The previous owner group of the directory test1 is root, and the owner is changed to test1 first.
Change the ownership group
I want to change it back. Keep looking at the picture and talking.
The above is all the contents of the article "what are the commonly used text View commands in CentOS?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.