A summary of recent Linux learning

Source: Internet
Author: User

Problems encountered with Linux system installation
    • Time zone issues

      In the time to select the time zone, the following is the use of the UTC clock This do not choose, after the tick time is actually calculated at GMT, we are now in the East 8 district, so the time will be 8 hours after the hook

    • Hard disk partitioning issues

      The Linux partition specification has a swap partition that should be twice times the memory, of course, if the memory is particularly large, it is not necessary to follow this specification

Basic Linux Operations
    • Terminal type
      1. Device Terminal
      2. Physical terminal
      3. Virtual Terminal
      4. Pseudo Terminal
      5. Serial terminal
      6. Graphics terminal
    • Comparison of the Who whoami w command
      # who

      # whoami

      # w

    • The difference between \ R and \ n

      In terms of terminology, \ R is called a carriage return \ nto a newline.

      • \ r: Move the cursor to the beginning of the line so that the output will overwrite the previous content, such as the following example
        #echo-E "Abc\rd"
        The display on the screen is DBC, the output of ABC output \r,\r the cursor to the beginning of the line to continue the output then output D will cover a
      • \ n: line break, move the cursor to the beginning of the next line to continue the output
        Wrapping on a Unix-like system only requires \ n, and a line break on Windows must use \ r \ n, which is why we see code written on a Unix-like system to get a messy format when it's opened with Notepad on Windows. Of course, sometimes the text written in Notepad gets ^m on a Unix-like system, after each line.
File Management Related

The organization of directories in Linux is a single inverted tree structure, which is sensitive in the case of Linux file systems such as EXT4.

  • FHS file Layering standard

    Linux has a FHS (Filesystem Hierarchy Standard) file system hierarchy defined by an LSB (Linux standards Base) organization, which primarily defines the Linux system files, Where tools and programs are stored and the hierarchy of directories in the system
    In fact FHS also greatly promoted the emergence of LSB organization, FHS is the first standard of the LSB organization definition
    The standard actually defines what directories are in the root directory of a Linux system, the colors of various file types, and, of course, the entire standard document that can be downloaded to its official website.

  • File name wildcard character

    *: matches any of any characters
    ?: matches a single arbitrary character
    ~: Current User home Directory
    ~user_name: A user's home directory
    ~+: Current Working directory
    ~-: Indicates the directory you just left,-only available on CD

  • How
  • files are stored on your hard disk:

    First, each file on each partition has a corresponding inode number, which can be used in the Inode Table found in the corresponding metadata of the file, metadata is actually the property information of the file, such as owner, permissions, modification date, and of course, the most important thing is to point to the file data pointer, if the file is small enough to point to the data location of the file, If the larger will point to the location of the file block where the information, of course, if the block location of the area is full still can not hold all the block location information, then this space is still stored in the block location information. The data region of the
    directory holds the corresponding information for the file name and inode in that directory, and each file is assigned an inode that is unique within that partition, so the principle of soft links and hard links is clear:
    Hard links actually create a file name in a directory with the same data as the inode number of the original file, so that their property information is the same, of course, it seems to delete the file when the file will be judged by the number of hard link links, If this file is deleted after the hard link becomes 0, then the corresponding data area block is marked to be able to overwrite the state, of course, after creating a directory, the number of hard links is 2 because the directory itself is a hard link in the other directory has a '. ' Directory after creating a new directory in the created directory, the hard link of the directory will also add 1 because of the ".." In this newly created directory. In fact point to the directory,
    Note: above this paragraph is a personal help to understand the memory written down, the main idea should be no problem, and occasionally some detail may not express the special accuracy

  • the difference between a soft link and a hard link :

    • Soft Links:
      • Deleting the original file link file will be affected
      • The soft link file itself has its own property information
      • The soft-linked data area on the disk is the path to the file that you want to point to
      • Soft links can be created across partitions
      • Soft links can point to directories or files
      • Creating a soft link does not increase the number of links to the file
      • The file type of the soft link is the linked file
      • Different inode numbers for soft links
      • The relative path of the soft link source file is relative to the directory where the linked file resides.
    • Hard Links:
      • Deleting the original file link file will not be affected
      • All property information for hard links that directly or indirectly point to the original file is the same
      • Hard-linked data areas on disk are the file contents themselves
      • Hard links cannot be created across partitions
      • Hard links can only point to files
      • Creating a hard link increases the number of links to the file
      • Hard-linked file type or normal file
      • The inode number of the hard link is the same
      • Hard link Original file or relative to yourself
  • REDIRECT Related

    If there are multiple redirects then the system will perform the last redirect before the first one, then reverse execution, and normally a standard output once, the output once there is no data, the second is also required to output the words can only be empty

Example:

# cmd > log 2>&1
The error output is redirected to the standard output and then the standard output is redirected to the log file, so the screen is not displayed and the error content is in the file
# cmd 2>&1 >log
Enter the correct content into the log file first and then output the error output to the standard output with no content in the standard output
# cmd &>log
Output all the content to log, the log should have only the error message
# cmd 2>log >&2
REDIRECT the standard output to the error output and output the error output to the log file as an error message in the log file.

A summary of recent Linux learning

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.