In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Detailed description of file attributes
Soft and hard links:
Ls-li view file details including inode number
File 111and 333 are hardwired with the same inode number.
File 111and 444 are softlink inode numbers different-equivalent to file data shortcuts
2. Detailed description of file attribute information-type of file
Ordinary document
D = directory
L = software link file
C _ b _ b = device file
S = socket file socket (network transfer)
| = pipe file
3. Check which directory the command belongs to.
Which + Command cp mv mkdir
Whereis+ command
Locate-query the path where the ordinary file is located
Yum install-y mlocate
Updatedb-to view file information, you need to update the database
How it works: unlike find, locate looks for records in the / var/lib/mlocate/mlocate.db library, not in the system as find does. Use locate to find when a new file is created, you must refresh the library with updatedb before you can find it.
Find command
Find /-type d-name "directory name" looks up according to the file name
Find /-type f-name "user name" looks up according to the directory name
Find /-type f-iname "user name" ignores case lookup
Find /-type f-size + 100Lookup size greater than 100KB based on file size refers to inod size
Find /-type f-size 100looks up the 100KB based on the file size
Find /-type f-size-100looks for objects smaller than 100KB based on file size
Find /-type f-mtime + 7 find files from 7 days ago
Find /-type f-mtime 7 finds a file that happens to be on the 7th day
Find /-type f-mtime-7 find files within 7 days
Compressed file
The tar-zcvf / xxx/xxx.tar.zip / xxx/xxx compression package comes first, and the files to be compressed follow.
Z: represents the way in which data is compressed
C: means to create a compressed package
V: show the compression process
F: specify the path of the compressed package
Extract the file
Tar-zxvf / xxx/xxx.tar.zip
X: indicates decompression
Note: when compressing data, I want to kick out a directory or file that is not compressed.
Use the (--exclute) parameter to exclude a directory or file
4. Detailed description of file permission attributes
Ritual 4 read
White2 write
Xero1 execution
The owner of the file rwx 777
All groups of the file rwx 777
Other people in the document rwx 777
Note: general file owner permissions are high, others will not be given 777 permissions
User classification:
Root user system super users run rampant id (0)
Virtual users do not have a home directory in the system, nor can they log in to the system. You can see that there are many unknown users in / etc/passwd. That is the virtual user id range (1-999).
Ordinary user rights are limited id (1000 -)
5. Permission relationship to which a directory or file belongs:
The user whose owner creates a directory or file
By default, all groups belong to all groups with the same name as their owner (you can add a user to all groups at will, so that the user has the same permissions as all groups
The others
Three timestamps for a file or directory:
Stat XXX View Command
Access means "visit".
When you use a file of cat, more, less, grep, sed, cp, file on the terminal, the time record of the Access of this file will be updated.
The file time seen with ls-lu is the time of the last access. For the directory, the access time of the directory will be updated
Just entering the directory will not change its access time, but just use ls to view the contents of this directory
Modify means "change (content)," or "write".
When the contents of a file are changed, the time record of the file's modify is updated.
To change (a state or property) by Change.
After mv, chown and chgrp operations on a file or directory, its Change time record is updated
System time View Settings
Define the purpose of the time format: it can be used in subsequent data backups, allowing the system to generate files or directories backed up by date
Files / etc/date'+% F% T' to be backed up by cp
Set system time
Data-s' 20200202 'set date
Data-s' 20200202 15VR 02VR 02' set date and hour, minute and second
Date-d "+ 1 day"
Date-d "- 1 day"
Set up NTP time synchronization service
Ntpdate IP (NTP server) (yum-y install ntpdate)
6. File details inode and block
INode: storing file details
Store file pointer information
After formatting the disk, define the file system to form an iNode
Block: storing content data information
After formatting the disk, define the file system to form a block
Directories and files iNode and block contain information
Directory inode directory attribute information names of files contained in the block directory
File inode file attribute information data information contained in block file
Is there enough disk capacity? There are two factors that determine: iNode and block. If the iNode number is not enough, the disk will also report that there is not enough disk space.
Reason:
A, too many small files take up a lot of iNode
B, too much data takes up a lot of block
Disk partition capacity is not enough to delete large files:
A, find the large files in the full partition: find / mnt-f-size + 100m find files larger than 100m
B. Find the large files in the full partition: du-h / mnt | sort-h first use du to find the file size and then sort it with sort
View disk iNode
Df-I
Block defaults to one block=4096 byte
Disk optimization
File size single block size requires the number of block
655k data 100k/block 7 block
Getconf PAGESIZE View block size
Mke2fs-b 4096 / dev/hda6 resize block
So: the larger the optimization of a single block, the less block is required, and the more disk iUnix is saved.
10k data 100k/block 1 block
Therefore: setting a single block smaller can also save disk space.
File attribute details differences between soft and hard connections
Hard connection: multiple files have the same iNode number. Deletion of the source file has no effect on the hard connection file.
Ln filename hardlink filename
Soft connection: equivalent to a shortcut key for a file, the source file deletes the soft link file.
Ln-s file name soft link file name
Note: directories can create soft links, not hard links
Add:
Interview question: what does the number of '80' hard connections mean under the command ll / etc/-d?
Indicates that there are 78 subdirectory links under the / etc directory (each directory is essentially a file with an iNode, excluding itself / etc and. There are 78 of these two catalogs.
System symbol information:
1. Basic symbol information
Take the variable information and the specified column (awk) to identify the user information
! To take the most recently executed command (history) to indicate compulsion (text editing)
| | submit the result of the command at the front of the pipeline to the command at the end of the pipeline |
Often cooperate with | xargs to display a line, or | xargs-N1 indicates grouping
# indicates comment (script) indicates root user
"" double quotation marks indicate parsed output
'' single quotation marks indicate normal output
``backquotes indicate commands in priority processing.
2), logical symbol series
& & represents logic and relation
| | indicates logic or relationship |
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.