Linux:linux Common Command Explanation

Source: Internet
Author: User

First, Linux common commands
    • All command operations are performed on the server:
1) Classification
    1. software Operation command : Software installation, uninstall;
    2. server hardware Resources and disk operations : There are several CPUs, how much memory;
    3. File and folder Operations Command : New, delete, read and write operations;
    4. System User Action commands : Add users to the system, etc. (root is one of the users added)
    5. firewall-Related settings : The firewall is turned on by default, after opening will cause great trouble, need to set;
    6. Power-up operation (sudo) and file transfer operations : the use of the account after the removal of the rights required to use sudo, the local Windows server on the file upload to other server operations;

2) Software Operation command
    • Yum: Package Manager
    1. install software :yum install xxx
    2. Uninstall software :yum remove xxx
    3. search Software :yum search xxx
    4. Cleanup Cache :yum Clean Packages
    5. List installed :Yum list
    6. Package Information :yum info xxx

3) Server hardware resources and disk operations
    • View memory usage:free-m, ("-M": Representation in megabytes)
    1. total: Memory 992 m
    2. used: used 108 m
    3. Free: remaining 640 m

    • View hard disk usage:df-h, ("-H": Presentation in visual form)
    1. Filesystem: Represents all file systems under the disk of the server;
    2. Size: The total amount of disk space allocated by the server to each file system;
    3. used: Each file system has used its own disk space size;
    4. Avail: The amount of disk space remaining on each file system;
    5. use%: The use of the disk space of each file system LV;
    6. mounted: Each file system corresponds to the root directory, that is, the physical address to store them;

    • Viewing the overall system load:w/top, (returns a specific value)
    • After using the top command, press the Q key to exit;
    • load Average: The average load value, in the Operation dimension represents the server health indicators;
    1. When load average = 1, the CPU is already full load carrying, the machine is more dangerous and needs processing;
    2. When load average > 1, indicates that the CPU has been overclocked running;
    3. Operations, the general "threshold" is set to 0.6 or 0.7, when the load average > 0.6/0.7, CPU Utilization into the dangerous "alarm threshold";
    4. Set 0.6 or 0.7 as "threshold", 0.4 or 0.3 of the CPU space is reserved for early prevention and rescue;
    1. load average: Average load;
    2. 0.00: Average CPU load for the last 1 minutes;
    3. 0.01: Average CPU load for the last 5 minutes;
    4. 0.05: Average CPU load for the last 15 minutes

    • Number of CPUs and cores :cat/proc/cpuinfo

    • disk formatting :fdisk

Second, the file Operation command
    • Linux system, all things are files, no format;
    • ls: displays all files in the current directory;
    • Ls-al (or "ll"): Displays all the files in the current directory as a list;
    • CD + path: Enter the directory, (you can enter the specified directory from any directory)
1) directory Structure of Linux files
    • /: root directory;
      Go to root directory:CD/
    • home directory; (storing a lot of user information, such as root)
    • / tmp: Temp directory, (will be cleaned periodically, saved files are not stored in this directory)
    • / etc: Configuration directory; (store config file: yum, SSH, etc.)
    • / usr: User program directory; (store user program)

2) file Basic Operation command
    • "./+ XX" : Indicates the current directory;
    • Command + XX: Also indicated under current directory;
    • Command + path/xx: Indicates the file or folder under the specified path;
    • All operation commands of the file ( except PWD), you can manipulate files or folders under any directory, as long as the path is specified;

    • ls: View the files in the directory
    1. ls: View the files in the current directory;
    2. ls + path: View the file under the specified path;

    • Touch: Create a new file;
    1. touch xx, touch./xx: New file under current directory;
    2. Touch path/xx: Creates a new file under the specified path;

    • mkdir: Create a new Folder;
    1. mkdir xx, mkdir./xx: Create a new folder under the current directory;
    2. mkdir path/xx: Create a new folder under the specified directory;
    3. mkdir-p path/xx1/xx2/xx3: Create a new multi-layer folder under the specified directory;
    • CD Path: Enter the specified directory;

    • RM xx: Delete a file or folder under a directory
    1. rm xx, rm./xx: Delete files from the current directory;
    2. RM path/xx: Delete the first file/folder in the specified directory;
    3. rm-r xx: Delete the folder under the current directory and all the files/folders underneath it; (ask for selection when deleting)
    4. rm-rf xx: Force delete the folder in the current directory and all the files/folders under it at once; (not asked when deleted)
    5. rm-r path/xx, rm-rf path/xx: Delete multi-level folders under the specified directory;

    • cp: Copy files from the specified directory to another specified directory
    1. CP xx Path, CP./XX path: The xx file under the current directory is copied to the specified path directory;
    2. CP xx path/xx_1, CP./XX path/xx_1: The xx file under the current directory is copied to the specified path directory, and the file name is changed to Xx_1;
    3. CP path1/xx path2: Copy the xx file under the path1 directory to the path2 directory;
    4. CP path1/xx path2/xx_1: Copy the xx file under the path_1 directory to the path_2 directory, and change the file name to Xx_1;

    • mv: moving files or folders
    1. mv xx Path, mv./XX path: Moves the xx file in the current directory to the path directory;
    2. mv xx path/xx_1, mv./xx path/xx_1: Move the xx file under the current directory to the path directory and rename it to Xx_1;
    3. mv Path1/xx path2: Move directory path1 file xx to path2 directory;
    4. mv Path1/xx path/xx_1: Move directory path1 under the file xx to path2 directory, and renamed to Xx_1;

    • pwd: Displays the path to the current directory

3) Text Editor Vim

4) file Permissions 421

    • Maximum permissions: 7/7/7 (because 4 + 2 + 1 = 7)

5) file Search, find, read

6) file compression and decompression

Linux:linux Common Command Explanation

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.