Wiki Ubuntu-it

Indice
Partecipa
FAQ
Wiki Blog
------------------
Ubuntu-it.org
Forum
Chiedi
Chat
Cerca
Planet
  • Pagina non alterabile
  • Informazioni
  • Allegati

Versione 146 del 25/02/2018 03.52.27

Nascondi questo messaggio


Problemi in questa pagina? Segnalali in questa discussione

Introduzione

Questa guida spiega come abilitare le shell più comunemente usate nei sistemi unix-like in Ubuntu e derivate.

Ubuntu utilizza di default la shell Bash. Pur essendo quest'ultima uno strumento molto versatile, in alcuni casi potrebbe essere utile l'uso di altre shell (ad esempio per usufruire di alcune personalizzazioni o funzionalità più avanzate, per la programmazione in C ecc.).

Per l'utilizzo della shell Bash si rimanda alla relativa guida.
Per l'utilizzo delle altre shell si raccomanda di consultare i manuali dei singoli progetti.

Definizione e chiarimenti

In informatica si usa il termine generico di shell per indicare una qualunque interfaccia che permette all'utente di interagire con il sistema. Possono quindi individuate due macro-categorie di shell, ossia:

Tuttavia, nell'uso comune, è più frequente utilizzare il termine shell per indicare soltanto la prima categoria. Sarà pertanto questa l'accezione a cui si farà riferimento in questa guida.

La shell si può pertanto definire come il programma che fornisce l'interfaccia testuale per il sistema operativo. La sua funzione principale è di leggere i comandi opportunamente inseriti nella console e di eseguirli.

The UNIX shell is most people's main access to the UNIX operating system and as such any improvement to it can result in considerably more effective use of the system, and may even allow you to do things you couldn't do before. The primary improvement most of the new generation shells give you is increased speed. They require fewer key strokes to get the same results due to their completion features, they give you more information (e.g. showing your directory in your prompt, showing which files it would complete) and they cover some of the more annoying features of UNIX, such as not going back up symbolic links to directories.

Installazione Shell più comuni

Vengono riportate di seguito le shell più utilizzate nei sistemi Unix. Ove necessario, è indicato il relativo pacchetto necessario all'installazione, presente nei repository ufficiali.

  • Bourne: the standard default shell for non root users in FreeBSD. You can read about the shell by looking at the "man sh" pages. Uses abbreviation sh.
    Si trova preinstallata in Ubuntu.

  • Korn: a shell developed by AT &T. You can read more about it by looking at the "man ksh93" pages. Uses abbreviation ksh or ksh93.
    Per abilitarla installare il pacchetto ksh.

  • Bash: The Bourne Again SHell. You can read about it in the "man bash" pages. Uses abbreviation bash.
    Si trova preinstallata in Ubuntu.

  • Z-Shell: The Z shell. You can read about it by looking at the "man zsh" pages. Uses the abbreviation zsh.
    Per abilitarla installare il pacchetto zsh.

  • C-Shell: The C shell. You can read about it by looking at the "man csh" pages. Uses the abbreviation csh.
    Per abilitarla installare il pacchetto csh.

  • TC-Shell: Basically the same thing as above. They are a little bit different, but not very much so they now fall into the same category. You can read about it by looking at the "man tcsh" pages. Uses the abbreviation tcsh.
    Per abilitarla installare il pacchetto tcsh.

Individuare shell in uso

Digitare nel terminale:

echo $SHELL

Verrà restituito un output simile al seguente:

/bin/bash

Individuare shell presenti nel sistema

  $ vi /etc/shells

Important Note: You May not have all of these installed on your system right now. The way I checked If a shell was installed my system was by looking to see if I had man pages for a particular shell. I will use csh as an example. Type this into your terminal.

  $ man csh

If you don't have any man pages then there is a high probability you don't have this shell on your system. There is one other way to test this. Type this into your terminal.

  $ csh

  $ ps

If you have csh installed on your system you will see something similar to this.

PID TTY          TIME CMD
13964 pts/0    00:00:00 bash
22450 pts/0    00:00:00 csh
22451 pts/0    00:00:00 ps

If you don't have csh installed on your system then install it will this command.

  $ sudo apt-get install csh

Cambiare shell

Modifica temporanea della shell

I will use csh as again an example. I will assume you already have csh installed on your system. All you need to do is type the command below into your terminal.

  $ csh

There are a few ways to verify this. This first comes from above.

  $ ps

If you have csh installed on your system you will see something similar to this.

PID TTY          TIME CMD
13964 pts/0    00:00:00 bash
22450 pts/0    00:00:00 csh
22451 pts/0    00:00:00 ps

The second: Upon changing shells, a different command prompt (i.e., the short text message at the left of each command line) may be shown, depending on the previous and new shells. For example, if the original shell were bash and the new shell is sh, the command prompt would change for a user george from something like [george@localhost george]$ to something like sh-2.05b$.

To return to the original shell, or any other one for that matter, all that is necessary is to just type its name and then press the ENTER key. Thus, for example, to return to the bash shell from the sh shell (or from any other shell), all that is required is to type the word bash or exit.

Modifica permanente della shell

You will use a program called chsh. There is a interactive method and non-interactive method. Type this into your terminal.

interactive method

  $ chsh

This results in a brief dialog in which the user is prompted first for its password and then for the full path of the desired new shell.

Caution should be exercised when changing one's default shell because it is possible to make an error that only the root user (i.e., system administrator) can repair (although it should be easy for a skilled user to repair it on a home system). In particular, it is important to first test the shell temporarily in the current session and then to make certain that a valid shell name is being entered when making the permanent change.

non-interactive method

I will use csh as again an example.

  $ chsh -s /bin/csh

The -s sets it for you without having to go into the editor to do it.

Okay you did the command and it went ok.but the echo says it is the same. Log out and back it for the change to take effect.Then do echo $SHELL. You should see it show the new shell.

Ulteriori risorse


CategoryHomepage