Bird's private cuisine--The 11th chapter: Understanding and Learning Bash

Source: Internet
Author: User

Tagged with: Linux wildcard character bash

A. Bash Shell's operating environment

1. Path and command lookup order

If we enter a command and have multiple commands with the same name under Linux, which command will be executed? Here are some rules for order execution.

1). Execute the command in a relative/absolute path, for example: "/bin/ls" or "./ls"

2). The command is found by alias to execute

3). Executed by Bash's built-in (bulitin) command;

4). Find the first command execution by $path The order of this variable.

If you want to understand the order in which a command is executed, you can query by Type-a ls


2. We can modify/etc/issue and/ETC/MOTD to set the display information when logging in to bash.


Wildcard characters can be used in 3.bash to assist us in processing data conveniently. Here's a summary of common wildcard characters

*: represents 0 to countless multiple arbitrary characters descriptor Example: ll-d/etc/con* Find the file name that begins with con under/etc/

?    : The representative must have an arbitrary character descriptor example: ll-d/etc/???? Find files with a file name of 5 characters under/etc/

[]: The representative must have a character within the brackets (not any character);

[-]: If a minus sign inside the brackets represents all the characters in the re-encoding order, for example [0-9] represents all numbers between 0 and 9.

[^]: denotes the original selection, [^a-z] stands for a character, as long as it is not a lowercase letter.


Bird's private cuisine--The 11th chapter: Understanding and Learning Bash

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.