Yeah. It could just as well have issued a file not found error when you try to touch a nonexistent file. And we would be none the wiser about what we’re missing in the world.
“Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should touch waste your time?
It is short for concatenate, which is to join things together. You can give it multiple inputs and it will output each one directly following the previous. It so happens to also work with just one input.
Does anyone actually use
touch
for its intended purpose? Must be up there withcat
.The intended use of
touch
is to update the timestamp right?Yeah. It could just as well have issued a file not found error when you try to touch a nonexistent file. And we would be none the wiser about what we’re missing in the world.
“Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should
touch
waste your time?Because now touch does two things.
Without touch, we could “just” use the shell to create files.
Touch does one thing from a “contract” perspective:
Ensure the timestamp of <file> is <now>
Systemd also does one thing from a contract perspective: run your system
TIL it’s actually for changing timestamps.
https://www.man7.org/linux/man-pages/man1/touch.1.html
what is cat’s use if not seeing whats inside a file?
It is short for concatenate, which is to join things together. You can give it multiple inputs and it will output each one directly following the previous. It so happens to also work with just one input.
That’s why we have
bat
nowhttps://github.com/sharkdp/bat
To bonbatenate files?
It is to use along with
split
. e.g.split
to break it into multiple files of 4GBcat
to combine all files into the original file. (preferably accompanied by a checksum)Doesnt computers do this automatically if you try to copy over a file larger than its per file size limit?
No. It just gives an error that it’s too big.