Seven file types, file attributes and viewing methods in Linux, and seven file types in linux

Source: Internet
Author: User

Seven file types, file attributes and viewing methods in Linux, and seven file types in linux
1. Seven file types

Common file type
The most common file types in Linux include plain text files (ASCII), binary files (binary), data files (data), and various compressed files. the first attribute is [-].
Directory files
Is the Directory, which can be entered using the # cd command. The first attribute is [d], for example, [drwxrwxrwx]
Block Device Files
Block Device File: it is an interface device that stores data for system access. In short, it is a hard disk. For example, the Code of Hard Disk 1 is/dev/hda1 and other files. The first attribute is [B].
Character Device
Character Device File: The interface device of the serial port, such as the keyboard and mouse. The first attribute is [c].
Socket File
This type of file is usually used for network data connection. You can start a program to listen to the requirements of the client, and the client can communicate with each other through a socket. The first attribute is [s], which is most often seen in the/var/run directory.
MPs queue File
FIFO is also a special file type. Its main purpose is to solve errors caused by simultaneous access to a file by multiple programs. FIFO is the abbreviation of first-in-first-out. The first attribute is [p].
Link file
Similar to shortcuts in Windows. The first attribute is [l], for example, [lrwxrwxrwx]

2. Three Methods for viewing file types


Ls-l/ls-ld or ll [ls-l-View File ls-ld-view path ll -- same as ls-l]

Ll anaconda-ks.cfg // see the first character-rw -------. 1 root 2460 June 1 23:37 anaconda-ks.cfg [root @ localhost log] # ls-ld/etc drwxr-xr-x. 81 root 4096 Jan 29/etc


File command

[root@localhost data]# file a.txt a.txt: ASCII text


Stat command

[Root @ localhost data] # stat a.txt // view detailed File attributes (including File time attributes) File: 'a.txt 'Size: 3 Blocks: 8 IO Block: 4096 regular fileDevice: 803 h/2051d Inode: 544365 Links: 1 Access: (0644/-rw-r --) Uid: (0/root) Gid: (0/root) Access: 20:56:01. 965885036 + 0800 Modify: 20:55:27. 181876154 + 0800 Change: 20:55:27. 181876154 + 0800
3. File Extension in Linux

In windows, file types are differentiated by the extension. There is no relationship between the file extension and the file type in linux. But in order to easily distinguish and be compatible with the user's usage habits of windows, we still use the extension to represent the file type. Example:
● The Source Code .tar).tar.gz).tgz).zippai.tar. bz indicates the compressed file. The creation command is tar, gzip, zip, and so on.
●. Sh indicates a shell script file, a program developed in shell language.
●. Pl indicates a perl language file, a program developed using the perl language.
●. Py indicates a python file, which is a program developed using the python language.
● .Html#.htm,. php,. jsp, And. do indicate web page language files.
●. Conf indicates the configuration file of the system service.
●. Rpm indicates the rpm installation package file.

4. File Attributes
[root@localhost /]# ls -lhitotal 90K    12 dr-xr-xr-x.  2 root root 4.0K Jan 28 18:30 bin     2 dr-xr-xr-x.  5 root root 1.0K Aug  7  2016 boot     4 drwxr-xr-x. 18 root root 3.7K Jan 29 01:29 dev652802 drwxr-xr-x. 81 root root 4.0K Jan 29 03:25 etc130563 drwxr-xr-x.  3 root root 4.0K Jan 29 00:57 home    13 dr-xr-xr-x. 12 root root 4.0K Jan 28 18:30 lib391685 dr-xr-xr-x.  9 root root  12K Jan 28 18:30 lib64    11 drwx------.  2 root root  16K Aug  7  2016 lost+found130564 drwxr-xr-x.  2 root root 4.0K Sep 23  2011 media391689 drwxr-xr-x.  2 root root 4.0K Sep 23  2011 mnt130565 drwxr-xr-x.  3 root root 4.0K Aug  7  2016 opt     1 dr-xr-xr-x. 97 root root    0 Jan 29  2018 proc391682 dr-xr-x---.  2 root root 4.0K Jan 28 21:08 root130566 dr-xr-xr-x.  2 root root  12K Jan 28 18:30 sbin     1 drwxr-xr-x.  7 root root    0 Jan 29  2018 selinux    15 drwxr-xr-x.  2 root root 4.0K Sep 23  2011 srv     1 drwxr-xr-x. 13 root root    0 Jan 29  2018 sys522242 drwxrwxrwt.  5 root root 4.0K Jan 29 05:15 tmp522244 drwxr-xr-x. 14 root root 4.0K Jan 28 20:04 usr261121 drwxr-xr-x. 20 root root 4.0K Aug  7  2016 var

544365-rw-r-. 1 root 3 Jan 28 20:55 a.txt

Inode index node number544365
File Type <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Examples + zsS8/examples/ybbBoaK/ydC0oaK/examples + examples/JtsG/yda00NCjrMbky/vTw7unv8m2wb/examples + w7vT0Mbky/examples + examples/ expires + uPZyb290PGJyIC8 + expires/NDCo6iw/MCozsS8/rS0vaihosTayN24/NDCoaLOxLz + w/u4/expires/J08PI58/Cw/expires + expires "brush: SQL; "> [root @ localhost data] # stat a.txt File: 'a.txt 'Size: 3 Blocks: 8 IO Block: 4096 regular fileDevice: 803 h/2051d Inode: 544365 Links: 1 Access: (0644/-rw-r --) Uid: (0/root) Gid: (0/root) Access: 20:56:01. 965885036 + 0800 ---------- access time Modify: 20:55:27. 181876154 + 0800 ---------- modification time Change: 20:55:27. 181876154 + 0800 ---------- Creation Time

Index node inode
Hard Disk partitioning, formatting, and creating file systems
The formatted disk is divided into two parts:The first part is Inode. The second part is block.
BlockIt is used to store actual data, such as photos, videos, and other common file data.
InodeIs used to store the properties of the data (that is, the result of ls-l)
Inode includes the file size, owner, owner user group, read/write permission, price type, and modification time, there is also a function to point to the object pointer (inode node-block ing), but only does not contain the file name

Access a file [locate inode --> block by file name]

View inode size

[root@localhost ~]# dumpe2fs /dev/sda1|grep -i "Inode size" dumpe2fs 1.41.12 (17-May-2010)Inode size:               128

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.