One linux Command every day (24): Linux file type and extension

Source: Internet
Author: User
Tags touch command


One linux Command every day (24): Link to the Linux file type and extension: One linux Command every day (1): ls command running (2): cd command http://www.bkjia.com/ OS /201210/163050.html#a linuxcommand every day (3 ): pwd command Export (4): mkdir command http://www.bkjia.com/ OS /201210/1620.3.html#a linuxcommand every day (5): rm command Export (6): rmdir command http://www.bkjia.com/ OS /201210 /164017.html; one linux Command every day (7): mv command http://www.bkjia.com/ OS /201210/161097.html?linuxcommand every day (8): cp command serial (9): touch command serial (10): cat command serial (11 ): nl command http://www.bkjia.com/ OS /201211/165990.htmla linuxcommand every day (12): more command http://www.bkjia.com/ OS /201211/165994.htmla linu every day X command (13): less command running (14): head command running (15): tail command http://www.bkjia.com/ OS /201211/168702.htmla linuxcommand every day (16): which command running (17): whereis command running (18): locate command http://www.bkjia.com/ OS /201211/168895.htmla linuxcommand every day (19): fi Nd command overview examples (20): find command exechttp: // www.bkjia.com/ OS /201211/168901.htmllinuxlinuxcommand every day (21): find command xargshttp: // example (22 ): detailed description of the parameters of the find command http://www.bkjia.com/ OS /201211/168912.htmla linuxcommand every day (23): Linux directory structure contains. Similar to file.txt1_file.tar.gz created by a general application, although these files must be opened in different programs, most of them are normal files (also known as common files) that are measured in Linux file types ). Www.2cto.com I. File Types common Linux file types include: common files, directory files, character device files, block device files, symbolic link files, etc. Now let's give a brief description. 1. for a common file, we use ls-lh to view the properties of a file. We can see that there is a file like-rwxrwxrwx. It is worth noting that the first symbol is -, such a file is a common file in Linux. These files are generally created using related applications, such as tools, document tools, archiving tools... or cp tools. To delete such files, run the rm command. In addition, according to the content of the file, it can be divided into: 1>. plain text files (ASCII): This is the most common file type in Linux systems. It is called plain text files because the content is the data that we humans can directly read, such as numbers and letters. Almost all files that can be used as a set belong to this file type. For example, you can use the command: cat ~ /. Bashrc to view the content of the file. (Cat is the command to read the content of a file). 2>. binary: Linux only recognizes and can execute binary files ). In Linux, executable files (scripts, text-type batch files are not counted) are in this format. The command cat is a binary file. 3>. data Files: Some programs read certain files in specific formats during operation. These files can be called data files ). For example, when a user logs on to Linux, the login data is recorded in the/var/log/wtmp file, which is a data file, he can read it through the last command! But when cat is used, garbled characters are read ~ Is it a special format file? Www.2cto.com 2. When we run the directory file in a directory, we can see a file like drwxr-xr-x, which is a directory. The directory is a special file in Linux. Note that its first character is d. Run mkdir or cp to create a directory. cp can copy one directory to another. Delete the file by using the rm or rmdir command. 3. If the character device or block device file is in the/dev directory, list the file and you will see a file similar to the following: [root @ localhost ~] # Ls-al/dev/ttycrw-rw-1 root tty 5, 0 11-03/dev/tty [root @ localhost ~] # Ls-la/dev/sda1brw-r ----- 1 root disk 8, 1 11-03/dev/sda1 we see the/dev/tty property is crw-rw -, note that the first character is c, which indicates the character device file. For example, serial devices such as cats. We can see that the attribute of/dev/sda1 is brw-r -----. Note that the first character is B, which indicates a device, such as a hard disk or a optical drive. Files of this type are created using mknode and deleted using rm. Currently, in the latest Linux release, we generally do not need to create device files on our own. Because these files are associated with the kernel. Files related to the system perimeter and storage are usually stored under the/dev directory! There are two types of block devices: block devices, which store data to provide random system access interfaces. For example, hard disks and floppy disks are the same! You can randomly read and write data in different blocks of the hard disk. This device is a group of devices! You can check/dev/sda and the first attribute is [B]. Character (character) Device File: it is an interface device for some serial ports, such as the keyboard and mouse! These devices feature a one-time read and cannot be truncated. For example, you cannot let the mouse jump to another screen, but slide to another place! The first attribute is [c]. 4. Data interface file (sockets): Data interface file (or: Set interface file). This type of file is usually used for network data acceptance. We can start a program to listen to the requirements of the client, and the client can communicate data through this socket. The first attribute is [s], which is most often seen in the/var/run directory. For example, when we start the MySQL server, a mysql. sock file is generated. [Root @ localhost ~] # Ls-lh/var/lib/mysql. sock srwxrwxrwx 1 mysql 0 04-19 11: 12/var/lib/mysql. sock note that the first character of this file's attribute is s. 5. Symbolic Link file: When we view the file attributes, we will see lrwxrwxrwx. Note that the first character is l, and this type of file is a link file. Is a new file name through the ln-s source file name. The preceding example shows that setup. log is a soft link file of install. log. How can this problem be solved? This is similar to shortcuts in Windows. Example of creating a symbolic link file: [root @ localhost test] # ls-lh log2012.log-rw-r -- 1 root 296 K 11-13 06:03 log2012.log [root @ localhost test] # ln-s log2012.log linklog. log [root @ localhost test] # ls-lh *. loglrwxrwxrwx 1 root 11 11-22 linklog. log-> log2012.log-rw-r -- 1 root 296 K 11-13 log2012.log6. data transmission file (FIFO, pipe): FIFO is also a special file type, which aims to solve the problem of simultaneous access to a file by multiple programs. FIFO is the abbreviation of first-in-first-out. The first attribute is [p]. II. linux File Extension 1. basically, Linux files do not have the so-called extension. Whether a Linux file can be executed depends on the ten attributes in the first column, it has nothing to do with the file name. This concept is different from that of Windows! In Windows, the file extension that can be executed is usually. com. exe. bat and so on. In Linux, if you have x in your permissions, for example, [-rwx-r-xr-x] indicates that the file can be executed. However, the execution that can be executed is different from the execution that can be executed successfully ~ For example, the install. log file in the root directory is a plain text file. Can this file be successfully executed after the permission is changed to-rwxrwxrwx? Of course not ~ Because there is no executable data in its content. Therefore, this x indicates that the file can be executed, but whether it can be successfully executed depends on the content of the file. even so, we still want to know what the file is by using the extension. Therefore, we usually use an appropriate extension to indicate the type of the file. There are several common extensions :*. sh: script or batch processing file (scripts). Because the batch processing file is written in shell, the extension is compiled. sh * Z ,*. tar, * .tar.gz ,*. zip ,*. tgz: compressed file. This is because the compression software is gunzip, tar, and so on. Because of the different compression software, the related extension is used! *. Html, *. php: webpage-related files, which respectively represent the HTML syntax and PHP syntax. The. html file can be directly opened in a web browser. For the. php file, you can browse it on the server through the client browser to obtain the webpage result after calculation. Basically, the file name on the Linux system really only helps you understand the possible usage of the file. The actual execution or failure still requires the permission specification. For example, although a file is an executable file, such as the common command/bin/ls to display file attributes, if the permission of this file is changed to unexecutable, then ls becomes unexecutable. This problem occurs most often during file transfer. For example, you can download an executable file on the network, but it cannot be executed on your Linux system! Haha! This means that the attributes of the file may be changed. Do not doubt that the attributes and permissions of files uploaded from the network to your Linux system will indeed be changed. 2. linux File name length limit: in Linux, when the preset Ext2/Ext3 file system is used, the file name length limit is: A single file or directory can contain a maximum of 255 characters including the full path name and directory (/). The full file name is a long file name! We hope that the Linux File name can be viewed at a glance, so the file name is usually very long. 3. restrictions on Characters in Linux File Names: Due to the command operation relationships in Linux under the text interface, it is recommended that you avoid special characters when setting file names under Linux! For example, the following :*?> <;&! [] | \ '"' () {} Because these symbols have special meanings under the text interface. In addition, when the file name starts with the decimal point ".", it indicates that this file is a hidden file! At the same time, because the options such as-option are often used in command issuing, it is recommended that you also avoid naming the beginning of the file name with "-" or "+.

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.