Shell, Terminal, Console, GUI

  • Thread starter fog37
  • Start date
  • #26
FactChecker
Science Advisor
Gold Member
6,375
2,519
The OP should have been a little more specific. To me, a terminal and a console are hardware. A terminal window and a shell are software. It is hard to say that any hardware is the same as software. If the words are used as adjectives, it depends on what the entire phrase is. If "terminal" is being used as an abbreviation for "terminal window", that may explain to me why I have been talking at cross purposes to others in this thread.
 
  • #27
1,252
84
The OP should have been a little more specific. To me, a terminal and a console are hardware. A terminal window and a shell are software. It is hard to say that any hardware is the same as software. If the words are used as adjectives, it depends on what the entire phrase is. If "terminal" is being used as an abbreviation for "terminal window", that may explain to me why I have been talking at cross purposes to others in this thread.

Thanks FactChecker. I think there is no confusion anymore on my end on the fact that a physical terminal is a machine with no resources or computational power which just serves as an interface to connect to a computer to use its computational resources.

Yes, I am focused on software definitions. Sorry I wasn't clear enough.
 
  • Like
Likes FactChecker
  • #28
FactChecker
Science Advisor
Gold Member
6,375
2,519
Yes, I am focused on software definitions. Sorry I wasn't clear enough.
Sorry. Maybe that should have been obvious to me, but it never occurred to me at all. Old age, I guess. :-)
 
  • #29
pbuk
Science Advisor
Gold Member
2,352
1,088
Thanks everyone. Just to summarize...
Oh dear, I think that things have become rather confused. Above all, I think you need to stop trying to fit these things into rigid boxes, they won't fit and this will just lead to frustration and confusion. To pick up on some of the confusion:

Thanks everyone. Just to summarize, broadly speaking, there are two types of software:
No, there are many types of software.

  1. system software (operating system (same as the kernel), device drivers, utility software)
The term 'operating system' normally includes more than just the kernel.

  1. application software (Python, Word, Photoshop, etc.)
Python is not an application in the same sense as Word and Photoshop. And where do things like databases, and web servers fit in this categorisation?

Software is often depicted in multiple layers, but the number and nature of the layers depends on the context, trying to nail a fixed definition to the wall is pointless.

  • Shells are interactive programs that make interacting with the kernel (i.e.OS) easier and provide a environment and interface for programs to use. For example, the same shell can be used to run Python or another interpreter.
No, applications don't generally use a shell, they interact directly with the OS (but not with the kernel, the OS will generally have one or more layers between its API and the kernel (API = Application Program Interface, the layer which applications communicate with - note that this term has different meanings in different contexts as well).

In general, is it correct to say that shells run interpreters?
No. You can use a shell to start an interpreter application, but there are other ways of starting applications, and other applications that can be started from a shell.

Is an interpreter any program converting user commands into instructions for the OS?
No.

Does every application program have to have an interpreter running under the hood every time the application is running?
No.

For example, when using a word processor, we don't need to run a shell. But is there an interpreter running somewhere?
Not for any word processor you are likely to come across in 2021 (I seem to remember something that ran on BBC Basic back in the 80s or am I imagining that?)

Which application programs are designed to always need a shell to run?
None that I know of.

Programs like Photoshop, etc. are executable files that we can launch by either clicking on an icon or by typing a command inside a shell.

In sequence:
user uses the shell -> the application program is run and interacts with the shell -> shell interacts with the OS/kernel (via the interpreter?)
No, see above.

Terminal vs Shell: the Terminal in Macs is an application that users use as the command line. The Terminal app is just a window and a shell runs inside of it automatically.
No, on a Mac (and most other *nix-like OSs with a GUI), the terminal app is a GUI application that accepts keyboard input and directs it to an OS stream and receives data from an OS stream which it displays as text characters within a GUI window. In most cases, the terminal app will connect its stream to the default shell and so to the user there the fact that the terminal process is distinct from the shell process is not significant.

The shell is a command-line program accepting inputs and displaying outputs.
'Command line program' doesn't mean anything here, and as above the shell (in a Mac) doesn't actually display anything, it just writes to a stream; the terminal program reads from the stream and displays it.

Terminal is not a shell but it allow us to interact with a shell. In Mac computer there are many shells to choose from (bash, csh, etc.).
This is true in a Mac or Linux context but not in many other contexts, particularly Windows.

In Windows, the two most common ones are cmd and powershell...
As stated somewhere above in both cmd and powershell there is only one application that is both 'shell' and 'terminal'.
 
  • Like
Likes lomidrevo and PeterDonis
  • #30
pbuk
Science Advisor
Gold Member
2,352
1,088
In summary, we have come full circle to the point I was trying to make in my first two posts in this thread (which have now been deleted).
Summary:: understand the difference between shell, console, terminal
These words can be used to describe completely different things, and they can also be used to describe exactly the same thing so there is no meaningful general answer to this question.

Edit: if you are still confused, I will repeat these words from the official Ubuntu tutorial:
The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names, it can give the appearance of being complex and confusing to use.
 
Last edited:
  • Like
Likes lomidrevo, glappkaeft and Vanadium 50
  • #31
jbriggs444
Science Advisor
Homework Helper
9,955
4,554
Btw, for those of us old enough to remember dialup connections, "terminal" was also used back then to refer to the application that you used to manage dialup connections. Early versions of Windows even called that application "Terminal".
Some of us old dudes would use "terminal" to refer to the physical keyboard/display unit that sits at the end of a terminal connection. The connection traditionally being RS-232c or 50 ma current loop. [Or 110 baud acoustic coupler when I was first learning]. The terminal being something like a VT52, VT100, ASR33 or LA120.

The "console" is then the specific terminal that is plugged into the console port which is where the computer displays critical error messages, accepts boot time commands and, perhaps, run time interrupts. For instance, halting the computer for everyone by hitting control-P on the console terminal.
 
  • Like
Likes FactChecker
  • #32
FactChecker
Science Advisor
Gold Member
6,375
2,519
  • In general, is it correct to say that shells run interpreters? Is an interpreter any program converting user commands into instructions for the OS? Does every application program have to have an interpreter running under the hood every time the application is running? For example, when using a word processor, we don't need to run a shell. But is there an interpreter running somewhere?
Just to clarify the interpreter. An interpreter can work on each command as it is typed in by the user. That allows great flexibility for the user, who can see the results of one command before he decides what to do next. But the process of interpreting slows things down, and the user can make errors. If a programmer already knows what he wants a program to do from beginning to end, he can compile and link the program into an executable program. That allows the executable to run much faster every time without interpreting the original program each time, and often without needing constant interaction with the user. It might also reduce user errors in a repetitive process that might be tricky to get right every time. So there is a trade-off between the interpreter's step-by-step flexibility and the executable's speed and repeatability. Each has its place.
 
  • #33
1,252
84
Just to clarify the interpreter. An interpreter can work on each command as it is typed in by the user. That allows great flexibility for the user, who can see the results of one command before he decides what to do next. But the process of interpreting slows things down, and the user can make errors. If a programmer already knows what he wants a program to do from beginning to end, he can compile and link the program into an executable program. That allows the executable to run much faster every time without interpreting the original program each time, and often without needing constant interaction with the user. It might also reduce user errors in a repetitive process that might be tricky to get right every time. So there is a trade-off between the interpreter's step-by-step flexibility and the executable's speed and repeatability. Each has its place.

thanks FactChecker. So what kind of software programs generally need the assistance of an interpreter? Those programs that are run through a shell?

As mentioned, a word processor is a different type of software than Python whose purpose is to run Python code...
 
  • #34
jbriggs444
Science Advisor
Homework Helper
9,955
4,554
thanks FactChecker. So what kind of software programs generally need the assistance of an interpreter? Those programs that are run through a shell?

As mentioned, a word processor is a different type of software than Python whose purpose is to run Python code...
Essentially no software programs require the assistance of an interpreter. Word processors, spreadsheets, email programs, complex numerical applications, video games, flight control programs, etc. They can all run standalone. They will typically use operating system API's directly.

The exception to this rule are things like shell scripts. Roughly speaking, these are sequences of commands that a shell can execute.

e.g.

Code:
$ cat zonedump.sh
#!/bin/bash
/opt/nwreg2/local/usrbin/nrcmd <<EOD > zonelist.tmp
zone listnames
EOD
egrep "\.$" zonelist.tmp | awk '{print "./dumpzone.sh ", $1}' > zonelist.sh
. zonelist.sh

$ cat dumpzone.sh
$!/bin/bash
dig @127.0.0.1 $1 axfr | grep $1 | grep -v ";;" | sort -u > zones/${1}dump

One could argue that things like Basic programs, Perl scripts, Python scripts, Java applets, etc need a Basic interpreter, a Perl interpreter or a Python interpreter or a Java run time environment, etc in order to be executed.

In the Unix environment, such programs are identified by a stylized first line that identifies the program that needs to be used to run them. In the above example, those two scripts need to use the bash shell which lives in /bin/bash.

For a Perl script, one might have...

Code:
$ head /usr/local/scripts/imac-add.pl
#!/usr/bin/perl
#
# imac-add.pl -- process an IMAC add or rediscover
#
# Usage: imac-add.pl hostname ip > cnrcommands.txt
[...]

In other environments, different approaches are taken to activating the needed support environment. For instance, in Windows, the Registry records what application is to be used then "opening" a file with a particular extension. So Perl might be automatically activated when invoking a program with a .pl extension.
 
Last edited:
  • #35
FactChecker
Science Advisor
Gold Member
6,375
2,519
thanks FactChecker. So what kind of software programs generally need the assistance of an interpreter? Those programs that are run through a shell?

As mentioned, a word processor is a different type of software than Python whose purpose is to run Python code...
There are trade-offs and a large gray area in between. In general, I prefer interpreted languages when I am developing a process/algorithm and want to see the results of intermediate steps. That allows me to correct mistakes and decide what to do next. This is especially true if I do not think that I will need to repeat that exact process often enough to make an executable program.
Suppose I have a process that will be repeated and the steps are tricky. Once I think that I have the correct sequence of commands, I would usually put them into a script in that same language and run the script through the interpreter for future runs.
Now suppose the process is one where the interpreted language is too slow. A compiled executable has a distinct advantage there. It does not need to reinterpret the code every time. It can also do a lot more optimization of the process because it knows the entire sequence of steps from beginning to end and can do a lot of smart things to speed up the process. If that is true, it would be worthwhile to convert the program to a compilable language.
The decision of which language to use can get blurred. There has been a lot of work to improve the speed of interpreted languages and to allow them to make compiled versions or partially compiled p-code. But I am not aware of any interpreted language that can achieve the speed of optimized executables from C, C++, Fortran, etc. unless they are also compiled and optimized.
 
  • #36
anorlunda
Staff Emeritus
Insights Author
9,586
6,663
To further muddy the waters, there are many cases where a program can be interpreted, or compiled into an executable. Same program, user's choice, independent of language. There have even been a few FORTRAN interpreters.
 
  • Like
Likes FactChecker
  • #37
1,252
84
Yes, as a beginner in coding, I am familiar with compiled, interpreted, and hybrid computer languages.
Either way, a compiler or translator is simply a program that translates high-level instructions into machine readable instructions.
This whole discussion started in my head when I pondered if other programs (applications like Word, Photoshop, etc.), besides the simple Python programs I am writing, needed an "interpreter" and a shell too to operate...

So here we are :)
 
  • #38
PeterDonis
Mentor
Insights Author
2020 Award
34,702
12,888
The exception to this rule are things like shell scripts. Roughly speaking, these are sequences of commands that a shell can execute.
One could argue that things like Basic programs, Perl scripts, Python scripts, Java applets, etc need a Basic interpreter, a Perl interpreter or a Python interpreter or a Java run time environment, etc in order to be executed.

And similarly, a shell script needs a shell interpreter in order to be executed. In other words, as I pointed out a number of posts back, a shell program like bash is an interpreter.

This whole discussion started in my head when I pondered if other programs (applications like Word, Photoshop, etc.), besides the simple Python programs I am writing, needed an "interpreter" and a shell too to operate...

Programs in languages like Python do not need a shell in order to operate, they just need the Python interpreter. Don't be confused by the fact that you can start an interactive session with the Python interpreter from a shell prompt; while the Python interpreter is running, the shell program (bash, for example) is just sitting there doing nothing; the Python interpreter doesn't need the shell to run Python code.
 
  • #40
pbuk
Science Advisor
Gold Member
2,352
1,088
Essentially no software programs require the assistance of an interpreter.
The code that runs this website requires an interpreter, as does the code that runs Wikipedia, WordPress.com, parts of Twitter, Facebook and Google apps, GitHub...
 
  • #41
PeterDonis
Mentor
Insights Author
2020 Award
34,702
12,888
Not all interpreters can do that

Can you give examples of ones that can't?

The code that runs this website requires an interpreter

Can you clarify what code you are referring to?
 
  • #42
pbuk
Science Advisor
Gold Member
2,352
1,088
Can you give examples of ones that can't?
The standard implementation of Perl, the JavaScript interpreter in some web browsers, most 'traditional' (i.e. with line numbers) versions of BASIC, PHP in some environments.

Can you clarify what code you are referring to?
The forum software XenForo which is written in PHP.
 
Last edited:

Related Threads on Shell, Terminal, Console, GUI

  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
9
Views
4K
  • Last Post
Replies
2
Views
2K
Replies
3
Views
881
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
5
Views
5K
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
5
Views
6K
F
Top