CentOS file and permission management

Source: Internet
Author: User
Linux file management. 1. file naming rules are known to all. files must have file names. in linux, there are the following naming rules to standardize file naming: 1 ). all characters except/are valid. 2). It is recommended that you do not use some text, such as spaces, Tab keys, backspace keys, @, #, $, (), and-. the length cannot exceed 255 characters.

Linux file management.

1. file naming rules

As we all know, files must have file names. in linux, there are several naming rules to regulate file naming,

1). all characters except/are valid.

2). It is recommended that you do not use some text, such as spaces, Tab keys, backspace keys, @, #, $, (), and -.

3). The length cannot exceed 255 characters

4). the current file name cannot be used.

5). Case Sensitive

2. files and directories

Before talking about the directory structure, let's talk about the relationship between files and directories. First, let's ask you a question: What is the directory? Some people may say that the directory is a folder, which can store files. I want to forget the set of Windows. do you remember what we said in the previous blog? There are several linux principles. one of them is that everything in linux is a file. In fact, the directory is also a file, and the directory is a file path ing (a special file). someone will ask again, what is path? the path is the path from the specified start point to the destination. Now that we are talking about the path, let's talk about what is absolute path and what is relative path.

3. absolute and relative paths

Absolute path: name of the file name or directory written from the root directory (/), for example,/home/test/

Relative path: the file name of the current path. For example,./home/test or././home/test. It cannot start with/or is a relative path.

For example, in the home directory (/home), how do you switch to the var directory,

Cd/var (absolute)

Cd ../var (relative)

Hey, do you understand? Because you are under/home, you have to go back to the previous layer (../) before moving to/var! Note these two special directories:

.: Indicates the current directory, which can also be expressed ./.

..: Indicates the directory on the previous layer, or ../.

4. Root (/) directory structure

Before we talk about the root directory, let's look at a problem. There are many directories under the root directory, but there are many linux release versions, isn't the file in the root directory of each release version different? is there a standard to define what should be done, the FHS (Filesystem Hierarchy Standard) we know, so many of the releases we see are similar in many directories in the root directory. Now, let's start to talk about the meaning of each directory:

1)./boot: files related to system startup, such as kernel, initrd, and grub (bootloader)
2)./dev: Device file
Device file:
Block Devices: random access, data blocks
Character device: linear access, in characters
Device No.: main device No. (major) and sub-device No. (minor)
3)./etc: configuration file
4)./home: the home directory of the user. the default home directory of each user is/home/USERNAME.
5)./root: Administrator's home directory;
6)./lib: Library File
Static library,.
Dynamic library,. dll,. so (shared object)
/Lib/modules: kernel module file
7)./media: Mount Point Directory, mobile device
8)./mnt: Mount Point Directory, additional temporary file system
9)./opt: optional directory, the installation directory of third-party programs
10)./proc: pseudo file system, kernel ing file
11)./sys: pseudo file system, property ing file related to hardware devices
12)./tmp: temporary file,/var/tmp
13)./var: changeable file
14)./bin: executable file, user command
15)./sbin: Management Command

16)./usr: shared, read-only. this is the largest directory. almost all the applications and files we use are stored in this directory.

/Usr/bin stores many applications
/Usr/sbin puts some management programs for superusers here
/Usr/lib stores some common dynamic link shared libraries and static Archives

/Usr/local: this is the/usr directory provided to general users. it is best to install the software here (the following directory is similar to the above)

/Usr/local/bin
/Usr/local/sbin
/Usr/local/lib

5. file management

Main commands include ls, cd, pwd, touch, mkdir, rmdir, cp, mv, rm, cat, more, head, and tail.

1). create and delete files

Touch, rm

2). copy and move files

Cp, mv

3) create and delete directories

Mkdir, rmdir

4). view and change the Directory

Ls, tree, cd

5). view the file

Cat, more, head, tail

6. permission management

Main commands include chmod, chown, chgrp, and umask.

1). change the file or directory permissions

Chmod

2). change the owner of a file or directory.

Chown

3). change the group to which the file or directory belongs.

Chgrp

4). display and set the default permissions for files and directories

Umask

7. file search commands

Main commands include: which, find, locate, updatedb, grep

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.