[Apue] Chapter fourth documents and directories

Source: Internet
Author: User
Tags bit set

The content of this chapter is more, this paper only records the problems found in the learning process, while recording the required knowledge of Linux. File Type

Normal file
Catalog files
Block Special File
Character Special File
Fifo
Sockets
Symbolic Links
Here to introduce the next Dos2unix command, just a few days ago in the work of contact.
The Dos2unix command is used to convert a DOS-formatted text file to a UNIX-formatted (Dos/mac to UNIX text files format converter). Dos text file is the "R \ n" as the symbol of the break, said 16 into the system is 0D 0 A. The text file under Unix is called \ n as the break mark, which is represented as 16 in 0 a. DOS format text files under Linux, open at the end of a lower version of VI will show ^m, and many commands are not very good to handle this format file, if it is a shell script. Text files in UNIX format are displayed together when opened with Notepad in Windows. As a result, there is a need to convert two format files to each other, and the corresponding conversion of UNIX-formatted text files into DOS format is the Unix2dos command.

Install the Dos2unix method in Ubuntu:
Apt Install Dos2unix
Installation completed through the man Dos2unix can see the following explanation:

The use of \ is mentioned in the program explanation in Figure 4-3: to notify the shell to continue typing commands on the next line, the shell goes through > prompts us to continue typing on the next line
set up user IDs and set group IDs

When a program file is executed, the valid user ID of the process is usually the actual user ID, and the valid group ID is usually the actual group ID. However, you can set a special flag in the file mode Word (st_mod), which means "when executing this file, set the valid user ID of the process to the user ID (st_uid) of the file owner." In the file mode Word, you can set another one, It sets the valid group ID of the process executing this file to the owner ID (st_gid) of the file. These two bits in the file-mode word are referred to as setting the user ID (set-user-id) bit and setting the group ID (set Group-id) bit.
Unix System Program passwd (1) allows any user to change his or her password, a program that sets the user ID.
Files and directories

Directory and file permission meaning:
The importance of permissions to files:
R (Read) reads the actual contents of this file, such as reading text from a literal file
W (write) To edit, add, or modify the contents of the file
X (Execute): The file has permissions that are executed by the system

The importance of permissions to the directory:
R indicates a permission to read a list of directory structures
W indicates a permission to change the directory structure list
x indicates whether the user can access the directory's permission symbol link and hard link

Linux related knowledge reference symbolic links and hard links
Pwd-p can view the real path. The explanation for figure 4-18 is as follows:

Although the path shown is getting longer, the real directory is still foo through pwd-p. sticky bits.

If an executable file has a sticky bit set, when the program is first executed, a copy of the body part of the program is left in the swap area when it terminates, which allows the next time the program is executed to load it into memory more quickly.
If you have a sticky bit set on a directory, you can delete or rename files in the directory only if you have write access to the directory and if one of the following conditions is true:
owning this file
owning this directory
Superuser
/tmp and/var/ TMP is a typical representation of the set of adhesive bits. Any user can create a file in both directories. Any user's permissions to both directories are usually read-write and executed. However, users cannot delete or rename files belonging to other people, and for this reason, an adhesive bit is set in the file mode of both directories.

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.