0

As for now, I use my CLI (Command Line Interface) with either rbash, bash, dash, or sh. Given this fact, one can assume that the CLI is not shell dependent, and that even if we will delete all of these shells, we could use some primal/basic/ultralimited CLI.

My question

If I delete all the aforementioned shells in my GUIless operating system, will I still have a primal CLI of some sort?

Notes

  • I assume that that CLI won't be part of the kernel, because as I understand, the kernel is usually accessible only via proxy, like a shell).

  • I was thinking about tmux and screen too but removed them from the headline and the question.

6
  • 1
    "Given this face, one can assume that the CLUI is not shell dependent" ok... "that even if we will delete all of these shells, we could use some primal/basic/ultralimited CLUI" how does that follow?
    – muru
    Nov 14, 2017 at 9:54
  • It follows that you use each of these shells on the same CLI (or thus it seems to me), so I can carefully assume that if you delete some or all of them, the CLI on which you work with them - stays the same. Nov 14, 2017 at 10:44
  • "Even if we will delete all of these shells, we could use some primal/basic/ultralimited CLUI": no. When you type a command there must be some program which reads it, parses it, and calls execve() to run the program to be invoked. That some program which does this is called a shell. If there is no shell you cannot type any command because there's nobody to read and interpret it. And the function of tmux and screen is entirely different and completely separated for the function of sh and bash; they are not needed for normal system operation.
    – AlexP
    Nov 14, 2017 at 11:41
  • I fully understand what you say there AlexP - No program to process it (read, parse, and call execve()), but I'm asking only about having a CLI to type anything in, even if I can't run it. Will I still have a CLI by itself? I would bet that I won't, but I just try to figure out if an (impotent) console would still be there without these particular shells. Nov 14, 2017 at 11:44
  • You can boot up into a GRUB command line and have a CLUI without Linux. Get your head around that one! ;-)
    – Time4Tea
    Nov 15, 2017 at 3:25

2 Answers 2

7
+50

No. Your premise that these different shells are all running on top of some more basic CLUI, because they are all fairly similar, is incorrect. Each shell is separately implementing a CLI interface to the kernel, which all look somewhat similar (because they are all 'Unix' shells, which conform more or less rigidly to an accepted standard, and they all run on the same sort of terminal device). The CLUI is coded into each shell program separately - they are all independent and are not sharing some underlying CLUI.

If you delete all the shells, then you will have no CLUI. That makes Tux cry :(

2

There are two answers yes and no:

No

If you delete the shells, then the system will stop working. The shell is used a lot, for some very important things. For example, but in no way limited to: the login program will be launched by a shell script (everything else is also launched by a shell script, the shell used for this is usually sh). Therefore you can not login, if there is no shell. Even if you login to a non-shell environment.

Yes

As you have identified there are different components:

  • A kernel (e.g. Linux, BSD kernel, cygwin),
  • a virtual terminal / terminal emulator (e.g. konsole, xterm, linux consoles),
  • a multiplexer (e.g. screen, tmux),
  • a shell (e.g. bash, dash, csh, programs that run in the shell (e.g ls, grep).

You can change any of these, and use them in different combinations.

4
  • But is this shell that contains the login script sh? I would assume it is indeed sh. Thus, we can say that at least in Linux as we know it, the terminal emulator or console, is dependent in the (sh) shell, but if would have taken the login script out of sh, than the console would no longer depend on it. Nov 15, 2017 at 3:13
  • What’s a login script? Oh and the answer here is somewhat incorrect: login is handled by login, which is started by getty, which is started by init (or slight variants on systemd), no shell involved. The shell is typically involved in running boot scripts, but it doesn’t have to be. Nov 15, 2017 at 6:27
  • 1
    @StephenKitt I did not say “login script”, though I was quoted as saying it in the above comment. What I said is there may be a script that calls login. If not then init will probably use a shell elsewhere. Nov 15, 2017 at 9:24
  • @ctrl-alt-delor yeah my question was addressed to the OP mainly. You’re right that the shell does end up being used to boot a system, although it doesn’t need to be. The OP appears to be rather confused about the whole shell business, I’m trying to un-confuse things by focusing on the essential... Nov 15, 2017 at 9:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .