Laruence's Linux private House dish-basic learning 2

Source: Internet
Author: User
10. the meaning of directory properties r: indicates that you have the permission to read the directory structure List. Therefore, when you have the permission to read the r directory, you can use the ls command to list the contents of the directory w: write permission is very useful for directories. Because it indicates that you will have the permission to change the directory structure List,... information

10. Significance of directory properties
R: indicates that you have the permission to read the directory structure List. Therefore, if you have the permission to read the r directory, you can use the ls command to list the contents of the Directory.
W: write permission is useful for directories. Because it indicates that you will have the permission to change the directory structure list, that is, the following permissions:
Create new files and directories, delete existing files and directories, rename existing files or directories, and move the files and directories in these directories
X: It depends on whether the directory can be accessed.
 
11. Linux Directory configuration Standard FHS (Filesystem Hierarchy Standard)
/: The root directory is the first partition to be loaded during startup. all the files used during startup should be placed in this partition. The five subdirectories/etc,/bin,/dev,/lib, and/sbin should be connected to the root directory and cannot be independent of a partition.
/Bin,/usr/bin,/usr/local/bin: directory where users can execute binary files.
/Boot: mainly used for Linux startup. The vmlinuz file under this directory is the core of Linux. if it is the grub boot program, there is also the/boot/grub subdirectory under this directory.
/Dev: In Linux, any device is stored in this directory as a file. Accessing a file under this directory is equivalent to accessing a device. Important files include/dev/null,/dev/tty [1-6],/dev/ttyS *,/dev/lp *,/dev/hd *,/dev/ sd *, etc.
/Etc: almost all the major settings files of the system are stored in this directory. Important files include:/etc/inittab,/etc/init. d,/etc/modprobe. conf,/etc/X11,/etc/fstab,/etc/sysconfig, etc.
/Home: This is the default home directory of the system ,~ Indicates the home directory of the current user.
/Lib,/usr/lib,/usr/local/lib: Directory of the function library used by the system. More importantly, the/lib/modules Directory contains core modules.
/Mnt,/media: default loading point of system floppy disk and CD
/Opt: Directory for additional software installation on the host
/Proc: "Virtual File System", where all data is stored in the memory, such as the system core, formation information, external device status and network status.
/Root: home directory of the system administrator (root)
/Sbin,/usr/sbin,/usr/local/sbin: run commands that are used by system administrators.
/Srv: The data directory to be accessed by some services after they are started.
/Tmp: the place where files are temporarily placed by the general user or the program being executed
/Usr: contains the main program of the system, the files required for the graphic interface, additional function libraries, software installed on the local machine, and shared directories and files.
/Var: mainly stores files that change frequently during system execution.
 
General host partition and directory configuration
//,/Boot,/usr,/home,/var, SWAP
 
11. file systems supported by Linux
/Lib/modules/'uname-r'/kernel/fs
 
12. Linux file and directory management
Cd: switch directories
Pwd: displays the current directory
Mkdir: create a new directory-m to set file permissions, and-p to create the required directory recursion
Rmdir: delete the empty directory-p and the empty directory on the upper layer are also deleted.
 
Variable in the execution file PATH: $ PATH. when executing a command, the system searches for the execution file in the PATH defined in each PATH according to the PATH setting. The first searched command is executed first.
Echo $ PATH
PATH = $ PATH:/root
 
Ls: View files and directories ls-alh
Cp: copy a file or directory cp-a = cp-pdr.-r can copy a directory, but the permissions of the file and directory will be changed.
Rm: delete a file or directory rm-rf
Mv: Move files and directories, or rename
 
View file content
Cat: displays the file content at the beginning of the first line.
Tac: display from the last line
Nl: displays the output row number.
More: displays the file content on one page.
Less: similar to more, but can flip the page forward
Head: only the first few rows
Tail: only the last few rows
Od: Read file content in binary mode
 
Modify the file time and create a new file: touch
 
Default file permission: umask output 0022, umask-S output u = rwx, g = rx, o = rx
 
File hiding properties
Chattr: sets the file hiding attribute.
+ A: After setting a, this file can only add data but cannot be deleted. only root can set this attribute.
+ I: prevents a file from being deleted, renamed, set connections, and cannot be written or added to data.
Lsattr: Display the hidden attributes of a file
 
Special file permissions: SUID/SGID/Sticky Bit
Set UID: s and t permissions are used to allow general users to temporarily have the permissions of the program owner when executing certain programs. SUID can only be used in binary files, SUID is useless for directories
Set GID: File: when the program is modified, its valid user group will become the user group owner (group id) of the program ). Directory: if it is set to Directory A, the user group of the files or directories created in Directory A will be the user group of directory.
Sticky Bit: valid only for directories and invalid for files. In a directory with SBit, if a user creates a file or directory under this directory, only the file owner and root have the right to delete the file.
 
File type: file
 
Search for files
Whereis and locate use databases to search for data.
 
Find command
Example 1: list the files with changed content (mtime) in the past 24 hours.
Find/-mtime 0
Example 2: search for files under/etc, and list them if the file date ratio is/etc/passwd.
Find/etc-newer/etc/passwd
Example 3: Search for dmtsai files under/home
Find/home-user dmtsai
Example 4: search for files in the system that do not belong to anyone
Find/-nouser
Example 5: find the file named passwd.
Find/-name passwd
Example 6: search for a file whose property is f
Find/home-type f
Example 7: Search for SUID/SGID/SBIT attributes in a file
Locate/-perm + 7000
Example 8: use ls-al to list the files found in the previous example.
Find/-perm + 7000-exec ls-l {}\;
Example 9: find files larger than 1 MB in the system
Find/-size + 1000 k

Author "allenhu0320"
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.