Linux File System
Certificate --------------------------------------------------------------------------------------------------------------------------------------------------------
To access a disk file, you must use a system call to return an ID associated with the file,
This ID is the file descriptor.
The linux operating system provides an open system call. Any process must access a file.
File. The system returns a number and the file descriptor associated with the file.
(1) The user program submitted an opening application from the user space to the kernel.
(2) the operating system checks whether the request is valid in the kernel. If the request is valid and the file associated information (read/write location, in the disk location) is opened in the kernel, all stored in struct file) and added to the current process's PCB open file list array, corresponding to this array of small labels and file descriptors
(3) return the file descriptor to the non-user space. The user space then reads and writes the file through this number value.
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------
By default, three files are opened for each process:
Printf/scanf:
File descriptor value 0 (standard input, keyboard)
1 (standard output, display)
2 (standard error output, display)
Corresponding macro
STDIN_FILENO
STDOUT_FILENO
STDERR_FILENO
How to view the file size in linux
Use the ls-lht command to display all files in the current directory. One column shows the file size.
To view the size of a folder, you can use du-sh *
What is * behind a linux file?
You should use the F option of the ls command to view the image. * indicates that the file is an executable file.
Supplement: run the which ll command to see what the Kana of ll is.