Explaining more on this question. Are commands like ls, cd, rm,... applications if they are than how does the terminal knows where they are, and is the terminal just a interface to interact with the programs, is nothing more than just programs just interacting with each other? Secondly, Is bash the only language that will work in the terminal, if it is just programs just interacting with each other?
closed as too broad by belacqua, Braiam, terdon, guntbert, waltinator Jun 15 at 1:01
There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.
The terminal can be used to execute programs within a given PATH - you can find it by running
This is set when the terminal starts - when it using using the BASH shell (default on lots of Linux systems), it checks
With my example
The terminal is an interface in which you can type and execute text based commands. It can be much faster to complete some tasks using a Terminal than with graphical applications and menus. Another benefit is allowing access to many more commands and scripts.
A common terminal task of installing an application can be achieved within a single command, compared to navigating through the Software Centre for example.
See this post for more information.
doing a "ps -ef" you can see all the process, including the terminal processs:
just "ps" alone, you see your own terminal only:
See "pts/0"? Go to /dev/pts:
Here u can see I have 0, 1, 2 ==> 3 terminal created. "gnome-terminal" is implemented as a process that open stdin, stdout, and stderr on the same character device as listed above. First, notice the pid 2974 for "bash" above? Go to /proc/2974/fd to see all the file descriptor opened:
So that means all input/output/stderr for bash comes from the /dev/pts device drivers.
If you open up multiple gnome-terminal, and depending on which one is the foreground process, the actual keyboard will be redirected to that corresponding process. ie, if you do a "
So that is how a terminal worked in general: reading character by character, and outputting character by characters simultaneously (call "echoing") to the screen at the same time. Multiple terminal can be running at the same time, but only one will be getting direct keyboard input, others will block at read() API.
Terminal opens in the default shell interpretor defined in /etc/passwd. /etc/shells file defines the other shell interpretors available with your Ubuntu distro, there are some others zsh for one. The shell can execute the programs of other programming languages but are seldom used as an actual programming language like C++, python, ruby and so on.
The shells do provide access to builtin commands, scripts and applications and will execute the many various programs written in other programming languages,as well as, providing access to the many builtin commands avaialble in Linux, provided the appropriate language dependencies are available in your install.
Shells are mostly alike with some differences in commands and syntax but bash is the default and most shell scripts which are readily available are written in the bash syntax.
Other shells, sh=Bourne shell, bash=Boure again shell, pdksh=public domain korn shell, zsh=z shell, csh=c shell, ksh=korn shell, and several others. Each having their own flavor of syntax and commands, completion, expansion. But all have one thing in common, their primary function is to allow access to controlling, managing, monitoring and general administration of Linux and Ubuntu.
I think most of the things are answered. I just want to add.
You can run any application from the terminal. Even the non-terminal (Application Like Chrome / firefox) will run from terminal.
To run any application, user have to know the file path of that application and call the application using that file location. for example
but for user convenience, PATH is defined. and application from those paths can be called without calling the the full path. that's why you can run these commands:
You can write your own shell-script and run it on the terminal. And you can write program, using any programming language (C, C++, python, Java, Objective-C, PHP), it can be run in the terminal. each programming language has it's own way to show output and take input and building-running it self.
technically, programs does not interact with each other. all the program request OS, OS interact with all. (OS means Operating System, Ubuntu / Windows / OSX etc.)
For example. You want to upload a file using firefox. when you click a upload button on a site. firefox will requested to OS for a file manager application. File manager will take your choice and send the file location to OS >> Firefox. Firefox will upload the file by requesting OS for use other applications.
Now you can say, OS is a program too. So, programs do Interact with each other!!