I am looking for a way to open TCP connections in fish shell.

In bash, I can do the following to open a TCP connection. This is quick telnet type test when telnet is not installed.

$ echo > /dev/tcp/  && echo up

A failed connection

aaron@aaron-pc: ~ 
$ echo > /dev/tcp/  && echo up
bash: connect: Connection refused
bash: /dev/tcp/ Connection refused

In fish I tried the following.

echo > /dev/tcp/; and echo up
An error occurred while redirecting file '/dev/tcp/'
open: No such file or directory

I guess the bash has that functionality to create a tcp device when it needs it and fish uses some other mechanism.

Here is some of the documentation on bash and /dev/tcp https://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip https://stackoverflow.com/a/19866239/619760


fish does not do this. You will need to use netcat or a tool designed for network connections, or use an operating system which provides file-level access to remote network endpoints (such as GNU Hurd's socketio translator).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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