I have Ubuntu 16.04 and I note there are many devices in the /dev folder that don't physically exist.

For example, I have 2 serial ports and I can access them using ttyS0 and ttyS1 as expected.

However, in the /dev directory, I see 32 ttyS(n) devices and when I do an ls on them, there is no difference listed.

My question: What is the philosophy behind listing so many non existent ports? Why not have the OS make entries in the /dev dir only for ports that exist?

Thanks, Mark.

edit, I am speaking of serial ports ttyS(n) vs virtual consoles tty(n).


  • It is my belief that those settings are set when you compile the kernel. To have it perfectly match your hardware it would be needed to recompile the kernel instead of just download a binary which is the default for Ubuntu. This would slow install, upgrades (it would require a re-compile) etc. As such the maximum generally required are set in the kernel. (USB is universal serial bus, and can use them in certain circumstances, but I can't be specific here) – guiverc Aug 3 '18 at 7:57
  • So, you are suggesting they took the lazy approach and placed the burden of actually verifying these ports on all other programmers who use the ports rather then taking the time to do it properly. The (slightly) better way is to detect them in POST and not recompile the kernel. Even better, they should be hot-swappable. Linux already automatically detects USB insertions and others. If I add a USB-to-serial adapter, the kernel should automatically add ttyS(n+1) in the devices dir. (Sorry, I guess I'm ranting a little.) – Cool Javelin Aug 3 '18 at 17:11
  • 1
    Possible duplicate of Why so many Virtual consoles? – Sergiy Kolodyazhnyy Aug 5 '18 at 4:33
  • 1
    Possible duplicate of why do I have 32 ttyS – WinEunuuchs2Unix Aug 6 '18 at 18:05
  • 1
    @SergiyKolodyazhnyy OP edited question so I nominated a second duplicate candidate. – WinEunuuchs2Unix Aug 6 '18 at 18:07

You are only using 2 devices now, but system is able to work with as many as 32. Hence, name ttyS32 exists if you might need it. In old days there were just 4 Com ports, but now with hot swappable devices that can spawn synthetic ports, better if kernel claims control of the names it might use

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.