A random talk on Unix file system

Source: Internet
Author: User

Files on UNIX computers are organized in a hierarchical structure. The highest level of this hierarchy is/, generally referred to as "Slash" or "root directory."

If you change the working directory to/, and run LS, you will see several subdirectories (such as etc, Bin, Var, home, and TMP) with mysterious names. Although Unix now supports long filenames, most of these top-level directory names can be traced back to about 30 years ago, when Unix was just emerging. Similarly, each directory contained in/is used for a particular purpose according to the same long-standing convention:

/bin is just one of many directories that contain applications and utilities. However,/bin typically contains utilities that are basic to system operations. Therefore, Shell file manipulation commands such as CP and chmod, compression and decompression, and diagnostics commands are located in/bin.

/sbin also contains utilities that are critical to system operation and maintenance. However, only Superuser can execute programs in/sbin, so this directory is called "Superuser-bin" or/sbin.

/dev contains all the hardware that is installed on your system, including terminals and USB devices (and other peripherals that are physically attached to this computer), pseudo terminals (for interacting with the X terminal window), and hard drives, and so on.

/etc (often pronounced "etsee") is dedicated to system configuration. The/etc directory contains configuration files for system daemons, startup scripts, system parameters, and more.

/home contains the user's home directory. For example, if your sign-in name is Joe, then the directory/home/joe is your personal file repository.

/lib is used to store basic system library files. In modern UNIX, it is common to share system libraries, which means that not every binary file is linked to and included in these libraries (in that case, at least it will waste space), but when the library is needed, it is loaded as needed and can be shared by many applications at the same time. As a result, the core applications and utilities installed with UNIX require the use of libraries in/lib, and you need at least a handful of corresponding library files to create new executables from source code. All of these files are critical, and a file that is corrupted or deleted (whether intentional or unintentional) may make the system unusable.

/MNT is the abbreviation for Mount, which is a standard location for mounting hard drive partitions and other devices. If you want to see all the devices that are currently mounted and accessible, you only need to run the Mount command.

/tmp or "temporary", is a system-wide staging storage area. Your WEB server may save session data files here, and other utilities will use space in/TMP to cache intermediate results. It is generally assumed that files in/tmp are discarded after use. In fact, your system administrator may delete all files that are older than an expiration date every night.

/usr is used to store a large number of files. End-user applications (from editors, games and interfaces, to system features) are located in them, and it is the repository of man pages and other more content. Some files are valuable, but they are not necessary for system operation, and you will most likely find it in/usr.

/var is a shorthand for "variable", which is a repository for storing files that are typically larger in size over time. mailboxes, log files, printer queues, and databases can be found in/var. You can usually save your Web site in/var, because the Web site can accumulate a large amount of data abnormally over time.

These are some of the most common directory names, although there are subtle differences between some UNIX versions. (for example, on freebsd® Mac OS X, the directory that contains the user's home directory is named/users, not/home.) )

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.