Recently I got really interested in debloating and hardening my operating systems, cause I’m heavily inspired by Unix and “worse is better” philosophy. As I heard bash is heavy and we have much more lightweight and faster alternatives like these mentioned in title. They must be great alternative for scripting and interpreting but is there any reason to use them on my machines as interactive shell? Anyone are using them? Also is it worth to learn them as bash is standard IT industry?

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    6
    ·
    8 hours ago

    Debloating a system for a tiny appliance device is worth it. Debloating on a machine with a modern processor, 16-64 GB ram and a TB harddrive is not necessary. You may not even notice a difference.

    But if you enjoy that stuff, go for it.

    I have only used KSH for a proprietary software install that needed it, it didn’t feel much different than working in a BASH shell.

    • blackbrook@mander.xyz
      link
      fedilink
      arrow-up
      5
      ·
      7 hours ago

      The question is what does OP mean by 'heavy’and what benefit do they hope to get from a ‘lighter’ shell. Memory or performance seems inconsequential in this case, but how about attack surface? Is there some benefit from a security standpoint of running a simpler shell?

      • mlody@lemmy.worldOP
        link
        fedilink
        arrow-up
        2
        ·
        5 hours ago

        RAM doesn’t matter for me. Smaller code base is reducing attack surface for sure.

    • confusedpuppy@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      9 hours ago

      I could imagine an it would matter more to people working with embedded devices.

      Also some people just like learning or doing random things. Nothing wrong with some exploration, discovery or learning.

      • mlody@lemmy.worldOP
        link
        fedilink
        arrow-up
        2
        ·
        5 hours ago

        That’s why I’m asking that question :) A lot of discussions are on Reddit and I hate Reddit so to avoid using it I’m asking here.

  • 柊 つかさ@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    7 hours ago

    I have been using Dash for years now as bin/sh. I couldn’t manage to get rid of Bash so it’s still installed (distro is Artix). As an interactive shell I run Fish. Dash is indeed rather terrible as an interactive shell as others have said.

    • mlody@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      5 hours ago

      I don’t want to remove bash, that’s not my point. It’s hard dependency for my system. Now I understand that dash sucks as interactive shell. Maybe I’ll try fish as interactive shell just to check what it is, cause it’s popular at the moment. But as I’m forced to have bash installed and it’s great for interactive shell usage I will stick with it :)

  • pastermil@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    8 hours ago

    You do not want to use dash interactively! It is created solely for scripting and not for creature comfort. This means all the stuff you’re probably used to such as line editing and command history will not be available.

    At some point, you’d want to ask yourself how heavy is “heavy” and how much stuff are you willing to shed? Do you not need tools such as web browser, media player, or office suite? Are you willing to get rid of desktop environment?

    In the extreme, you can remove all the documentations, all the manpages to save space. You can even remove all the localization files, without which stuff would look weird, but would still run.

    Further than that, you can even customize your kernel, opting out all the drivers you don’t need, or even some that you could use (e.g. wifi, audio, hardware monitoring). Next, some kernel features that are less essential such as statistics, logging, and debugging, as well as the handling for some network protocols. If you wanna go crazy, you can enable the expert/embedded options and with that you can disable stuff that can be critical (e.g. error reporting, certain IPC feature).

    It’s a rabbit hole, really.

    • mlody@lemmy.worldOP
      link
      fedilink
      arrow-up
      2
      ·
      5 hours ago

      Web browser are the type of software which I hate the most. They’re main reason why a lot of personal computers aren’t usable anymore. Also browsing web through terminal is impossible, that’s another point for me to hate them 🤣 Of course I’m forced to use them but when I can I’m choosing alternatives like Gemini or Gopher and native apps. If I could I will not leaving terminal but as I need it for few GUI apps I’m using DWM 😊 I’m planning also to learn how to compile my own kernel.

      It’s not about disk space but learning, minimalism (which I love), better security and efficient resource usage.

      I don’t care how many resources is used by program but how efficient. People are telling me that they see in their resource monitors that they systems are using a lot of RAM, mainly gamers who have 64 GB of ram and complain about 20 GB in usage by Windows. But this why they have RAM, to use it! If they don’t need it system should allocate RAM in proper way to make computer faster. Of course Windows is not good example of efficient resource allocating 😂 but I want to make my point more clear. It’s not about removing critical features to just make it run, but making my system suited for my needs and efficient as much it’s possible. So removing man pages is not related to my case as I’m using them :)

      I like to tinker and I’m learning about computers that way. I ask questions and looking for methods to optimize every part of my systems. They don’t have to be the best optimized and if will not have that many time as I have to learn I wouldn’t worry too much about it and just work on computer. I’m just aware that always we can do something better.

  • confusedpuppy@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    5
    ·
    9 hours ago

    I don’t have any answers, just my own experiences. Last year I decided to use Alpine Linux as my Operating System for a couple of self-hosted things running on a Raspberry Pi. I chose it because it’s super minimal and used less common tools (for example doas instead of sudo). That unintentionally forced me to learn how to use Linux using more basic commands that are more likely to be available on other Linux systems.

    Alpine Linux uses Busybox-Ash which is a POSIX compliant shell that’s very small and very basic. The scripts I ended up writing tend to be POSIX portable meaning that they should work on a wider variety of systems. That comes at the cost of script simplicity and readability as well as missing out on many features that make Bash scripts more complex, robust and easier to work with.

    I have a working example POSIX portable script. I’ve been adding to it all the things I’ve learned. You can check it out here if you’re interested.

    I use Alpine Linux with Sway as my daily driver but still keep a copy of Linux Mint DE ready to use because it’s nice to have a fully featured work environment for the days I don’t want to think.

    • mlody@lemmy.worldOP
      link
      fedilink
      arrow-up
      2
      ·
      6 hours ago

      Thank you for sharing with your experience! Alpine Linux as daily driver… that’s interesting. How is it in daily usage as desktop OS?

      • confusedpuppy@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        2
        ·
        4 hours ago

        It’s been a learning experience. I am pretty much building it specifically for my use so it’s missing lots of stuff that’s standard on other fully featured OS’s. I’m mostly using a browser, Konsole terminal and KDE Kate as my editor.

        I found an unexpected hobby in writing POSIX scripts because it’s teaching me the inner workings of Linux. In the future I’d like to expand that to including the sed and awk commands but I haven’t really found a project to use them with yet.

        Alpine Linux does offer a setup-desktop command/script which will easily setup a few desktop environments such as Gnome, Plasma, Xfce, Mate, Sway and Lxqt. That only sets up the basic desktop environment so a lot of other work is needed to set up things like sound, graphics and a few other things.

        As I mentioned before, I still have Linux Mint DE installed. I mostly use it for Steam games but it has everything else I need for when I don’t feel like working out a problem because I wanted to simply open a .pdf file. However, it’s still really satisfying for me setting up a very specific work environment with the mininal tools I have available.

        I think there is value in learning to work within a mininal environment to help give more life out of lower spec technology that’s currently available. Especially now with all the ram supply issues because of the AI rush.

  • Oinks@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    3
    ·
    8 hours ago

    Ignoring the interactive features (or lack thereof) in dash/ksh, removing bash is not really something that’s possible on most distros (excluding Alpine and possibly Debian) since it’s used in scripts everywhere. And if you need to have bash installed anyways, why opt for the less pleasant shell in daily usage?

    • mlody@lemmy.worldOP
      link
      fedilink
      arrow-up
      2
      ·
      6 hours ago

      I don’t want to remove bash as my operating system is using it as hard dependency, I was considering using different one. I agree with you at point - installing another shell if all what I need is bash makes my system more bloated.

  • MonkderVierte@lemmy.zip
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    1 hour ago

    I do write my scripts in POSIX sh, more for compatibility sake. But shells like dash, mksh, are not made for interactive use, they lack most not-really-convenience features.
    But heavy, that’s only invocation time; it mathers more if you do things like 100 awk calls (that one is heavy to invoke) per line you parse.

    Though i did write my own cross-shell session scripts, centering on the ENV variable which most shells understand (and a /etc/bash/bashrc loading it, since Bash doesn’t).
    Again, more because i think, why load xkb maps 3 times in 3 scripts if you can do it only once? And most session scripts look like they were never touched the last 20 years. And then a if you do it, do it right mindset.

    Worth learning; i think so. You learn, with time, more about how to use shorthands and functions, to structure your scripts nicely, instead of doing if if if messes more “convenient” shells lead you to. Which benefits you in real programming languages too and leads to more readable and better maintainable scripts.
    And the only times i miss convenience features like arrays is in 500+ loc scripts which would have better been done in python. Btw, don’t do 500+ loc shell scripts: they do become a maintenance mess even if you do everything right.

    Edit: right, i forgot the POSIXLY_CORRECT env variable. Some AUR setup-scripts have issues with a forced POSIX shell.

  • CallMeAl (Not AI)@piefed.zip
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 hours ago

    I agree with the idea of debloating and hardening your systems.

    It helps to have some context as the approach I would take depends on what kind of system I’m running. I think its also good to identify your priorities to hone your approach.

    When I want stability, fast security updates, minimal install size, I usually use Alpine which indeed uses the lighter busybox bin/sh instead of bash.

    When it comes to my workstation shell I’m more focused on utility than size. So bash or zsh or fish, or whatever you find the most useful, makes sense to use.