Using wildcard characters in the LS command

Source: Internet
Author: User

Wildcards are relatively simple. We already know that wildcards are often used to match filenames in the shell terminal, so take a look at the example of using wildcards in the LS command today.

Usage: LS [option] ... [File] ...

LS itself has a lot of options, we do not look at the option today, but instead look at its parameters section.

Now we have a total of 8 files in the current directory $ls1. C1.CPP  1. h3. C3.CPP  3. h a.out Readme list all files $ls*1. C1.CPP  1. h3. C3.CPP  3The . h a.out Readme lists 1 files that begin with a 1-character extension (this is considered to have a full name in the filename. That is, there is an extension) $ls 1.?1. C1. h lists files beginning with 1 and the extension is at least 1 characters in $ls 1.? *1. C1.CPP  1. h list all files with an H extensionls*. h1. h3. h list all files with extension $ls*.*1. C1.CPP  1. h3. C3.CPP  3. h a.out Lists the file name is 1-3 of 1 characters, and the file name extension is H $ls[1-3].h1. h3. h lists all files that have an extension, and the first letter of the extension is not C $ls*. [^c]*1. h3. h a.out Lists the file name is 1-3 of 1 characters, and the file name extension is C or H $ls[1-3]. [CH]1. C1. h3. C3. h lists the extension before it is a single character, and the first character of the extension part is the C file $ls?. c*1. C1.CPP  3. C3.CPPHow do I list a file without an extension? I need to use grep (if you have another way, welcome to reply) $ls|grep-V"\."Readme

Original articles, copyright, reproduced please indicate the source.

Using wildcard characters in the LS command

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.