linux ls in*,Wildcards when do ls in Linux

Wild card /ShorthandMeaningExamples

*Matches any string or group of characters.$ ls *will show all files

$ ls a*will show all files whose first name is starting with letter ‘a’

$ ls *.cwill show all files having extension .c

$ ls ut*.cwill show all files having extension .c but file name must begin with ‘ut’.

?Matches any single character.$ ls ?will show all files whose names are 1 character long

$ ls fo?will show all files whose names are 3 character long and file name begin with fo

[…]Matches any one of the enclosed characters$ ls [abc]*will show all files beginning with letters a,b,c

Note:

[..-..] A pair of characters separated by a minus sign denotes a range.

Example:

$ ls /bin/[a-c]*

Will show all files name beginning with letter a,b or c like

/bin/arch           /bin/awk           /bin/bsh     /bin/chmod           /bin/cp

/bin/ash           /bin/basename   /bin/cat      /bin/chown           /bin/cpio

/bin/ash.static   /bin/bash          /bin/chgrp   /bin/consolechars /bin/csh

But

$ ls /bin/[!a-o]

$ ls /bin/[^a-o]

If the first character following the [ is a !or a ^ ,then any character notenclosed is matched i.e. do not show us file name that beginning with a,b,c,e…o, like

/bin/ps            /bin/rvi              /bin/sleep /bin/touch      /bin/view

/bin/pwd           /bin/rview        /bin/sort   /bin/true        /bin/wcomp

/bin/red           /bin/sayHello     /bin/stty   /bin/umount   /bin/xconf

/bin/remadmin /bin/sed           /bin/su      /bin/uname     /bin/ypdomainname

/bin/rm            /bin/setserial    /bin/sync   /bin/userconf /bin/zcat

/bin/rmdir         /bin/sfxload      /bin/tar    /bin/usleep

/bin/rpm           /bin/sh            /bin/tcsh    /bin/vi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值