Learn Linux logs.

Source: Internet
Author: User

1, the path of the query command with which; for example Which-ls


2, query the current working directory using PWR (print working directory);


3, query the current environment variable printenv (print environment);

You can see the current host name, terminal type, path, and path using the environment variable. A bunch of paths separated by colons


4, random input a Linux command if the output is too long (such as Ls-la/dev) can use the Shift+pgup or SHIFT+PGDN key combination to view the command output;


5. Path under Linux:

$PATH: Determines to which directories the shell will look for commands or programs

Edit your PATH declaration in the following format:

Path= $PATH: <path 1>:<path 2>:<path 3>:------: <path n>

Add yourself to the specified path, separated by a colon. When the environment variable is changed, it takes effect the next time the user logs on, and if you want to take effect immediately, you can execute the following statement: $ source. bash_profile

It is important to note that it is best not to put the current path "./" in path, which may be subject to unexpected attacks. When you are finished, you can view the current search path through the echo $PATH. With this customization, you can avoid frequent launches of programs that are outside the path of the shell search.


6, Filesystem Hierarchy Standard (file system directory standards) abbreviation, most Linux version of this file organization, similar to the Windows operating system in the C-disk file directory, FHS tree structure to organize files. FHS defines the purpose of each region in the system, the minimum required composition of files and directories, and also gives the exception handling and contradictory processing.



FHS defines the two layer specification, the first layer is,/below the directory should be put what file data, such as/etc should be placed in the settings file,/bin and/sbin should be placed executable files and so on. Because There are so many developers of Linux, if everyone uses their own directory configuration method, it can lead to a lot of management problems. Can you imagine that after you entered a business, the Linux directory configuration method that you came into contact with was completely different from what you learned before? It's hard to imagine. So, later on there is the so-called file system hierarchy Standard (Filesystem Hierarchy STANDARD,FHS) introduced.

The second tier is defined for sub-directories of the/USR and/var directories. For example,/var/log places system login files,/usr/share places shared data, and so on.


Since FHS is only the file data that defines the contents of the top (/) and sub-tiers (/usr,/var) should be placed, it can be configured with the developer at the other subdirectory level. For example, FC4 's network setup data is placed in the/etc/sysconfig/network-script/directory, but SuSE Server 9 places the network under the/etc/sysconfig/network/directory, and the directory name is different.

In addition, in Linux, all files and directories are started by the root directory. That is the source of all directories and files. Then one more branch down, a bit like a tree. Therefore, we also call this directory configuration as: "Directory Tree". The main features of this directory tree are:

The starting point of the directory tree is the root directory (/, root).

each directory can not only use the file system of the local partition, but also the file system on the network. For example, you can use a network file system (SYSTEM,NFS) server to load a specific directory, and so on.

Each file name (including the full path) in this directory tree is unique.

in addition, depending on how the file name is written, you canPath(path) is defined asAbsolute Path(absolute) andrelative Path(relative). Absolute Pathis: The file name or directory name, such as/HOME/DMTSAI/.BASHRC, that is started by the root directory (/);relative Pathto the file name relative to the current path. For example./home/dmtsai or. /.. /home/dmtsai/and so on. Anyway, the beginning is not/belongs torelative Paththe wording. Have to understand thatrelative Pathis expressed as the relative position of the current path. For example, in the/home directory, if you want to enter the/var/log directory, how to write it?

Cd/var/log (absolute)

Cd.. /var/log (relative)

Because in/home, so go back to the previous layer (.. /) Before you can continue moving to/var.

Pay particular attention to these two special directories:

.: Indicates current directory , or you can use./to indicate.

.. : Represents the previous level of the directory, or you can ... /to indicate.

. With.. The catalog concept is important and you will often see CDs. Or./command, which means the status of the previous layer and the current directory. In addition, the character limit size for file name and full file name (file name written by/start) is:

The maximum allowable file name for a single file or directory is 255 characters. The full file name containing the full path name and directory (/) is 4,096 characters long.

We know that there is a file named message under/var/log/, and the maximum file name for this message file can be up to 255 characters. The two upper-level directories, VAR and log, can be up to 255 characters long, respectively. In general, however, the full file name of/var/log/messages can be up to 4,096 characters long.

tip: Root has a lot of meaning in Linux. If from the "account" point of view, Root refers to " system Administrator " identity, if the "directory" point of view, root refers to the root directory, is/. Pay special attention to it.



Learn Linux logs.

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.