Shell script learning-10 (TR, uname, chkconfig command learning)

Source: Internet
Author: User
Tags printable characters

 

The TR command reads data from the standard input device and returns the data to the standard output device after string translation.

Cat filename | tr u n: used to replace the U in the filename file with N on the screen, but not in the actual file.

Cat filename | tr-d abc deletes and displays all the characters A, B, and C in the filename content on the screen.

Cat filename | tr [: lower:] [: Upper:] converts all lowercase letters in the file content to uppercase letters.

The replacement symbols similar to [: lower:] are as follows:

[: Alnum:] indicates all letters and numbers.

[: Alpha:] indicates all letters

[: Blank:] indicates all spaces

[: Digit:] indicates all numbers

[: Graph:] indicates all printable characters, excluding spaces.

[: Print:] indicates all printable characters, including Spaces

 

 

  • Uname-a print all system information

  • Uname-S print kernel name

  • Uname-N print network node Host Name

  • Uname-R: Print kernel Mail version number

  • Uname-help for help

  • You can also view the system version by using the following methods:

    • CAT/proc/version

    • CAT/etc/RedHat-release

    • CAT/etc/issue

 

Chkconfig is frequently used in command line operations. It allows you to conveniently set the services started at the running level of each system. You can easily manage your startup services.

  • To list the startup status of all services in the system:

    # Chkconfig-list

  • To list the mysqld service settings:

    # Chkconfig-list mysqld

  • Set mysqld to be used for startup at levels 3 and 5:

    # Chkconfig-level 35 mysqld on

    -Level 35 indicates that the operation is only executed at levels 3 and 5.

    On indicates start, off indicates close

  • Set mysqld to on:

    # Chkconfig mysqld on

    "Each level" includes 2, 3, 4, and 5 levels

    Level 0: Shutdown

    Level 1: Single User Mode

    Level 2: multi-user command line mode without network connection

    Level 3: multi-user command line mode with network connection

    Level 4: unavailable

    Level 5: multi-user mode with graphic interface

    Level 6: restart

  • How to add a service:

    First, the Service script must be stored in the/etc/INI. d/directory;

    Second, you need to use chkconfig-add servicename to add this service to the chkconfig tool service list. In this case, the service will be stored in/etc/rc. d/rcN. d.

    Finally, you can modify the default startup level of the service as instructed above.

  • Delete A service:

    # Chkconfig-del servicename

 

Related Article

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.