Wildcard patterns or glob patterns are patterns to select a collection of file names or other strings.
Questions tagged [wildcards]
56 questions
40
votes
4 answers
How should I glob for all hidden files except . and ..?
I want to carry out some action (say chown) on all the hidden files in a directory.
I know that this .* is not a good idea because it will also find the current . and parent .. directories (I know that rm will fail to operate on . and .. but other…
Zanna
- 72,312
24
votes
2 answers
Regular expressions VS Filename globbing
I know that Regular expressions are to be used only with characters and strings, but sometimes I find them in the names of files. My question is: are regexes only used with characters or also with filenames?
Hamza
- 387
21
votes
2 answers
Can anyone explain why sudo ls with a wildcard doesn't work?
$ sudo -iu abc ls -ltr /sites/servers/server_instance/logs/access*
ls: cannot access /sites/servers/server_instance/logs/access*: No such file or directory
$ sudo -iu abc ls -ltr /sites/servers/server_instance/logs/
total 594812
-rwxrwxrwx 1 abc…
Faisal
- 321
17
votes
4 answers
Citrix receiver 13.10 on Ubuntu 18.04.1
I am trying to get Citrix receiver to work on my Ubuntu laptop. I've installed the Citrix receiver, however when I try to open the .ica file that my company provides when I login to my organisation's Citrix StoreFront site by Chrome, it exits out…
Reza
- 331
14
votes
4 answers
How to pass '*' wildcard to path parameter of find command via a variable in script?
I want to use find to find files in a set of folders restricted by wildcards, but where there are spaces in the path name.
From the command line, this is easy. The following examples all work.
find te*/my\ files/more -print
find te*/'my…
Paddy Landau
- 4,658
13
votes
1 answer
Is globbing a feature of the shell?
I read many questions and answers like this and this one
I know wildcards are expanded by the shell before running a command and they are a feature of the shell.
Also wildcards work with those commands that can accept many arguments.
In find .…
Sinoosh
- 2,101
11
votes
4 answers
7zip: How to exclude file types?
I want to exclude the following file types:
epub
pdf
html (upper case too)
azw3
mobi
opf
txt
I have this so far which doesn't seem to work, i get an error saying "Incorrect Command Line".
7z e "-x!*.epub" "-x!*.pdf" "-x!*.html" "-x!*.azw3"…
olfek
- 1,353
11
votes
2 answers
Is there a way to disable asterisk * interpolation for certain bash commands?
I'd like to be able to write * to my script, and to get * as-is (i.e., without expansion).
Bash will try to replace it with local files matching this pattern, and if this pattern doesn't exist, bash will pass the asterisk without modifications.
I…
Berry Tsakala
- 292
- 5
- 14
9
votes
2 answers
What is the wildcard specifying one or two characters?
Is there a simpler way to write:
wc -l foo?.txt foo??.txt ?
Since in my case I have (at most) two digit numbers, I tried using the range specification wc -l foo[1-99].txt but this ended up displaying only results between 1 and 9 (instead of 99). But…
Matsmath
- 380
7
votes
1 answer
How to delete this files with wildcards in ubuntu terminal
Just asking how to delete these files (below is a sample). I tried rm -rf '*.upload'. but they are not deleted. Please help. thanks for…
jonathan
- 73
7
votes
1 answer
Is there a way to use wild cards, redirection or other shell syntax with systemd units?
I have a systemd file to start a jar file. But I want to execute jar file as *.jar. Is there a way to do this?
[Unit]
Description=Test Background
[Service]
ExecStart=/usr/bin/java -jar…
Janith
- 399
5
votes
1 answer
How to show a difference between the usage of '*' , '+' and '?' in grep?
I understand that
'*' : The preceding item will be matched zero or more times.
'?' : The preceding item is optional and will be matched, at most, once.
'+' : The preceding item will be matched one or more items
Can anyone give me an example of when…
posixKing
- 1,143
5
votes
1 answer
Why doesn't the wildcard "?" work?
I'm learning to use the terminal on Ubuntu with WSL. Right now I'm practicing wildcards, but the ? wildcard doesn't work for me.
As you can see, the * wildcard works but this one doesn't:
$ ls file*
file.html file.js file.txt
$ ls dot*
dot.txt…
4
votes
2 answers
Asterisk not working with grep
I searched for ki with * as per the example below and it should have returned the first three lines. I am not sure why it returns the last line when there is no ki matching it.
$ grep "ki*"…
4
votes
1 answer
How does a command (i.e. grep) know when it is run as part of glob expansion?
As per my understanding, a glob wildcard is interpreted by the shell, which then runs the given command for each matching filename. Suppose I have files: abc1, abc2, and abc3 in my current directory. Then, for example, echo abc* will echo once for…
codecitrus
- 193