Artificial intelligent assistant

What is meaning of double hyphen (--) in ls command I was looking for command to print only directory names in linux. I came across this novel syntax, where we can put two hyphens adjacent without any word. ls -ld -- */ What is the meaning of this double hyphen (--) in this command and in general in linux commands?

"--" is used to mark the end of options and thus the beginning of arguments. It tells the command to treat everything following it as arguments and _not_ as options, even if something may _look_ like an option. This is used in several commands, not just `ls`.

This prevent the command from choking on arguments (eg. filenames) that begins with a hyphen (-) or two (--), which else would cause an error (no such option) or unpredictable result (if the hyphened argument actually is a valid option), because the command would try to interpret it as an option (and not as an argument).

For example, lets say one of your arguments is a file with a newspaper article:

> -No Collusion, President exclaims - Washington Post.html

A preceding "--" will prevent the "-No" from being treated as an option.

This is especially important when using jokers (*) as in your example, because you'll never know beforehand if one or more of all the files from several sub-directories may begin with a hyphen.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e049871761afef690fe6bbcd1e027ae7