-1

It's been While since i'm using dash(-) in unix command. But have never found out what exactly is this.

Have searched at some place it says . It mean stdin/stdout when used in end of command or like echo hello > - .

For example When i write grep -i it checks with ignore case. (so i think it get argument here as -i)

While if sometime when filename or folder name begins with -folderName i need to run rm -f -- -folderName

What exactly this dash is can someone explain it in simple term.

marked as duplicate by Michael Homer, jasonwryan, Anthon, cuonglm, Stephen Kitt May 11 '15 at 10:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

It depends on the command.

By convention, a standalone dash in place of a filename, would mean 'stdin' or 'stdout'.

E.g.

tar cvfz - ./path-to-tar | ssh somehost tar xvfz - 

However this is merely a standard sort of a flag for this purpose - what it actually means is 'whatever the person who wrote the command thought it should'.

  • To elaborate perhaps a bit too far: some programs (optipng for example?) don't give it any special meaning at all, and will actually just look for a file called - in the current directory. – Score_Under Jul 29 '16 at 13:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.