Linux Common Command Quick check

Source: Internet
Author: User

1. Recursively query a file containing a string in the specified folder (the file content fragment listed)

grep-r "string to find" file path

such as: Grep-r "HelloWorld". #在当前目录下递归查找 "HelloWorld" string

2. recursively find file names (list file names)

such as: Find. -name "*.log" #在当前目录中递归列出以log为扩展名的文件

3 . Viewing the number of operating system bits

Arch

4. String Simple intercept operation

such as: str= "Com.baidu.android.lulei"

  1. Get the tail of a string

${str##*.} Get "Lulei" (# #最大限度截取 *.)

${str#*.} Get "Baidu.android.lulei" (#最小限度截取 *.)

${str##*l} get "ei" (Maximum intercept *l)

 2. Get the header of a string

   ${str%%.*} get "com"(percent of maximum intercept *.)

    ${str%.*} get "com.baidu.android"(% minimum intercept *.)

    ${str%%.i*} get "com.ba"(maximum intercept *l)

  3. Specify location acquisition

    ${str:0:3} get "com" (3 characters from 1th bit)

${str:4} Get "Baidu.android.lulei" (starting from 5th intercept to end)

${STR:0-5} Get "Lulei" (Intercept from the bottom 5th to the end)

${str:0-5:5} Get "Lulei" (5 bits starting from the 5th digit)

Linux Common Command Quick check

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.