Linux permission operation
This article is based on my personal notes after reading "laruence Linux private house dish". It is a good entry-level teaching material for learning Linux.
I. File Attributes ls
Ls-AL: list all file attributes
Ls indicates list.
Archive type
[D] Directory [-] archives [|] links
[B] Interface Devices in device files for storage
[C] serial devices in Device Files
Ii. Modifying file attributes and permissions
1. chgrp: Change group to which the archive belongs
Chgrp [-R] group name dirname/filename...
-R indicates that recursive continues to change, and all files under the directory are changed.
2. chown: change owner of an archive
Chown user name [-R] account name archive ring directory
Chown user. group file also modifies the group when the user is modified.
Chown User: group file to avoid errors in user names:
Chown. group file can also be directly set.
3. chmod: Changing the permissions of an archive, including SUID, SGID, and sbit
Change Mode
Chmod [-R] xyz file or directory
(1) Use numbers to change permissions
X = owner = R + W + X;
Y = Group = R + W + X;
Z = others = R + W + X;
R: 4 W: 2 X: 1
Example of change:
(1) Change the file to-rwxr-XR --
Chmod 754 filename
(2) Change the file to-rwxr-XR-x
Chmod 755 filename
(2) Use Symbols to change the File Permissions
U = user G = Group O = others a = all
+ Add-Remove = set (+-it will not change other values)
R w x
Example of change:
(1) Change the file to-rwxr-XR --
Chmod u = rwx, G = RX, O = r filename
(2) Add everyone in the archive to the write permission
Chmod A + W filename
(3) remove execution power from all archives
Chmod A-x filename
4. Copy the target file of the CP source file
File Permission
R: Read the actual content of this file.
W: Edit, add, and modify files, excluding deleting files
X: The file has the permission to be executed by the system.
Directory permission
R: indicates that the file name data in the directory can be queried, that is, the LS and other commands can be used.
W:
Create a new archive and Directory
Delete existing files and directories
Rename an existing file or directory
Move the files and directories in the directory
X: indicates whether the user can enter the directory to become a working directory (that is, enter the folder)
Create directory
Mkdir directory name
Empty document creation
Touch directory/file name
Delete an object
RM file name
Switch user
Su-User Name
Current user logout
Exit
File Type
? In rwxrwxrwx? Type
-Regular Archives
Plain text ASCII
Command for reading text files
Cat ~. /File name
Binary
Data File
Command for reading data format files
Last
D directory file
L link file (l) is similar to a shortcut
Devices and devices
B Storage Device under/dev/SDA
C character device mouse and keyboard
S data interface sockets
In/var/run
P data transmission (FIFO, pipe)
FIFO first-in-first-out solves the error caused by multiple program colleagues accessing one file
Linux File Extension:
*. Sh script and batch processing file scripts. It is called SH because it is written in shell.
*. Z, *. Tar, * .tar.gz, *. Zip, *. tgz.
*. Html, *. php html directly open the server side of the PHP client for browsing
Linux restrictions on file names
Cannot contain the following *? > <;&! [] | \'"'(){}
The file name starts with., indicating that the file is hidden.
-+ It is usually used to indicate that the selected item cannot be used.
Linux directory configuration basis-FHS-filesystem Hierarchy Standard
Shareable unshareable
Unchanged static/usr software placement/etc configuration file
/OPT third-party software placement/boot and core files
Variable variable/var/Mail User email box/var/run program
/Var/spool/news newsgroup/var/lock Program
FHS only defines what data should be placed under the three-tier directory
/(Root, root directory): Related to the boot System
/Usr (UNIX Software Resource): related to software installation/execution
/Var (variable): Related to the system operation process
*/Bin place commands that can be used by root and general accounts, such as CAT, chmod, chown, date, MV, mkdir, CP, and bash.
/Put the files available for use in Boot, Linux core files and boot configuration files, such as vmlinuz and grub.
*/Dev any device or interface device is in this directory
*/Etc place the main system configuration files. Generally, users can check the files that can only be modified by the root user. It is not recommended to put executable files.
Important directories include:
/Etc/init. d/the preset startup scripts of all services are put here
Directory of configuration files for various services managed by/etc/xinetd. d/super daemon
/Etc/X11/configuration files related to X Window are put here, especially the configuration file Xorg. conf.
/Home: the default home directory. the user's home directory will be under this directory.
*/Lib: Class Library and/bin used during startup, class library used in/sbin commands, and core module driver in/lib/modules
/Media stores removable devices, such as floppy disks, CDs, and DVDs.
/Mnt device used for temporary mounting
/OPT third-party software location
/Root system administrator root's home directory. It is best to place the root directory and root directory in the same partition.
*/Sbin contains commands required for starting, repairing, and restoring the system.
/Srv service abbreviation, data directory after the network service starts
/Tmp: temporarily place the files in the programs being executed by the general user. Do not store important data.
/Lost + found: if an error occurs in the file system, the lost part will be put under this Directory, which is the product of the ext2/ext3 file system.
/Proc stores data in the memory, such as the system core, thread information, and network status.
/Sys records core information, such as hardware device information.
* Cannot be separated from the root directory in different regions.
. Indicates the current directory, which can also be expressed ./.
.. Indicates the directory of the previous layer, which can also be ../.
Uname-r view core version number
Lsb_release-a view the Release System Version
[Transfer] http://blog.csdn.net/del1214/article/details/6673069