Re: /dev/tcp
c186282 <[email protected]>
| Newsgroups | comp.os.linux.misc |
|---|---|
| Organization | wokiesux |
| Message-ID | <[email protected]> |
On 8/20/26 09:50, Rich wrote: > Eli the Bearded <*@eli.users.panix.com> wrote: >> What system(s) have /dev/tcp/* natively? > > What "systems"? Only those with a /bin/bash compiled with this > "special bash feature" compiled in. > >> $ man bash >> [...] >> REDIRECTION >> [...] >> Bash handles several filenames specially when they are used in >> redirections, as described in the following table. If the >> operating system on which bash is running provides these >> special files, bash will use them; other wise it will emulate >> them internally with the behavior described below. >> [...] >> /dev/tcp/host/port >> If host is a valid hostname or Internet address, >> and port is an integer port number or service name, >> bash attempts to open the corresponding TCP socket. >> >> I don't see it on the various systems I have handy (Debian 13, Amazon >> Linux 2023, Mac OS 15.7.x, NetBSD 10.1, Android 14). > >> is it a plan9 thing? > > It's a Bash feature. Note the man page quote you provided: > >> **Bash** handles several filenames specially when they are used in >> redirections > > These are handled by Bash, they don't exist as part of the OS (system). Correct. I've used the /dev/tcp trick before to check ports. Seems to only work with Bash. Others might add it eventually, but not too likely. Other odd Linux tricks - how many know you can read/write to a disk drive that has no file system ? GParted does have an option that creates a "blank" drive. It's an old trick, squeeze in more raw data. To a degree, it can make that data a bit more "portable" because it's not tied to EXT?/NTFS/XFS/etc. You just need a system that can open the 'blank' as an I/O device.