Are the "shell" and the "terminal" the same thing?

Discussion in 'Mac Programming' started by kdum8, Oct 27, 2008.

  1. kdum8 macrumors 6502a

    kdum8

    Joined:
    Sep 8, 2006
    Location:
    Tokyo, Japan
    #1
    I am clearly new to mac programming and mainly teaching myself.
    So I know what a shell is; and I know what the terminal is. They seem to be synonymous. Is this correct?
     
  2. costabunny macrumors 68020

    costabunny

    Joined:
    May 15, 2008
    Location:
    Weymouth, UK
    #2
    Pretty much yes

    Terminal is used to refer to shell access. (there are different versions of the shell aka. Bash, Ksh, sh Ash etc but commonly Bash seems popular) You can find a Wiki page on different shells and what they do.
     
  3. MikeDTyke macrumors 6502a

    Joined:
    Sep 7, 2005
    Location:
    London
    #3
    Correct, though in mac circles 'terminal' seems to refer more to the terminal.app application rather than the session.

    M.
     
  4. kdum8 thread starter macrumors 6502a

    kdum8

    Joined:
    Sep 8, 2006
    Location:
    Tokyo, Japan
    #4
    I see, so if you were using other CLI software (and not the terminal.app program) then you might refer to that other software as a "shell" in macland?
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    I would say the shell is the program running that provides shell facilities. Examples would be bash, ksh, zsh, and, of course, plain old sh.

    Terminal.app simply provides an IO wrapper for the shell program. You could use other wrappers, but the shell would be basically the same.

    Edit to add: sorry, matscotted the thread: costabunny already said all this :eek:
     
  6. Berlepsch macrumors 6502

    Berlepsch

    Joined:
    Oct 22, 2007
    #6
    In the olden days of Unix and other mainframe computers, people were usually using "terminals" to connect to the workstations via the network or through modem connections. These terminals were just a keyboard and a monitor for text output. The terminals usually had a fixed command set for displaying text and for transmitting keyboard commands. There were a number of different command set used, e.g. for the DEC VT100 or IBM 3270 terminal.

    Once you connected to the workstation through a terminal, you usually opened an interactive program, or "shell" in Unix terms. If you had a task to do that needed a longer time to finish (and 15 or 20 years ago that was quite common), you set it up as a batch job and closed the shell, so that someone else could use your terminal.

    The "Terminal.app" in Mac OS, just like "Xterm" under X11, is technically an emulator for those ancient computer terminals. You can even influence some VT100 related settings in the preferences and choose which kind of shell to run.

    So, historically, terminal and shell are seperate things, but nowadays we nearly always use them together.
     
  7. kdum8 thread starter macrumors 6502a

    kdum8

    Joined:
    Sep 8, 2006
    Location:
    Tokyo, Japan
    #7

    Thanks, that is a very good explanation. :eek:
     
  8. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #8
    No. They are not the same thing. A shell is a program that accepts commands and executes them. It is a kind of interpeter. It can read commands from either the user as he types or from a file.

    The terminal is a software emulation of a physical device. In the past there were real "terminals". These had CRTs and keyboards and connected to a computer with a serial cable.

    The shell reads commands from the terminal and prints it's results back to the terminal but other programs can do this as well. For example the "Hello World" program prints to the terminal.

    Technicalls the shell reads and writes to "standard input" and "standard output". When the shell process is created it's "standard input" and "standard output" are by default connected to a terminal, but this need not be the case. For example when you run a shel script the shell process' standard input is connected to a file.
     
  9. AlmostThere macrumors 6502a

    #9
    Or accepts commands in the form of mouse clicks. Both Finder and Windows Explorer are shells for their respective operating systems.
     

Share This Page