What does the question mark in terminal command mean?

Ooker

This question (How can I remove gnome from a kubuntu 12.04 install?) have the commands with question markes:

sudo apt-get remove --purge ubuntu-desktop
sudo apt-get remove --purge unity?
sudo apt-get remove --purge gnome?

What do they mean?

user259474

Those are called Wildcards (globbing patterns)

Standard wildcards (also known as globbing patterns) are used by various command-line utilities to work with multiple files.
Standard wildcards are used by nearly any command (including mv, cp, rm and many others).

  • (question mark)

    this can represent any single character. If you specified something at the command line like "hd?" GNU/Linux would look for hda, hdb, hdc and every other letter/number between a-z, 0-9.

  • *(asterisk)

    this can represent any number of characters (including zero, in other words, zero or more characters). If you specified a "cd*" it would use "cda", "cdrom", "cdrecord" and anything that starts with “cd” also including “cd” itself. "m*l" could by mill, mull, ml, and anything that starts with an m and ends with an l.

  • [ ] (square brackets)

    specifies a range. If you did m[a,o,u]m it can become: mam, mum, mom if you did: m[a-d]m it can become anything that starts and ends with m and has any character a to d inbetween. For example, these would work: mam, mbm, mcm, mdm. This kind of wildcard specifies an “or” relationship (you only need one to match).

  • { } (curly brackets)

    terms are separated by commas and each term must be the name of something or a wildcard. This wildcard will copy anything that matches either wildcard(s), or exact name(s) (an “or” relationship, one or the other).


For example, this would be valid:

  • cp {.doc,.pdf} ~

    This will copy anything ending with .doc or .pdf to the users home directory. Note that spaces are not allowed after the commas (or anywhere else).

  • [!]

    This construct is similar to the [ ] construct, except rather than matching any characters inside the brackets, it'll match any character, as long as it is not listed between the [ and ]. This is a logical NOT. For example rm myfile[!9] will remove all myfiles* (ie. myfiles1, myfiles2 etc) but won't remove a file with the number 9 anywhere within it's name.

  • \ (backslash)

    is used as an "escape" character, i.e. to protect a subsequent special character. Thus, "\” searches for a backslash. Note you may need to use quotation marks and backslash(es).

for more examples: visit this page

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does the question mark in terminal command mean?

From Dev

What does a question mark after the file name mean using ls terminal command?

From Dev

What does question mark mean?

From Dev

What does question mark equals mean in CoffeeScript?

From Dev

What does this question mark mean in Flow: "?() => void"

From Dev

What does the question mark in "Decimal?" mean?

From Dev

XML what does that question mark mean

From Dev

What does the triple question mark mean in scala?

From Dev

What does the question mark in java mean?

From Dev

What does .php question mark = mean?

From Dev

What does the "?" (question mark) mean in javascript?

From Dev

What does this two question mark mean?

From Dev

What does hypothesis with operator with question mark mean

From Dev

What does `>>` mean in terminal command?

From Java

What does double question mark (??) operator mean in PHP

From Java

What does question mark and dot operator ?. mean in C# 6.0?

From Dev

What does "type" mean and is there is a special use for a question mark in ECMA 6?

From Dev

What does the question mark in member access mean in C#?

From Dev

What does the question mark mean in a type parameter bound?

From Dev

What does the question mark icon by a file name mean in Aptana?

From Dev

Vim: What does a double quotation mark mean at the beginning of a command?

From Dev

What does %-mark mean in Clojure?

From Dev

What do a question mark (?) and an ampersand (&) mean in a URL?

From Dev

What does the '|' (vertical bar) character mean in a Terminal command?

From Dev

What does the '|' (vertical bar) character mean in a Terminal command?

From Dev

What does the period (.) mean at the start of a filename in a terminal command?

From Dev

What does this command mean?

From Dev

What does this terminal message mean?

From Java

What does an exclamation mark mean in the Swift language?

Related Related

  1. 1

    What does the question mark in terminal command mean?

  2. 2

    What does a question mark after the file name mean using ls terminal command?

  3. 3

    What does question mark mean?

  4. 4

    What does question mark equals mean in CoffeeScript?

  5. 5

    What does this question mark mean in Flow: "?() => void"

  6. 6

    What does the question mark in "Decimal?" mean?

  7. 7

    XML what does that question mark mean

  8. 8

    What does the triple question mark mean in scala?

  9. 9

    What does the question mark in java mean?

  10. 10

    What does .php question mark = mean?

  11. 11

    What does the "?" (question mark) mean in javascript?

  12. 12

    What does this two question mark mean?

  13. 13

    What does hypothesis with operator with question mark mean

  14. 14

    What does `>>` mean in terminal command?

  15. 15

    What does double question mark (??) operator mean in PHP

  16. 16

    What does question mark and dot operator ?. mean in C# 6.0?

  17. 17

    What does "type" mean and is there is a special use for a question mark in ECMA 6?

  18. 18

    What does the question mark in member access mean in C#?

  19. 19

    What does the question mark mean in a type parameter bound?

  20. 20

    What does the question mark icon by a file name mean in Aptana?

  21. 21

    Vim: What does a double quotation mark mean at the beginning of a command?

  22. 22

    What does %-mark mean in Clojure?

  23. 23

    What do a question mark (?) and an ampersand (&) mean in a URL?

  24. 24

    What does the '|' (vertical bar) character mean in a Terminal command?

  25. 25

    What does the '|' (vertical bar) character mean in a Terminal command?

  26. 26

    What does the period (.) mean at the start of a filename in a terminal command?

  27. 27

    What does this command mean?

  28. 28

    What does this terminal message mean?

  29. 29

    What does an exclamation mark mean in the Swift language?

HotTag

Archive