UNIX advanced programming files and directories

Source: Internet
Author: User


Files and directories

Realize
Ls-l

1.
Stat ();
Fstat ();
Lstat ();

2. Type of file (St_mode)
dbcpls-
D: Catalogue
B: Block device
C: Character device
P: Piping
L: Symbolic Link
S: Socket
-: Normal file

3. Permissions for files (st_mode)
Rwx
U+s:u must have x permissions, plus s permissions, so that the user who executes this file temporarily has file owner permissions
G+s:
O+t: If a directory has T permissions, it can ensure that other users can create files for this directory, but can only delete/modify their own files

4. Number of hard links to files (St_nlink)
Hard Links:
Create a hard-link file for any one file, equivalent to adding a record entry
The same inode, corresponding to two names.
Symbolic Links:
Create a symbolic link file for any file, the path of the source file is stored in the symbolic link file, and there is a separate inode

5. Owner and group of files (St_uid, St_gid)

6. Size of the file
Number of bytes in the file (st_size)
Not equal to the size of the disk space occupied
Disk minimum unit is sector (512B) (st_blocks)
File System minimum Unit is block (General 4K)

7. Time of the file
Access Time-----Last visited
Modify time-----Last modified content (LS-L)
Change time-----Last modification of the attribute information (inode)

8. Read the Catalogue
Opendir (3);
Readdir (3);
Closedir (3);


Glob (3);

9. Understand
mkdir (2);
RmDir (2);

Remove (3);//unlink (2)/rmdir (2);
Rename (2);

Chown (2);
Fchown (2);
Lchown (2);

Umask (2);
chmod (2);
Fchmod (2);

Link (2);
Unlink (2);

System data files and information

1./etc/passwd
Mans 5 passwd

Getpwuid (3);
Getpwnam (3);

2./etc/group
Mans 5 Group

Getgrgid (3);
Getgrnam (3);

3./etc/shadow
Mans 5 Shadow

Getspnam (3);
Crypt (3);
Getpass (3);

4. Time Routines
Time (2);//timestamp
Gmtime (3);
LocalTime (3);
Strftime (3);
Mktime (3);

CTime (3);

UNIX advanced programming files and 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.