Linux Incomplete Manual (iii) _unix Linux

Source: Internet
Author: User
Tags manual documentation

Linux system directory Structure introduction

The Linux system has a directory organization structure of its specific file systems, and understanding these directory structures is fundamental to learning basic knowledge. Let me introduce the directory structure to Redhatlinux.
Directory Name
Brief introduction

/bin
This directory is the most important executable file in the system storage, these executables are most commonly used in Linux system commands, the general user and Superuser will often use their commands, such as: LS, su, mount and so on.

/etc
The system is the most important place to store the configuration files, general and system-related configuration files are placed in the directory, that is, the configuration of the system is mainly the directory to modify the files. Most of the text files are in this directory. , such as: Inittab, lilo.conf and so on.

/lost+found
The main problem is that when the system is defective, the place where the file is stored, under normal circumstances can not be ignored.

/root
The default home directory for Superuser Root, which does not have access to the directory for general users. General own files are tested to their own home directory below, so as not to disrupt the original system hierarchy.

/tmp
Same as DOS or Windows Temp directory, where temporary files are stored under this directory.

/boot
This is a redhatlinux-specific directory that stores kernel files and other information files when the system starts. Some distributions do not have this directory, but put these things in the root directory.

/home
This is the root directory of the system default normal user's home directory, which is the normal user's home directory set to:/home/[userid] directory.

/mnt
is the system to provide installation of additional file system when the installation directory, the main purpose is to not disrupt the original directory system structure, otherwise installed in where can be. As long as that directory is not used.

/sbin
As with/bin, it is primarily the place where executables are stored, except that the executable file is used primarily for superuser management of the system, and that ordinary users have little authority to execute the program. such as: MKE2FS, Ifconfig and so on.

/usr
This directory is the largest disk space in the Linux system directory, the directory has many applications, his subdirectory is also more complex, and there are many differences between the system, I will introduce it in the next table.

/dev
All the files under this directory are special files, and the Linux system regards all peripherals as a file, which means that your operation on the file representing the peripherals represents the operation of that peripheral. So it is very important to say/dev to the system. For example, if you want to format a floppy disk EXT2 file system, then do this: mke2fs/dev/fd0, the fd0 here represents the floppy disk drive.

/lib
The system's linked library file is stored, and the system does not function correctly without the directory. I have tried to rename the directory, the result of any command can not run, had to use floppy disk to start the machine and then install the file system to solve this problem, visible its importance.

/proc
The files in this directory are not actually stored on disk, the file system of the directory is called the proc file system and is the image of the system kernel. This means that the files inside the directory are stored in the system memory. You can look at these files to see how the system works. This directory does not move at will, the slightest careless may cause the system to lock dead.

/var
It is mainly the storage of some system record files, and also the configuration files of some system. Vary depending on the system.

/USR directory structure:


Directory Name
Brief introduction

/usr/x11r6
It is primarily a xwindows directory, and the following subdirectories have the same structure as the root directory.

/usr/games
All the games you choose to install are here.

/usr/src
is mainly the system kernel or other programs source program.

/usr/bin
Like/bin, it is a user-level executable file.

/usr/i486-linux-libc5
Try some of Linux's library files to compile executable files or links to program execution.

/usr/local
Is the level of the local directory structure, that is, later installed programs as far as possible to add themselves to the directory. The directory is also a structured directory, and its substructure uses and functions similar to the root directory.

/usr/tmp
The repository for temporary files that are not system-level.

/usr/include
This directory is the primary directory that holds the header files that are included in the compilation program.

/usr/man
This is the main repository for the online manuals in the system, which is the help documentation.

/usr/doc
Store some system documentation and some howto files.

/usr/sbin
Same as/sbin.

/usr/lib
The link library file at compile time.


Linux System Setup Chapter

To manage a system, in a sense to the system file settings occupy and its important position. Given the complexity of the Linux system, here I only make a simple introduction to those important files in the/etc directory.

Dir_colors:

This file specifies which terminals in the system can use color patterns, and defines the different color of different file types when listed. You can modify these settings yourself. or copy the file to the. Dir_colors under your home directory, and then modify the file yourself to use personal settings.

HOSTNAME:

This file records the host name and domain name of the local host, using the hostname. The format of the domain name, such as ttqq.tsinghua.edu.cn inside TTQQ is the host name, and tsinghua.edu.cn is the domain name.

BASHRC:

This file defines a configuration file that is automatically executed when you use bash as a shell, where you can place commands and alias settings that need to be run, such as:

ps1= "[\u@\h\w]\\$" (Define system prompt)
Alias which= "Type-path" (defines an alias that which command is Type-path)
Alias ls= "ls-color" (ls command that defines LS command as surrogate-color parameter)
Alias rm= "rm-f" (command that defines the RM command as the-f parameter)

CRONTAB:

This file defines the processes that the system performs automatically. The comparison of crontab points is divided into the automatic execution by hours, days, weeks and months.

CSH. CSHRC:

The file is a starting file when using CSH as a system shell, just as the BASHRC file is for bash.
FDPRM:

The file is a parameter file for the system configuration floppy disk drive, and the parameter list for the normal floppy drive is as follows:

# size sec/t hds trk stre gap rate SPEC1 Fmt_gap
360/360 720 9 2 0 0x2a 0x02 0xDF 0x50
1200/1200 2400 2 0 0x1b 0x00 0xDF 0x54
360/720 720 9 2 1 0x2a 0x02 0xDF 0x50
720/720 1440 9 2 0 0x2a 0x02 0xDF 0x50
720/1440 1440 9 2 0 0x2a 0x02 0xDF 0x50
360/1200 720 9 2 1 0x23 0x01 0xDF 0x50
720/1200 1440 9 2 0 0x23 0x01 0xDF 0x50
1440/1440 2880 2 0 0x1b 0x00 0xCF 0x6c

This includes probably the main floppy drive parameters, if you have a special floppy drive, then you can write his parameter settings in the format above.

FSTAB:

This file is more important and is the file system 備置 table file that is installed automatically on system startup. Here's an actual file, and then introduce the contents:

/DEV/HDA6/EXT2 Defaults 1 1
/DEV/HDA7 Swap Defaults 0 0
/dev/fd0/mnt/floppy supermount fs=vfat,dev=/dev/fd0 0 0
/dev/cdrom/mnt/cdrom supermount Fs=iso9660,dev=/dev/cdrom,ro 0 0
/DEV/HDA1/MNT/C VFAT Defaults 0 0
/dev/hda5/mnt/d VFAT Defaults 0 0
NONE/PROC proc Defaults 0 0

As you can see, each row consists of six items, each of which means:

1. Describe the device that you want to install the file system.
2. Describe the installed directory, which is the installation point.
3. Describe the file system on the installation device.
4. Describes how the installation is installed.
5. The flag bit that causes the dump program to be processed on the file system.
6. The flag bit when the FSCK program is started to check the file system.

Now I'm going to explain this file in the context of the above:

First line: The/DEV/HDA6 is first installed as the root file system, the file system type is ext2, and the default installation method is used.
Second line: will install/DEV/HDA7 as swap partition, use swap file system, parameter indicates is swap partition, use default installation method.
Third line: Install/dev/fd0 to/mnt/floppy, you can use any file system, the default installation method.
Line four: Install/dev/cdrom to/mnt/cdrom, you can use any file system, the default installation method.
Line five: Install the/dev/hda1 on the/mnt/c, using the FAT file system, installed by default.
Line six: Installs the/dev/hda5 on the/mnt/d, uses the FAT file system, the default installation.
Line seventh: Install the kernel image file system of the specified wording, installed to/proc, using the proc file system.

In this way, you can install the file system to your own needs.

Gettydefs:

This file contains the properties of the TTY device, which is the properties of a device such as a virtual console, such as speed. In this file you can also change the login default prompt, and so on.

HOSTS:

This file is a local network host address resolution file, equivalent to the Hosts.sam file under Windows. function is entered if it is a domain name or host name then first find this file for domain resolution, if the file has a corresponding IP address, then use, if the file does not correspond to IP, then visit our DNS server to find.

HOSTS. ALLOW:

Defines which hosts can access network resources, which are referred to by the host.

HOSTS. DENY:

The file is the opposite of the one above, which defines a host that prohibits access to network resources.

ISSUE:

The contents of this file are the contents that appear on the screen when you log on to the computer locally.
ISSUE. NET:

This file has the same meaning as the file above, except that the file is for those who log on through the web.

Lilo. CONF:

This is a more important document. He is used for the deployment of Lilo, and I'll give you a real file:

Boot =/dev/hda6(lilo program installed on/DEV/HDA6)
Timeout = 500(Start wait selection time)
Prompt
VGA = normal(monitor set to standard VGA)
Read-only
#Linux Bootable partition config begins(start Linux boot configuration block)
image=/boot/vmlinuz(kernel file is/boot/vmlinuz)
Root=/dev/hda6(linux root file system on/dev/hda6)
label=linux(The identifier selected at startup is Linux)
read-only(is installed as read-only for inspection)
#Linux Bootable partition config ends(end Linux boot configuration block)
other =/dev/hda1(non-Linux operating system, on/DEV/HDA1
Label = dos(start marked as DOS)

In fact, this file is very good configuration, so that in the future can be randomly added to the new operating system.

Profile:

This is the user's profile, the user's own directory has. Profile is configured according to this file, if not, then use this system to the user default configuration file.

Linux Answer Chapter

In fact, Linux is a very complex operating system, we will encounter a lot of problems in the use, and now I have some common problems to organize, I hope to help you some.

    1. Q: How do I use the floppy drive and optical drive under Linux?
    A: Many beginners have just finished installing Linux, and when they want to use floppy disks and optical drives, they don't know how to use them. Linux does not want DOS and Windows to display disks as a:, C:, and so on. Linux is an all-encompassing directory structure to represent the hardware and software resources of the computer, such as all the hardware of the computer in the "/dev/" directory, and "/" is the root directory of the computer, all the resources of the computer under "/". Like a floppy disk is "/dev/fd0", "fd0" This file represents a floppy disk. The hard disk is represented as "/dev/hda" (this assumes that there is only one hard drive), the partition on the hard disk is represented as "hda1", "Hda5" and so on, and the CD-ROM is "/dev/cdrom".
All right, we've got a simple idea of how Linux behaves with these devices, so let's solve the real problem here. Linux file systems are installed (mount), the system installed in the initial boot of the root file system, those special file system requires the user in the use of their own installation, this installation is under the root file system with a hanging decorate to connect our special equipment. The operation of the hanging decorations will be equal to the operation of this device. General hanging decorations are under the "/mnt", where the default is "/mnt/cdrom" This is the CD-ROM drive hanging decorate? Quot;/mnt/floppy "is the floppy drive hanging decorate, we can also build some hang decorate, in fact, is in"/mnt "under the establishment of a directory, If we can create a "dosc" hanging ornament for our C: disk. When we are sure that these things have been established, when we want to use the floppy drive, the optical drive, we can break into these commands to install: The installation of floppy disk "Mount/dev/fd0/mnt/floppy" installation CD-ROM "Mount/dev/cdrom/mnt/cdrom." Mount is the installation command, usually only into the Mount command we will see the installed file system.
    In fact, it is best to write the common file system into the Fstab file so that it can be used every time it is powered on. For example, to write the Windows partition, the specific way to refer to the system settings described above. In addition, for the optical drive, the floppy drive after the use can be entered into umount to uninstall, otherwise it will cause great damage to your file system.

2. Q: How do I reverse install lilo?
A: You can start with a Windows boot floppy disk and then run fdisk/mbr to rewrite the MBR to remove Lilo. You can also run Lilo-u/dev/had under Linux, where/dev/had is the installation location for your Lilo.

3. Q: How to quickly pull up history commands?
A: If you want to quickly pull up the history command, you can press up and down the cursor key, you will see the historical command used before.

4. Q: I want to use a command, but this command I only remember the first few, the back of the letter I forgot, how to do?
A: This is also available, as long as the first few letters into the command and then click the "tab" key, the system will automatically complement the command.

5. Q: How to quickly switch paths?
A: Type "CD-" to enter the last directory you entered. Type "CD ~" to return to your home directory.

6. How do I display a colorful list of directories and files?
A: Using Ls-color, you can see the colored directories and files. If you don't want to play every time, then edit/ETC/BASHRC this file, add a line inside: Alias ls= "Ls-color", so that's OK.

7. Ask: Find command Lookup file is very powerful, but I think it too troublesome, I just want to find a simple file, there is no quick way?
Answer: Yes. For example, if we want to find a file that starts with "s", then if we hit "s", we quickly press the TAB key and list all the files that start with S.

8. Q: How do I see the information that has been rolled over the screen?
A: You can use these two key combinations, very useful: "Shift+pageup" and "Shift+pagedown". The two of them can look at things on the screen and below.

9. Q: How to start a program immediately let it into the background?
A: In fact, as long as in the back of the program to hit a "&" on it. For example, we want to compile a program in the background, you can play: gcc mypro.c&.

10. Q: How can my programs continue to execute after I quit the system?
Answer: You can use the Nohup command. For example, we want to compile a very large program, then we can play: Nohup gcc mypro.c&. Note, however, that this command must be used in conjunction with "&". Then we can exit the system (logout).

11. Q: How to install new software?
A: If the software is not based on the RPM package, then it will be troublesome. Specifically to get the tgz file or tar file decompression, the specific way to see the above instructions. Then refer to the Readme file in the directory. In general, you run a program such as make, makefile to compile it, and then follow the prompts. Some software with install file, then "make install" to compile it. All in all, it's a lot of good to see the readme first.

Well, this incomplete Linux manual is finally complete. Believe it will help you a certain degree. In addition because of my level of relationship, mistakes are unavoidable, welcome everyone to teach, exchange. My email:119@cool.com.cn.

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.