Wanted to have clear understanding of these terms

Wanted to have clear understanding of these terms
0.0 0

#1

What is the difference between Interpreter , Command line interpreter , Shell ,
Text editor .I use linux OS , Do terminal which is already present in it is not regarded as Shell(Bash)
I have read from many resources but i am getting confused in these terms .


#2

An interpreter is a computer program that takes instructions written in a programming language and executes them. It doesn’t take those instructions & compile them down into something else before the computer runs them, it actually interprets them them as they were written.

So a command line interpreter is a program that lets you type instructions into an interface (a terminal it’s normally called), and it interprets the commands on each line. For example, type a line cd ../, hit enter. The interpreter interprets that as you want to run a program called cd and pass the value ../ to it.
Note that a command line interpreter is a [simple] programming language that just works by executing each statement. Bash is most common on Linux systems, but there are others (Powershell for example is dominant on Windows).

A shell is the user interface for a computer. So eg Windows shell consists of the main desktop interface + start menu + task bar file system gui, Mac shell is the windowing system + finder + dock + mission control. Because you can run everything from the command line, that’s also a shell, it’s an interface to let you run the system.

A text editor is a program you use to write and edit plain text files. Eg Notepad on Windows is a text editor, there will be something almost identical on your version of Linux. Atom, Sublime Text, Notepad++, VSCode, Vim, Emacs, etc are all text editors.


#3

thank for answer! This person is not one, who is confused in THIS terms- I was too!


#4

Thanks for your time .You make it clear .


#5

These terms are sometimes used with overlapping meanings - they can be ambiguous without adequate context - I’ll take a stab at common usage for linux environments in the context of running programs on a computer

the operating system ultimately controls all execution on the computer but talking to it directly means programming with system calls and system libraries - this is not easy

An easier way to interact with the operating system is via the command line prompt - the prompt actually comes from an intermediary program called the shell - the shell understands a programming language called shell script - writing shell script is much easier than systems programming - there are different shell programs - bash, ksh and zsh are some well known shells

the shell makes use of another piece of software called the terminal to receive input and display output - a terminal can also refer to the window of a GUI program like xterm or gnome-terminal containing the shell prompt

the act of the shell translating shell script to systems programming code is called interpreting - this is why the shell is an interpreter - you can call it a commandline interpreter because it provides a command line for interactive use

here’s some shell script

if ps -ef | grep nginx; then
  echo "nginx is running"
else
  echo "nginx is not running"
fi

this shell script snippet invokes a number of different system calls and other systems apis to get info on nginx processes running on the system - it also interprets a conditional statement to print the appropriate message

the distinguishing characteristic of interpreted code is translation and execution take place on the fly in what seems on the outside as a single operation

it is similar to the characteristic that distinguishes a human interpreter from a translator - both translate one language to another but a translator has the luxury of analyzing the original text in the source language - he can choose the most idiomatic phrase in the target language - he can write down the translation and have it reviewed and edited

the human interpreter on the other hand has very little opportunity for analysis or review - the interpreter hears something in the source language and has to immediately produce a translation

javascript, perl and python to name a few are languages besides shell script that are also interpreted - each language has its own interpreter program