Detailed text view commands commonly used in CentOS

Time:2019-9-10

Key words: 1. Common text viewing commands – – – 2. Types of files and basic permissions

1. Common text viewing commands

Let’s show the commands one by one, and then introduce cat – — more – — less – — head – — tail.

Usually I use cat more when I actually use it. Used to it…. Look at the picture

wKioL1VdKgTjjeL9AAKMRv87rqM130.jpg

More has the advantage of displaying what you want to see per cent

Use less keyboard shortcuts to help you achieve, you want to complete the adjustment! (You can actually do it yourself)

Turn up and down the letter J K

G Jump End

G arrives at the head of the line

The space bar is also very useful!!

So head and tail.

At the same time, you can specify how many lines to display (you can see the difference by comparing the content shown in the cat above)

wKioL1VdOgyRsxXvAABU6KVKxyg170.jpg

wKioL1VdOjryAW4gAABG554etbA172.jpg

A last line displaying the text of a file or a first line displaying the text of a file

Write it down as head-n/etc/passwd | | tail-n/etc/passwd (-n stands for numbers)

!!!! Just add numbers!!!!

2. Types of files and basic permissions

Everyone remembers the commands when learning ls. In order to see the details of the file, they use ls-l or ll.

wKiom1VdOjKTgkecAABfS7ZFyVw134.jpg

Look at such a large section, don’t rush to slow down!

Let’s look at it separately.-

This one represents the file type

– Ordinary documents

D directory file

Link file

B block equipment

S socket

C character device

P Pipeline File

You can judge the file type based on this after knowing such a long period of time.

So rw-r–r — not to mention first, but later.

This one appeared after CentOS 6. It has something to do with selinux. Some of them are followed by + this is the problem of acl.

Looking back, two roots represent the owner: the owner group and another user.

So far, OK can finally tell you rw-r-r.

RW – is the owner root privilege; R — is the group privilege; R — is the privilege of other users

Meaning of the expression r. W. x

R – Read permissions

W – – Write permission

X – Implementation

eg:

Drwxr-xr-x 10 root 4096 December 26 09:49 source 1

– rw-r–r–1 root 1161 December 2609:49 search.php.2

Look at Example 1 and explain what x says above is execution permission.

X. Usually it can be said to be execution rights (some ordinary files are also available). For directories,’x’is very important. He decides whether we can enter directories (cd).

Next, the number 4096 in eg:1 — represents the size of the file

Following the figures, December 2609:49 represents the latest revision time of the document.

And then there’s the filename.

——- Let’s talk about drwxr-xr-x. The number 2 after drwxr-xr-x. That’s inode. You can see the inode number with ls-i

The numerical meaning is (several files use the same inode node number)

Now that r-read w-write x-execute is said, these permissions can be changed, the command is Chmod

How to change the expression of the question??????

I want to change the 1.txt I created myself.

The default permission of directory 755 is (rwxr-xr-x)

File default permission 644 is (rw-r–r–)

So the default 644 (rw-r–r–) conversion I created for 1.txt is (4+2–4–4) = 644.

I want to change my 1.txt permission to 666 to see the picture (see my arrow)

wKiom1VdPsaQx_0FAADVWAzXBXo283.jpg

Look at another one about directories.

wKiom1VdPxuhVoQ5AAISeBfQZnQ341.jpg

I added a parameter – R, which can recursively modify the permissions of the entire directory when using the directory!! Just look at my picture.

Then we go on to introduce the owner and ownership group.

File owners and ownership groups can also be modified using the chown command

Also using the test1 file, I also built two users test1 and test2 to talk with pictures.

wKioL1VdQgLiT9Q_AADD6oUl_XA079.jpg

The previous owner ownership groups of directory test1 were root, and the owner was modified to test1.

Change ownership group

wKiom1VdQP7xUXgqAAEHcGrlALU761.jpg

I want to change back???? Keep looking at the pictures and talking.

wKioL1VdQqvgOy1TAADsEksEIfo881.jpg

Recommended Today

Hadoop MapReduce Spark Configuration Item

Scope of application The configuration items covered in this article are mainly for Hadoop 2.x and Spark 2.x. MapReduce Official documents https://hadoop.apache.org/doc…Lower left corner: mapred-default.xml Examples of configuration items name value description mapreduce.job.reduce.slowstart.completedmaps 0.05 Resource requests for Reduce Task will not be made until the percentage of Map Task completed reaches that value. mapreduce.output.fileoutputformat.compress false […]