39
submitted 1 month ago* (last edited 1 month ago) by arty@feddit.org to c/linux@lemmy.ml

Over the decades I’ve seen the praise and critique of the "Unix way". I don’t remember reading about the aspect I’ll describe below. This might be a banality, and I haven’t invested much thought into it either. I’m just curious to hear your opinions.

At the core of the Unix way is that tools should do just one thing. Users very often need results that can only be achieved after doing several things. With only single-purpose tools at hand, users have to integrate them. In other words, the tool authors delegate integration to the users.

Here’s the idea I want to discuss. In programming languages, integrating various modules to achieve a goal is already a complex task because we often have to handle numerous failure modes and edge cases. In shell scripts this is much worse, since shells are more limited than programming languages. Writing a tool that does only one thing looks like avoiding the most complicated task. Which leads to a conclusion that the Unix way only works well in a rather small fraction of use cases; the majority of cases are better served by different approaches.

What do you think?

top 50 comments
sorted by: hot top new old
[-] hendrik@palaver.p3x.de 18 points 1 month ago

On the other hand a programmer rarely knows exactly what I'm trying to accomplish. Do I want to count the characters in a textfile? Or the words? Do I want to sort the files by size? age? filename? And which of those am I trying to move? What if I want to delete all files older than 30 days which don't have the word "elephant" in them? I mean sure, you can implement all of that in a very complex program with a very convoluted user interface... Or you do it the Unix way and give me seperate (simple) tools to count, a tool to sort, search text... and a way to connect it to the delete tool.

[-] arty@feddit.org 1 points 1 month ago

Continuing the train of thought from the post: an approach that might serve you better is not a universal program that does everything. It is rather a custom program that does what you need. It very likely will apply reusable code, but in the form of modules instead of programs. It will be much easier to write well than to write a bash script well.

[-] hendrik@palaver.p3x.de 2 points 1 month ago* (last edited 1 month ago)

I mean that's basically the same thing, just a different user interface. I think from a technical perspective it doesn't matter a lot whether we write down the commands as text/words and connect them with "|" symbols or whether we pick them from a long list of symbols and arrange them as puzzle pieces or connect them with pipes or arrows drawn with the mouse.

[-] arty@feddit.org 2 points 1 month ago

In my experience, programming languages offer more control than just connecting inputs and outputs, and it’s easier to get right

[-] novafunc@discuss.tchncs.de 5 points 1 month ago

And generally should be more efficient too. Bash and this unix-style tool calling was not designed for efficiency. Which is fine for most use cases, but should be avoided for tools you regular use.

To be more detailed, every time you call a program using bash, your bash program has to fork into two identical processes. Then all that work of forking is wasting as one of the forks then execs to replace itself with the program you called. And that happens with each tool called.

Using other programs, like Python, can more efficiently exec other programs without the same overhead of forking. And for longer running jobs, Python is much more efficient as it converts itself to bytecode, whereas bash is purely interpreted.

The main downside of Python is its longer time to start. So for simpler jobs, bash can be better.

[-] hendrik@palaver.p3x.de 1 points 1 month ago* (last edited 1 month ago)

Most computer stuff is tradeoffs anyway. I mean we're looking at different manifestations of "efficiency" here. On the one hand we're wasting fractions of a milliseconds here and there. On the other hand this might allow us to execute code in parallel, offer modularization. I can combine wildly different programs from different manufacturers, written in different programming languages. I can install new ones and execute them straight away without reloading my shell...

But I'd argue this doesn't even matter all that much. We're talking tiny fractions of a second in most use-cases. The real efficiency is me sitting in front of my computer and saving 10 minutes of time because it's easy and straightforward to make the computer do the task I want it to do.

I'm not a big fan of BASH. I do use it. But mostly when it makes sense and it's the right tool. And I keep forgetting how to do if-else-statements, when to use single or double brackets... It occasionally breaks in weird ways and it generally needs a lot of background knowledge to write good bash scripts. Python is designed with a bit of a different use-case in mind. But it can also be used to write quick scripts to sort files, do some admin stuff and automate things. Oftentimes it's a good and comfortable tool to use.

[-] jollyrogue@lemmy.ml 11 points 1 month ago

I think you’re missing the difference between professional software development and a QnD script thrown together to accomplish a task.

The UNIX philosophy is also related to The Agile Manifesto and “worse is better”.

People are supposed to have the power to solve their problems. Unix provides primitives and tools to people, and they are expected to learn enough to use the system. It’s from a very different time. Well before the “don’t make me think” crowd showed up.

In programming languages, integrating various modules to achieve a goal is already a complex task because we often have to handle numerous failure modes and edge cases.

Now ignore all of the failure modes and edge cases except those that a script is going to directly run into, and that should simplify the requirements. This is “worse is better”.

Perl, Python, and Ruby are supposed to be approachable and easy to get started with. They were never supposed to be industrial programming languages like C, C++, Ada, Pascal, Java, etc., and what you’re noticing is the software industry not understanding there needs to be levels which address the different needs of people. Sometimes people need a simple tool, and not everyone needs to master the professional tool which takes two hours to set up and adjust.

The software industry destroying easy, simple to use software is another discussion.

What does QnD mean here? Sorry if it's a stupid question, but I tried searching google and Wikipedia and got nothing relevant

[-] jollyrogue@lemmy.ml 5 points 1 month ago

QnD is Quick ‘n Dirty.

Quickly thrown together with dirty code.

[-] cyphear@thelemmy.club 3 points 1 month ago

Sometimes I'm looking for a throwaway script that only does one thing and it doesn't necessarily need to be pretty. I'm not looking to make it publicly used or even to be repeatable. Like the famous Todd Howard quote, "it just works." QnD is the best option.

Ah yes! I know the expression and the meaning, but I've never seen that abbreviation before! You learn something everyday! Thank you very much! (And I agree with your original comment)

[-] arty@feddit.org 1 points 1 month ago

So, it is me "missing the difference between professional software development and a QnD script" or the whole software industry? ;)

ignore all of the failure modes and edge cases except those that a script is going to directly run into

I’ve seen lots of cases of catastrophically wrong expectations of what the script will run into. Both for casual personal scripts, and professionally written scripts. I dare to claim that the majority of script authors cannot properly estimate this.

[-] brainwashed@feddit.org 11 points 1 month ago

I think the Unix way is a great ideal if you develop composable cli tools, functions or libraries. In each its easier to reason and recombine a thing, that does one specific thing. More complex user problems are then solved by combining multiple simpler components. Lots of modern graphical user interfaces neither think about what the user might want to do, just offering everything, nor prescribe a specific workflow, which just leaves users that have a only a vague idea of what they want to do or a porgram could do, confused.

Being more unixy would be great for mobile apps as well. iOS for example has these app shortcuts which expose functionality of an app to be combined with other apps featuers. I think once siri AI takes hold this could be done. I think, however, the monetization realities of most software will always pressure them to do lots of things and lock the user in.

load more comments (4 replies)
[-] non_burglar@lemmy.world 6 points 1 month ago

The UNIX philosophy does look like "do one thing and do it well", but it's really a means of working in such a way that one doesn't introduce scope creep to a point of Drupal.

load more comments (2 replies)
[-] thedeadwalking4242@lemmy.world 6 points 1 month ago

I think a big portion of the unix philosophy is to be easy for development. Not for consumers or customers.

The idea is that it will be easier for developers more complex software and flexible software if the pieces they are working with are well defined.

load more comments (3 replies)
[-] arran4@aussie.zone 3 points 1 month ago

By making smaller tools you're allowing for a shell scripting distinction to exist where without it you would have a lot more specialized tools that do "more" but don't integrate well. Kind of like the webbrowser.

[-] arty@feddit.org 1 points 1 month ago

If I understood your idea correctly, my proposal is the opposite of what you mentioned. I argue for more of better integrated software that does less.

load more comments (1 replies)
[-] sudoer777@lemmy.ml 2 points 1 month ago* (last edited 1 month ago)

I like tools to be separated enough that I can do scripted/CLI calls with them through standard interfaces (as opposed to being a GUI/TUI monolith). All sorts of stuff can be done when tools output structured data like JSON that's easy to parse and manipulate, or being able to interact with DBus APIs or services in other ways.

What I don't like is when core tools try to be "smart" and reimplement things that other tools already do and end up making them more difficult to work with. Like package management, we already have Nix, Mise, and a billion other package managers, we don't need another one. And turning the compiler into a package manager (cough Typst, .NET) is just stupid. Also programs editing their own configuration files is annoying as well, I can edit them myself and I don't want them touching my edits, and if other people don't want to do that then maybe a custom interface could be put in a UI/add-on of some sort that's not part of the core tooling.

Also web browsers and web applications are close to bottom of the barrel in terms of scriptability. The stuff the Nix ecosystem had to do to make Firefox configurable is nightmarish and still janky, and Electron is an overall mess. Although with everyone wanting to make the programs work with AI agents now, maybe this will improve.

[-] Sxan@piefed.zip 1 points 1 month ago

turning the compiler into a package manager (cough Typst, .NET) is just stupid

Do you mean Typst's import "@preview" function?

[-] sudoer777@lemmy.ml 1 points 1 month ago

Yes. Also I'm trying to figure out if there's a way to keep the versions in sync between files because it doesn't seem to have a lockfile or central version management either

[-] Sxan@piefed.zip 1 points 1 month ago

I don't use import much, myself, as I haven't used Typst for more þan a couple-page small document. Don't you specify the version in the import declaration? What do you mean, "keep versions in sync between files"?

[-] sudoer777@lemmy.ml 1 points 1 month ago

Like I have a typst document with like 20 files and I don't want to have to update the import on every one whenever there's an update

[-] Sxan@piefed.zip 1 points 1 month ago

Oooh. Okay. Yeah, þat's dumb.

[-] hirihit640@sh.itjust.works 2 points 1 month ago

I'm confused what you're trying to say here. It sounds like you are trying to say that unix philosophy fails to address the difficulty of actually composing and integrating the simple primitives provided by GNU/Linux. But you could say that for any programming language.

Unless you are saying that the shell should have intermediate tools that are more specialized than the primitives. Like libraries or frameworks built on shell primitives. But I think for that sort of complexity, shell scripts are too slow and counterintuitive, and you should just use a proper programming language, like all the other complex specialized cli tools in the Linux ecosystem (nmcli, systemd, etc).

I see shell primitives as relics of the past, and I treat them like you might treat the buttons on a GUI. There's a button for copying items called cp, a button for moving items called mv, etc. I rarely compose these tools into complex scripts, and I almost never write bash scripts longer than like 10 lines. For any sort of complexity I use Python or Go.

load more comments (1 replies)
[-] TrollAccount69@lemmy.ml 2 points 1 month ago

The Unix way isn’t for people who can’t integrate those tools.

Ever been in the drivers seat of an 18 wheeler? Even just getting into one requires more physical exertion than getting into your car. When you’re up there you have a million gauges and controls meant to provide the operator the tools they need for any situation they might encounter and to interface with a galaxy of stuff that can be hooked up to the back. You need a special license which encapsulates this different paradigm of use, operating a gigantic vehicle under much different and more variable conditions than the everyday driver (in addition to approaching normal road conditions and functions like turning left with a different outlook and awareness).

It’s why I often tell people not to switch to Linux. It’s not for them.

load more comments (2 replies)
[-] banana_pie@piefed.zip 1 points 1 month ago

Unix is dead. Everyone ships RESTful services + web UI. Underlying platform doesn't make a difference. You could ship it on Windows server and no one would notice.

[-] hendrik@palaver.p3x.de 3 points 1 month ago* (last edited 1 month ago)

The programmers and ops would probably notice because it now takes ten times the effort to automate stuff and customize things for their clients. I mean there is a reason why Linux is the market leader for any kind of serious behind-the-scenes computer stuff. But yeah, there's enough abstraction layers in-between. The end-users would probably get pretty much the same service. Maybe at a slightly different price point. And it sometimes has an effect on IT infrastructure at work. You'd either get a more traditional workspace or Office365 and cloud only.

[-] arty@feddit.org 1 points 1 month ago

Even if so, discussing dead things could be interesting as well 🦖️

[-] BCsven@lemmy.ca 1 points 1 month ago

In one way it is a simpler task to fix a single tool, than update a bunch of complex tools that suffer a problem.

BUT this was before the GIT method of pulling changes into a main branch, so maybe nowadays it doesn't matter as much as their is much less effort updating a bunch of tools for a problem, than manually editing and recompiling.

Srill when we talk to users about our software use we alsways recommend using as much out of the box functions to get done what you need, rather than coding new tools for the Open API. Because a software update (should) fix all your workflow and automation that you have leveraged, rather than recoding dozens of apo addons.

load more comments (1 replies)
[-] nik282000@lemmy.ca 1 points 1 month ago

Qualification: I am a certified moron, I used nano as my IDE for 8 years because I did not know about VS code. I still structure my python like the qbasic I learned in school. I have never mastered object oriented thinking.

Write your scrips one chunk at a time, make them modular, make intermediate scripts if you have to, and have each part output a data structure that you nail down early in the project. Having a ass-load of little parts chained together means you can tweak or entirely replace tools at a later date without fucking the whole process.

If your project is a monolithic do-all be-all monster it means even the tiniest change involves reevaluating your entire codebase. You're giving yourself all the problems of cuckcoding with none of the time savings.

[-] slacktoid@lemmy.ml 3 points 1 month ago

Hey get a load of this guy says he can't "code" but then lays out (actual) practical advice for coding.

[-] nik282000@lemmy.ca 1 points 1 month ago

My github account is a warcrime, everything I know I have learned from running Debian, reading wiki's, and stealing code from stack overflow.

[-] slacktoid@lemmy.ml 3 points 1 month ago

Yeah, that's how you learn tho. I think all of us have just done that and you can get pretty good with just that. And that pipeline of functions thinking

[-] arty@feddit.org 1 points 1 month ago

Many commenters assume I propose do-all be-all monsters. Looks like I failed to explain my idea of custom-made programs for specific use-cases.

[-] nik282000@lemmy.ca 1 points 1 month ago

Writing a tool that does only one thing looks like avoiding the most complicated task. Which leads to a conclusion that the Unix way only works well in a rather small fraction of use cases; the majority of cases are better served by different approaches.

The alternative to do-one-thing is do-lots-of-things.

Users very often need results that can only be achieved after doing several things. With only single-purpose tools at hand, users have to integrate them. In other words, the tool authors delegate integration to the users.

You describe a need for all-singing, all-dancing solutions over single use tools.

[-] arty@feddit.org 1 points 1 month ago

You know there are colors beyond black and white? There’s a spectrum of alternatives.

I’m arguing for a little more singing and a little more dancing well-integrated solutions. Like the -delete parameter to the find tool is the step in the right direction. Or do you think that this parameter is superfluous and good old rm is perfectly fine?

[-] nik282000@lemmy.ca 1 points 1 month ago

You're gonna think I'm a asshole but, chaining find and rm seems like the best way because you get to keep all the options of rm instead of having only the less flexible option of -deleting every match.

[-] arty@feddit.org 1 points 1 month ago

Have you considered the reasons this option was added despite this seemingly obvious fact?

load more comments (4 replies)
[-] iusemybrain@sh.itjust.works 1 points 1 month ago

Just so you know, the byproduct of over integrating technology systems is how monopolies are formed. By implementing tools to only do specific functions, it is fighting against monopolistic power. That is what the "Unix way" is describing.

In essence people are predictable. If people have a google home in their house, they will most likely be using google for email, searching, and messages, and its all tightly over integrated (IE: the home has access to the email, to the messages, and it integrates it into a single device). For me, I dropped google a few years ago. For other people, they may depend on google services more often, so it isn't just painstakingly forwarding your new email address to applications, they'll also loose the integration as well that comes with google.

Generally speaking, to combat technology monopoly's you want to diversify your applications. You basically want to make a system so complicated no one single software has control over it aka a decentralized system. Octave is a decentralized system, in that packages are developed by members in the octave community. Octave integrates those packages in a server but octave doesn't have control over those packages. Linux, delta chat, lemmy, mastodon, these are all uniquely decentralized systems with all of them inadvertently following the "Unix way."

[-] arty@feddit.org 1 points 1 month ago

Before getting to overly integrated technology we first must take a step from the completely disjointed technology. I’m arguing for the first steps, not for going all the way to the other extreme.

[-] vi21@lemmy.ml 1 points 1 month ago* (last edited 1 month ago)

A data pipeline commonly has three phases: extract, transform, and load (ETL). The Unix philosophy of "do one thing well" can apply here by making each program handle only one ETL phase; for example, a program that only extracts data. This strategy works well whether orchestration is done with a shell script or with a Python-based de facto tool such as Apache Airflow. In contrast to mixing ETL within a single program, Airflow and shell scripts using GNU Parallel can handle retries, concurrency, logging, etc. Data pipeline engineering is not a rare case. Still, other kinds of applications, such as GUI, TUI, and web apps, are rarely built on shell scripts; however, shell scripts may work behind the scenes for many apps. Moreover, "do one thing well" still applies, but the unit may be a function, module or service instead.

[-] arty@feddit.org 1 points 1 month ago

In contrast to mixing ETL within a single program, Airflow and shell scripts using GNU Parallel can handle retries, concurrency, logging, etc

Am I reading your message wrong? It appears to say that a single program cannot handle retries, concurrency, logging, etc.

[-] vi21@lemmy.ml 1 points 2 days ago

Yes, you got it wrong.

load more comments
view more: next ›
this post was submitted on 25 Oct 2026
39 points (95.3% liked)

Linux

69022 readers
350 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS