According to https://www.cs.washington.edu/lab/faq/home-directory-size:

To display the aggregate size of each file or subdirectory (including hidden files and subdirectories) contained within the current directory, sorted by size (largest first), run the following command:

du -sk * .??* | sort -nr

What is the meaning of symbols after -sk and before pipe, * .??*?

As a bonus question, where/how can I find this kind of thing (a combination of special characters in a command line in Linux) using Google? I tried searching, but I couldn't find much since they are just punctuation.

  • 2
    Check the bash manpage: After word splitting, unless the -f option has been set, bash scans each word for the characters *, ?, and [. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of filenames matching the pattern (see Pattern Matching below). Feb 11, 2020 at 20:32
  • 1
    Or look at section 2.13 of pubs.opengroup.org/onlinepubs/9699919799/utilities/… Feb 11, 2020 at 20:33
  • It's supposed to run du on all files and hidden files while avoiding the current directory itself (.) and its parent (..) by requiring a leading . to be followed by at least two characters; this is buggy, though, as a hidden file named like .a would be ignored. Feb 11, 2020 at 20:40
  • The secret is to know that it is not a Linux command (Linux is just the kernel), this is a bash (shell) command. It is called globing. You can read about it in the bash man page. Feb 11, 2020 at 22:18

2 Answers 2


They're the usual filename wildcards or glob or pattern match characters. ? matches any single character, * any number of any characters.

The exception is filenames starting with a dot ., which a leading * will not match (so they're "hidden" files). Hence, * will match any file with a name not starting with a dot, and .??* will match any files with names starting with a dot, and with at least three characters. The latter is what it is because it tries to avoid . and .., but it would also miss e.g. .a.

 du -sk * .??* | sort -nr

this is a du on exactly :

  1. *(all) subdirectories or files
  2. .??* (all) hiden directories or files with at least 2 characters on their names

then results are sorted

@ilkkachu mentionned .??*/ whould be used to show directories only

  • 1
    Appending a / with .??*/ would change the behaviour for symlinks. If you wanted files of type directory only including hidden ones with the exception of . and .., you'd use zsh and its du -sk -- *(D/). Feb 11, 2020 at 20:56

You must log in to answer this question.

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