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.


It depends on the command.

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


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'.

| improve this answer | |
  • 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.