Wiki Ubuntu-it

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

Versione 149 del 25/02/2018 05.08.03

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.

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 essere 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.

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.).

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 alcune delle shell più utilizzate nei sistemi Unix.
Ove necessario, è indicato il relativo pacchetto necessario all'installazione presente nei repository ufficiali.

Nome

Descrizione

Pacchetto

Bourne (sh)

È la shell storica dei sistemi UNIX. Garantisce la compatibilità con gli standard POSIX.

preinstallata

Korn (ksh o ksh88/ksh93)

È una shell sviluppata in passato dalla AT&T, retrocompatibile con Bourne. È la shell di default di OpenBSD.

ksh

Bash (bash)

Acronimo di «Bourne Again SHell», è nata come versione avanzata e retrocompatibile di Bourne. Viene utilizzata dalle maggiori distribuzioni GNU/Linux, rappresentando de facto la shell standard.

preinstallata

Z-Shell (zsh)

Integra molte funzionalità, anche avanzate, mutuate da altre shell (autocompletamento, controllo ortografco, manipolazione avanzata di variabili e array, retrocompatibilità, temi ecc.). È la shell predefinita di Arch Linux.

zsh

C-Shell (csh)

csh

TC-Shell (tcsh)

Basically the same thing as above. They are a little bit different, but not very much so they now fall into the same category.

tcsh

Individuare shell in uso

Digitare nel terminale:

echo $SHELL

Verrà restituito un output simile al seguente:

/bin/bash

Individuare shell presenti nel sistema

Digitare nel terminale:

cat /etc/shells

Verrà restituito un output contente le shell presenti nel sistema, simile al seguente:

# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/bin/zsh
/usr/bin/zsh

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