3

This question already has an answer here:

/dev/tcp is often mentioned in many sources, and I think I saw it in Ubuntu not so long ago. Now, in Debian Jessie, I can't find it. The same with /dev/udp.

tomasz@E4200:/dev$ ls
agpgart          dm-1     hidraw3       network_latency     sda2      tty11  tty24  tty37  tty5   tty62    vcs2   vfio
autofs           dm-2     hpet          network_throughput  sda5      tty12  tty25  tty38  tty50  tty63    vcs3   vga_arbiter
block            dm-3     hugepages     null                sg0       tty13  tty26  tty39  tty51  tty7     vcs4   vhci
bsg              dm-4     initctl       port                shm       tty14  tty27  tty4   tty52  tty8     vcs5   vhost-net
btrfs-control    dm-5     input         ppp                 snapshot  tty15  tty28  tty40  tty53  tty9     vcs6   watchdog
bus              dri      kmsg          psaux               snd       tty16  tty29  tty41  tty54  ttyS0    vcs7   watchdog0
char             fb0      kvm           ptmx                stderr    tty17  tty3   tty42  tty55  ttyS1    vcsa   xconsole
console          fd       log           pts                 stdin     tty18  tty30  tty43  tty56  ttyS2    vcsa1  zero
core             full     loop-control  random              stdout    tty19  tty31  tty44  tty57  ttyS3    vcsa2
cpu              fuse     mapper        rfkill              tomas-vg  tty2   tty32  tty45  tty58  uhid     vcsa3
cpu_dma_latency  fw0      mcelog        rtc                 tty       tty20  tty33  tty46  tty59  uinput   vcsa4
cuse             hidraw0  mem           rtc0                tty0      tty21  tty34  tty47  tty6   urandom  vcsa5
disk             hidraw1  mqueue        sda                 tty1      tty22  tty35  tty48  tty60  vcs      vcsa6
dm-0             hidraw2  net           sda1                tty10     tty23  tty36  tty49  tty61  vcs1     vcsa7

Has it moved somewhere? (And why?) Does this apply to all Linuxes?

To make it complete, I'm on:

Linux E4200 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux

UPDATE

/dev/tcp not found doesn't answer my question.

This answer:

When you used /dev/tcp/74.125.225.19/80 in a pipe, bash attempted to run a command named /dev/tcp/74.125.225.19/80 and reported an error because that file didn't exist.

doesn't tell me much about /dev/tcp. Neither the Redirections section linked.

I gather from the first answer to my question that /dev/tcp is a "virtual" folder. Please post a link that explains this. And if you know, please answer if this has always been so.

marked as duplicate by Thomas Dickey, Julie Pelletier, sam, Jeff Schaller, Tomasz Aug 25 '16 at 22:02

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.

  • I don't think so. I've checked that one. It's about redirections. – Tomasz Aug 25 '16 at 21:34
  • I validated on my system that ls /dev/tcp is not found but the suggested duplicate's answer works. – Julie Pelletier Aug 25 '16 at 21:44
  • I have no doubts it works. But what I want is the d e t a i l s. – Tomasz Aug 25 '16 at 21:51
  • It's a duplicate, but of this one: unix.stackexchange.com/questions/38780/… (I didn't find it before, sorry.) – Tomasz Aug 25 '16 at 22:03
10

/dev/{tcp,udp} are only bash internals. The tcp and udp sockets stored in /proc/net/{tcp,udp} by kernel

  • Has it always been so? – Tomasz Aug 25 '16 at 21:39
  • 2
    Not always, since the 2.4.x era. (2001) – Ipor Sircer Aug 25 '16 at 21:48
  • 1
    Not just a bash internal; also ksh93. – Stephen Harris Aug 25 '16 at 23:55

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