I am pretty new to Linux. I have Linux Mint 19.3 installed. So basically as I understand apt list works with wildcards like * and ?. It works fine with most other letters and letter sequences I had tried. But when I wanted to list all Wine packages installed, I found out that my apt list doesn't work with all combinations of letters of word "wine" and wildcards. For example: it doesn't work with "w*, wi*, win*, wine* etc". And I have other packages except wine starting with letter W. It only lists package with exact same names stated. However it seems to work when I use quotes (my apt version is < 2.0 so it seems like it treats asterisks in quotes as wildcards as well). Am I missing something, is it a bug or something else?

Edit 0: So thanks to the comments I figured out that it is because there are files in the directory the terminal was started in that start with W. But why is this and how does this work on programming level? Isn't it supposed to treat all other arguments as command's options other than filenames?

  • 3
    In the directory where you're running this, do you have any files that start with w, wi, etc? If so, w*, wi* etc. will expand to that filename. Try quoting: 'w*' Feb 7, 2021 at 21:47

1 Answer 1


When you use bash wildcard like w*, bash gets the first go at searching for matching entries in the directory and passes them onto apt before apt has a chance to evaluate it, otherwise commands like ls file* would not work. Using quotation marks forces bash to interpret the expression literally, and the wildcard gets passed onto the command for evaluation. You could alternatively use regex apt list --installed | grep ^w.*, which bash does not evaluate.

  • I’ll take your grep ^w.*, and raise you a touch ^w. ;-). Bash does evalute the glob there too... Feb 8, 2021 at 8:27
  • apt list already permits patterns. There's no need to invoke grep. Use apt list --installed 'w*'. Feb 8, 2021 at 9:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .