I'm having trouble finding a name for the - character in the context of a piped bash command.

  1. What is the - character called?
  2. Can I replace it with something more readable for a script?

Example command:

echo -ne "my command" | socat - /dev/somefile
  • 6
    Does this answer your question? Usage of dash (-) in place of a filename Also see the questions linked to it: this and this. Commented Apr 26 at 4:01
  • /dev/stdin, /dev/stdout. Commented Apr 26 at 4:06
  • it has absolutely nothing to do with Bash (or any other shell) here, though. The shell will pass that - as an argument to the program as-is, same as any other.
    – ilkkachu
    Commented Apr 26 at 5:55
  • For completeness and to answer the question the title before it was edited, - is also treated as option delimiter for the bash interpreter itself and its set builtin like in the Bourne shell and as meaning $OLDPWD for its cd/pushd builtin like in the Korn shell and >&- is used to close a fd like in the Bourne shell. Commented Apr 26 at 6:49
  • ITYM echo -ne 'my command' or echo -n -e 'my command' which would be the non-standard and non-portable (even in bash) equivalent of printf %b 'my command'. Though for "my command" specifically, the -e is superfluous (and %b could be replaced with %s). Commented Apr 26 at 6:54

2 Answers 2


This - here is not one of bash's features, but rather a socat feature. According to man socat:

For some keywords there ex‐ist synonyms (’-’ for STDIO, TCP for TCP4).
       socat - TCP4:www.domain.org:80

              transfers data between STDIO (-) and a TCP4 connection to port  80  of  host  www.do‐
              main.org. This example results in an interactive connection similar to telnet or net‐
              cat.  The  stdin terminal parameters are not changed, so you may close the relay with
              ^D or abort it with ^C.

So this - stands for STDIO.
I never used socat before, but I can guess via socat - TCP4:www.domain.org:80 you can talk with www.domain.org:80 with your keyboard- You type something, stuff you typed gets sent to www.domain.org:80, and stuff you receive from the address gets printed on your terminal.

- can be seen in some other programs as well, mostly stands for stdin.


The - character is generally and interchangeably called a "dash", "hyphen", or "minus". I have heard a nontrivial number of persons refer to it as "tac" or "tack".

Its use as the parameter in lieu of a filename generally means to use standard input or standard output. For example, cat - > myfile will concatenate whatever you send to standard input (i. e. pipe in or type at at your terminal) will be placed into a newly created file called myfile.

This is not universal, however. Be sure to check the man page to see if this idiom is supported for whichever tool you happen to be using.

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