Later on in deployment, it will go somewhere else. Somewhere that has been evaluated for being able to handle it.
In that way, /dev/null is to storage what `true` is to execution - it just works.
Both (along with a lot of the standard utilities) are a testament to what talented C programmers plus years of people beating on them in unintended ways can achieve in terms of reliability/stability.
Shellshock [0] is a rather famous example, but bugs like that are rare enough that they make the news when they're found.
[0] https://en.wikipedia.org/wiki/Shellshock_%28software_bug%29
The correct spelling is “seems”. I first assumed it was a typo, but since you did it twice I thought you might like to know.
The newline is a line terminator, a command outputting an incomplete line without a line terminator is producing garbled non-textual output. Files which contain incomplete lines without a line terminator are similarly garbled non-textual files and not very different from /dev/urandom or any other binary file.
I would argue that no, there are many valid cases for commands to not produce a final \n in their output. The first example that come to mind is curl'ing a REST API whose body is a single line of JSON. Many of those will not bother with a final \n, and this does not qualify as "garbled output" in my book. I would even go as far as saying that a shell just printing the prompt at whatever place the cursor happens to be is a side-effect of how terminal emulation works and the fact it's just a character based terminal.
This is actually something that Warp does pretty well, with a strong integration with the shell where your command is in a dedicated text box, by the virtue of it being GUI and leveraging GUIs. (I don't use it however, I'm too much of a sucker for dense UIs).
However I do agree with your argument that it's not the role of the shell to protect you against `cat /dev/urandom` or `cat picture.png`. And fish indeed does not try.
IMHO a shell is built for humans when in interactive mode (one of the raison d'être of fish), and the lack of final \n is such an annoyance that handling this specific edge case is worth it.
A command could very well be manipulating the cursor on its own and intentionally not writing newlines when it wants to overwrite text such as in a progress bar.
With the design we actually have, the shell is the only thing in the chain that could reset the TTY state and ensure that the prompt gets displayed consistently each time, and it should. I wouldn't go so far as to say that I expect it to (my expectations for computers are not high in general) but it ought to.
Maybe that should be actually the job of the terminal emulator instead. It could happen when a new pseudo terminal is (de)allocated, which is ordered by the shell.
I realize that. That's why I was talking about a hypothetical where it was designed all together, instead of evolving over the decades like we did.
In the situation we actually have, the shell is the only single entity that's in a position to actually do this. The terminal emulator doesn't know when a command completes. Of course, it doesn't have to be solved in a single entity. It would make sense to have the shell signal command completion to the terminal emulator, and let the terminal emulator do whatever it wishes with that information, which could include resetting any garbage state.
I think that even when you would design it all today the distinction between interface and running program would still be useful, otherwise every program would need to implement it's own interface and a shell does more than just communicate interactively with the computer. It's also a task runner, program orchestrator, controls program selection and allows for automating other programs.
> It would make sense to have the shell signal command completion to the terminal emulator, and let the terminal emulator do whatever it wishes with that information, which could include resetting any garbage state.
The thing is, it kinda works this way already. I'm not that knowledged about the actual interaction, but the shell already tells my terminal what the current directory is, which programs it has invoked, so that my terminal emulator can show me this in the chrome.
Ok, so my stance is: Yes it is not the job of the shell to modify the output of some program, but it is the job of the shell to tell the terminal emulator to do that, when the user requests this. I'm positively minded, that actually someone can chime in and say "ah, that's just not the default, you can configure bash, readline, etc. to do that though." I think the thing is, that bash just assumes that programs are POSIX-compliant and POSIX specifies, that every programs outputs a newline. Actually POSIX doesn't define it as newline, it defines it as the end of line. A program that forgets LF doesn't have forgotten to advance output a newline, it has output an incomplete line in that reading.
This would lead to impossible states, like
if cat foo | false; then echo hmm; fi
Producing output sometimes, depending on whether or not `cat foo` or `false` return value was used
[0] https://lists.gnu.org/archive/html/bug-bash/2015-06/msg00010...
Given that this statement begins with "joking aside", I have to assume it is either a meta-joke or an uninformed opinion. Taking the subsequent sentence into account thoroughly reinforces the former.
Well played. :-)
Wait: that's just not true.
Carry on.
Luckily it's usually a tmpfs
I feel like that'd happen because of some other bug, I wouldn't consider that a bug in /dev/null :)
It took a while before noticing I had no more /dev/null on the machine (read: the time needed to fill the rootfs). In a panic, I removed the file.
Seeing the machine collapse due to /dev/null missing was fun.
I guess that might not be true for all nixes out there
You can recreate it with 'mknod /dev/null c 1 3; chmod 666 /dev/null'.
The '1 3' are the major and minor device numbers, respectively, which are assigned / maintained by LANA, the Linux Assigned Numbers Authority.
So nothing's stopping you from making it a normal file and capturing all the output programs send to it.
For super funsies you can make it a symlink or socket, but I think most programs won't work if it's a socket.
Nothing also is stopping you from removing it and mknod'ing a /dev/null into another device file, such as the one /dev/full or /dev/zero uses, or /dev/fb0 if you wanna be really silly.
sudo mknod /dev/null c 1 3 && sudo chmod 666 /dev/null
might do it on many systemsHowever with a single server, it doesn't perfectly linearly scale with multiple clients. I'm getting
1 client: 5GB/s
2 clients: 8GB/s
3 client: 8.7GB/s
dd if=/dev/zero of=/dev/null bs=1M status=progress
A second dd process hits the same speed. yes | pv > /dev/null
I hope that in my next rewrite I can advance to larger block sizes. yes $(printf %1024s | tr " " "y") | pv > /dev/null
About the same throughput as letting yes output a single character. I guess Unix pipes are slow.Or string concatenation, or pipeviewer.
https://github.com/coreutils/coreutils/blob/master/src/yes.c
copy c:\file nul
It's been there since DOS or more likely CP/M :)
set "nul1=1>nul"
set "nul2=2>nul"
set "nul6=2^>nul"
set "nul=>nul 2>&1"
just saw this in a .cmd scriptbest post of the week ^^
The Chinese comments ("issues") also seem to be the same kind of jokes as the English ones, "no code means no bugs, perfect", etc., from the few I tried getting translations of. I imagine this went viral on Chinese social media, which makes sense since it's the sort of joke that's easy to translate and doesn't depend on particular cultural assumptions or anything.
https://github.com/kelseyhightower/nocode/commit/80f38e0f103...
Considering there is no way to read back data written to /dev/null it will not be useful for storing database data.
Your humor unit might be defective.
It's as if the joke requires two steps away from reality: first to apply the definition to a domain where it doesn't apply, then mis-reading the definition to make it fit. Having to go two steps like that spoils the feeling of insight that makes a joke like this work.
The article doesn't belabor the gag, which is a point in its favor. It has to hit you with its punch line and then quit before it wears out its welcome.
‘return 5’
Discussed on HN a few times, but apparently not for a few years now: https://hn.algolia.com/?q=http%3A%2F%2Fwww.supersimplestorag...
Specifically, these definitions require that transactions appear to execute in some serial order, and place no constraints on that serial order. So the database can issue all reads at time zero, returning empty results, and all writes at the time they happen (because who the hell cares?).
The lesson? Demand real-time guarantees.
https://www.linusakesson.net/programming/pipelogic/index.php
Past HN post: https://news.ycombinator.com/item?id=15363029
So I had this idea that you'd design code to be applied to a processing unit of specific capacity which would lead to execution flowing at a certain speed when applied a certain computation potential... and surprise surprise the relation would be uh, linear, and say you increase a loop's count and so the code would _resist_, or you'd increase computation potential to increase the flow.
So uh, yeah, Ohm's law but it's _code_ that's resistive.
And then I started to look for the pattern and find code with inductive properties, and code with capacitive properties, and some deeper properties emerged when you started modelling stuff with multiple processing units and data flowed around, split (map?), rejoined (reduce?).
And there was something strangely efficient about a way to see code that way and optimise using _laws_ describing the whole execution flow using familiar tools as a whole instead of thinking in gritty details barely higher-level than MOV AX... you "just" had to design code and the execution system so that it would operate in this kind of framework and allow that kind of analysis to identify bottlenecks and weird interplay actions across components.
And then I brought that up to my mentor and he said "well that's complete lunacy, stop thinking about that and focus on your current work" and, uh, case closed.
That was the young and naive me who thought that research labs were made to do think-outside-the-box connect-the-dots innovative stuff...
...because the typical setup assumes λ ≤ μ so all arriving jobs eventually get serviced.
I think there's a lot of unmet potential in design of interfaces for pipelines and services that really gets at the higher level you mention. There are some universal laws, and some differences between practice and theory.
S
| |
-------| |
G \/\/|##| |
-------| |
| |
D
This is essentially a pressure regulator, except that the pressure is controlled by an independent signal. Pressure in G pushes a spring-loaded piston to block flow from S to D (a slightly different construction instead allows flow when G has pressure). Modulating the pressure in G can also used to modulate the flow, based on F = -kx. This simple construction has some issues, such as the fact that the pressure needed to move the piston depends on the pressure in S-D.Fun fact, in British English the term for a vacuum tube triode is "valve" precisely because it operates like a valve. FETs (particularly JFETs) follow the same analogy (which is why FET and triode amplifier circuits look basically the same) using the field effect instead of thermionic emission.
"The Phillips Machine is an analogue computer which uses fluidic logic to model the workings of an economy."
Pipe Logic (2011) - https://news.ycombinator.com/item?id=17040762 - May 2018 (18 comments)
Pipe Logic – Simulating circuits in the Unix shell (2011) - https://news.ycombinator.com/item?id=15363029 - Sept 2017 (10 comments)
/dev/zero has infinite electrons and /dev/null has an infinite appetite for them - https://news.ycombinator.com/item?id=4063459 - June 2012 (23 comments)
Is it portable to all linux distros?
Where is the ubuntu command to install it?
What license does it use, is it free or else?
Is it really open source or source only?
You’re right, we should ban jokes that aren’t 100% correct!
All the people I've met in London were androids.
> entreprise
This tech is just around the corner I promise, then we will be first to the market and all the big tech companies will want to buy us out, imagine how much we can earn.
/s
"ChatGPT, I had a database here but it seems to have gone missing. It had a table with "User", "Email", and "Amount Paid"; can you reconstruct it for me?"
...
"I dunno boss, that's what the AI said."
The DB at cloud scale
That /dev/null is ACID compliant is the trivial solution of databases.
Still, a jolly good read, and a nice reminder that concepts like ACID don't exist in a vaccuum.
[1]: https://en.wikipedia.org/wiki/Triviality_(mathematics)#Trivi...
Except if it's in /dev/null?
(hint: look up subnormal floats.)
Durability in ACID is about the durability of the data that is sent to the database (in this ironic post, /dev/null) once committed.
"[...] completed transactions (or their effects) are recorded [...]"
But I will give it that ACI do make sense!
#PedanticMode
1. Nothing stored in /dev/null is durable. 2. Nothing is stored in /dev/null. 3. Ergo, /dev/null exhibits durability.
Thank you, I'll take my check at the door.
https://en.wikipedia.org/wiki/Write-only_memory_(joke)
See the datasheet also, I especially like the "insertions vs number of remaining pins" chart:
https://web.archive.org/web/20120316141638/http://www.nation...
And the production of articles is about right too.
. "Hello World" - The start of something great. [Dec 2024]
. "Comparison is the Thief of Joy" - Link to another article. [Apr 2025]
. "/dev/null is an ACID compliant database" - Funny, insightful. [Aug 2025]
That read about like my blog 20 years ago.Funny post though, good read!
cluckindan•3mo ago
Truly, it is the only database which can be scaled to unlimited nodes and remain fully CAP.
thfuran•3mo ago
ozim•3mo ago
I am putting my marketing hat on right now.
pasteldream•3mo ago
https://inutile.club/estatis/falso/
the_jeremy•3mo ago
shakna•3mo ago
yccs27•3mo ago
tgma•3mo ago
pasteldream•3mo ago
DonHopkins•3mo ago
inopinatus•3mo ago
alliao•3mo ago
eru•3mo ago
geoffbp•3mo ago
tgv•3mo ago