- #1
fog37
- 1,568
- 108
- TL;DR Summary
- understand the difference between shell, console, terminal
dkdkd
PeterDonis said:@fog37 you appear to be confusing yourself by getting hung up on terminology that actually isn't even relevant.
The Python interpreter is a program. Specifically, it is a program that interprets and runs Python code. The Python code can be contained in a file, or it can be typed in by the user in an interactive session.
IDLE is a program. Specifically, it is a GUI program that runs an interactive session with a Python interpreter, and adds some other bells and whistles.
What you are calling the "Windows command line interface shell" could be two things, either the "Command Prompt" program or Powershell. Those are two different programs that allow you to do a bunch of things (but a different set of things for each program) by typing commands at their prompts; a fair number of those things do involve "communicating with the OS", yes. However, both of them include, in the things they allow you to do, running programs by typing their names at the prompt (and many things that you are thinking of as "communicating with the OS" are actually just running programs by typing their names, where the programs do some kind of communication with the OS, but there is no requirement that all programs whose names you type in do things like that).
"python" is the name of a program, the Python interpreter; typing its name at the command prompt starts an interactive session with the interpreter.
fog37 said:I guess the term "interpreter" is used for programs that sit in the middle between the user and the operating system.
anorlunda said:For example, the Shell script in Unix interprets command lines and runs programs.
But it can also mean the same as a shell or terminal, e.g.FactChecker said:A console is the hardware that commands can be entered at a keyboard and printed computer output displayed.
console.log('This is displayed in the console (if you have it open)');
But it can also mean the same as a shell or console, e.g.FactChecker said:A terminal (see correction) is the logical device that allows a program to read/write to a console keyboard/display.
https://ubuntu.com/tutorials/command-line-for-beginners said:The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names...
Wrong. A shell is not a console or terminal. There is the Bourne shell, the Korn shell, the C shell, the Bash shell, and others (see e.g. https://en.wikipedia.org/wiki/Bourne_shell )pbuk said:But it can also mean the same as a shell or terminal, e.g.
But it can also mean the same as a shell or console, e.g.JavaScript:console.log('This is displayed in the console (if you have it open)');
No.Want to take your skeptical back now ?
Yes, these are all examples of the use of the word 'shell' - there is also theFactChecker said:There is the Bourne shell, the Korn shell, the C shell, the Bash shell, and others (see e.g. https://en.wikipedia.org/wiki/Bourne_shell )
No.
They are all the type of thing that is referred to by the term"shell" in the world of computer programming. I have never seen "shell" used to refer to a terminal or a type of terminal and I would consider it an incorrect use of the word.pbuk said:Yes, these are all examples of the use of the word 'shell' - there is also thePS4 console, the Nintendo console, an electrical terminal, a ferry terminal, GNOME terminal, KDE Konsole, Windows Powershell etc. but I don't think this is relevant here.
My point is that shell, terminal, console, prompt, command line, cli etc. can all be used to refer to the same thing.
FactChecker said:I do not know if this is the common interpretation.
FactChecker said:Wrong.
FactChecker said:I would consider the use of "shell" to refer to a terminal as incorrect. Do you think that use is common?
Good point. Just to be clear, the console is the hardware with the keyboard and display. The term "terminal" might refer to the console or to the tty driver software that receives the typed input. A person might say input at the console or terminal without distinguishing between the two. On the other hand, a "shell" provides a command user interface to the operating system. It is software. It is not a specific application like a text editor or a spreadsheet. If a person says "Type xxx to the shell", he is implying that an 'xxx' typed at the console keyboard is going directly to the shell software, rather than to an application like a word processor.PeterDonis said:No, but the use of "terminal" to refer to the shell program that is running instead of to the hardware keyboard + monitor is not uncommon. ("Terminal" is also used in Unix to refer to the tty driver that the shell gets its standard input and output from, which might not even correspond to a physical keyboard + monitor.) And that usage is what @pbuk was referring to in the quote you called "wrong".
FactChecker said:the console is the hardware with the keyboard and display
FactChecker said:a "shell" provides a command user interface to the operating system
FactChecker said:It is software. It is not a specific application like a text editor or a spreadsheet.
FactChecker said:If a person says "Type xxx to the shell", he is implying that an 'xxx' typed at the console keyboard is going directly to the shell software, rather than to an application like a word processor.
When a person says "Type 'xxx' to the shell", he means it is going to the shell. When he says "Type 'xxx' to the text editor", he means it is going to the text editor. When he types "Type 'xxx' at the terminal." it is context-dependent on where it is going. It could be going to the shell, a text editor, or to many other software applications. A terminal is not a shell, or a text editor.PeterDonis said:A shell is an application like a text editor or a spreadsheet.
FactChecker said:When a person says "Type 'xxx' to the shell", he means it is going to the shell. When he says "Type 'xxx' to the text editor", he means it is going to the text editor.
FactChecker said:When he types "Type 'xxx' at the terminal." it is context-dependent on where it is going.
FactChecker said:A terminal is not a shell, or a text editor. Period.
PeterDonis said:the term "terminal" can be used to refer to the shell, i.e., to a particular type of application, as has already been pointed out in post #14
FactChecker said: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.
Sorry. Maybe that should have been obvious to me, but it never occurred to me at all. Old age, I guess. :-)fog37 said:Yes, I am focused on software definitions. Sorry I wasn't clear enough.
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:fog37 said:Thanks everyone. Just to summarize...
No, there are many types of software.fog37 said:Thanks everyone. Just to summarize, broadly speaking, there are two types of software:
The term 'operating system' normally includes more than just the kernel.fog37 said:
- system software (operating system (same as the kernel), device drivers, utility software)
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?fog37 said:
- application software (Python, Word, Photoshop, etc.)
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).fog37 said:
- 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. 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.fog37 said:In general, is it correct to say that shells run interpreters?
No.fog37 said:Is an interpreter any program converting user commands into instructions for the OS?
No.fog37 said:Does every application program have to have an interpreter running under the hood every time the application is running?
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?)fog37 said:For example, when using a word processor, we don't need to run a shell. But is there an interpreter running somewhere?
None that I know of.fog37 said:Which application programs are designed to always need a shell to run?
No, see above.fog37 said: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, 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.fog37 said: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.
'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.fog37 said:The shell is a command-line program accepting inputs and displaying outputs.
This is true in a Mac or Linux context but not in many other contexts, particularly Windows.fog37 said: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.).
As stated somewhere above in both cmd and powershell there is only one application that is both 'shell' and 'terminal'.fog37 said:In Windows, the two most common ones are cmd and powershell...
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.fog37 said:Summary:: understand the difference between shell, console, terminal
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.
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.PeterDonis said: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".
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.fog37 said:
- 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?
FactChecker said: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.
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.fog37 said: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...
$ 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
$ 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
[...]
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.fog37 said: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...