top | item 46043968

(no title)

windward | 3 months ago

It's funny how many people fall in love with the Unix philosophy because they enjoy using an OS with a macrokernel that ships with awk, tar, and find, which they operate with useless uses of cat.

discuss

order

hagbard_c|3 months ago

Macrokernel or microkernel or a grain of salt, whatever kernel you use does not matter when it comes to seeing the advantages of 'the *nix philosophy'. As to the 'useless uses of cat' these often make the pipe easier to grasp because the first step is always the same:

   cat something|filter step 1|filter step 2|filter step 3
instead of

   filter step 1 something|filter step 2|filter step 3
especially when confronted with filters which need their input to be fed in different ways

   filter step 1 < something
   filter step 1 -i something
   filter something step 1
   cat something|filter step 1
It may be less 'pure' to use cat as the first step in a pipe but who cares?

jraph|3 months ago

You can keep the order of things even if you want to avoid using cat:

   < something filter step 1|filter step 2|filter step 3
(just pointing this out in the hope it can be of interest to someone reading the thread, I don't personally care that much about UUOC - "useless" is quite subjective, one can still reasonably find the cat version more readable).

windward|3 months ago

Oh I don't care: I do it all the time when I compose cli commands. But is it doing one thing, and doing it well, to use `cat – concatenate and print files` to open a file?

I think it's a good example of when it's worth straying from the philosophy.

imiric|3 months ago

A kernel is a very special program, and splitting it into individual components would be orthogonal to the Unix philosophy, which is about user space programs. Besides, Linux is quite modular, and only loads what it needs, so the fact that it's monolithic is not a major concern. Yes, it would be better if kernel panics wouldn't impact the system, but nowadays these are very rare, and are usually related to hardware rather than software issues.

As for GNU utils and the examples you mention, those indeed align with the Unix philosophy, which you clearly misunderstand.

windward|3 months ago

Is it clear enough that you could explain why tar has multiple zip options and why find has a DSL? Is it clear enough that you could explain to Rob Pike why he's wrong about cat -v?