Home Page

Tips page
c
cellulari
debian
egittologia
emacs
emacs-latex
hardware
html
inglese
java
latex
linux

*Alcuni comandi utili utilizzando find
*ARP e MAC address
*Ascoltare un CD audio
*Attivare il NumLock (BlocNum)
*Attivare i tasti i tasti Magic SysRq
*AWK, use an environment variable inside a script
*Bash e Argument list too long
*BogoMIPS
*Cancellare file e non recuperare spazio
*Capacita` dell'hard disk
*Come cambiare i font delle applicazioni con librerie GTK
*Come cambiare l'hostname
*Come tentare di recuperare file, filesystem e partizioni
*Compilare in parallelo
*Condividere una partizione
*Configure proxy for shells
*Continuous disk access
*Controllare la salute di hard disk e filesystem
*Convertire ext2 in ext3 (e viceversa)
*Convertire un file di testo dalla codifica DOS a quella UNIX
*Cosa fare quando si perde la password di root
*Cosa significa l'errore ``TCP
*Creare un boot floppy
*Creare un file temporaneo
*Deframmentazione di un filesystem
*Delete last chars from a string
*Determinare lo spazio libero sul disco
*Eliminare il beep
*Emettere un beep da script
*Enable PPP connection on boot
*Exclude a directory with rsync
*Execute telnet from a script
*Gestione dei file di log
*Gestione dei file .iso
*Gestione della data/ora
*Gestione di utenti e gruppi
*Hash md5 di una stringa
*Identificare la distribuzione installata
*I file ps e pdf
*Il file /etc/fstab
*Il file /etc/issue[.net] e /etc/motd
*Il filesystem SysFs
*I link soft ed hard
*Il path delle applicazioni
*Il sistema tutto in maiuscolo
*I moduli del kernel
*Impostare piu` IP per una scheda di rete
*Introduzione a LVM
*Inviare messaggi agli altri utenti
*I permessi della directory root, /
*La gerarchia del filesystem di Linux
*La memoria Ram sotto Linux
*La memoria swap
*Limitare la possibilita` di diventare root
*Limitazioni alla dimensione del file
*Log dei login utente
*Modificare il comportamento di ctrl+alt+canc
*Modificare le variabili della parent shell
*Montare o rimontare un filesystem come read-only
*More columns in a shell output
*Negare il login durante la manutenzione del sistema
*NoHUP
*Obtain the exact process start time
*Ottenere uno snapshot dello schermo
*Partizionamento di un sistema Linux
*Perche' si usa ./ per avviare alcuni eseguibili
*Permanent PPP connection
*PID of a process
*Programmare l'esecuzione dei programmi
*Quale processo utilizza un certo file o porta
*Quali vantaggi si hanno dalla ricompilazione
*Remove from find results
*Ricreare velocemente /tmp al boot
*Ridirezione dell'output
*Rimappare la tastiera
*Ripristinare i caratteri sballati in console
*Riscrivere l'MBR
*Salvarsi da un ``rm'' di troppo...
*Save MBR
*Scrivere in modo sincrono su filesystem
*Scrivere nel log di sistema di Linux
*Separazione dei comandi nella shell
*Separazione delle parole nella shell
*Share the internet connection
*Shell configuration files
*Single quote character escape with sed
*Spostare una directory in un'altra partizione
*Stimare il carico di lavoro della macchina
*Undelete di un file
*Usare le pendrive USB sotto Linux
*Usare partizioni primarie o estese
*Use md5sum to verify saved files
*Use ssh and scp without password
*Utilizzare hdparm per controllare gli hard disk
*Verificare un file video
*What is a zombie process
*What is the file System.map?
*What is the shebang? (Shell scripts)
*What shared libraries a program uses
*Yesterday date

matlab
misc
mysql
network
octave
programming
python
security
sed
tech
webapps
windows

University Page

Programming

Debian & Linux

Some works

About me

Del.icio.us Bookmarks

BOINC Combined Statistics

Site Statistics

Contact me sending an e-mail (antispam defense activated)

debian

hacker emblem

blogger

GeoURL

View Sandro Tosi's profile on LinkedIn

This is my Google PageRank

Title: Shell configuration files
Author: Sandro Tosi
Last modified: 2005-09-19

There are  many files that  cooperate to setup the  shell environment,
and in general the environment in which applications will run.

We  can   subdivide  those  files   in  two  categories:   global  and
user-specific.  The first  group contains  generic  configurations for
every user  on the machine, the  latter group contains  the files that
modify the environment following the user's own configurations.

Some of the following files are  about bash, since this is the shell I
use almost always, and the most widespread one.


Preliminary informations
=======================

Taken from man bash, we define

       A login shell is one  whose first character of argument zero is
       a -, or one started with the --login option.

       An  interactive   shell  is  one   started  without  non-option
       arguments and  without the -c  option whose standard  input and
       error  are  both  connected  to  terminals  (as  determined  by
       isatty(3)), or one started with  the -i option.  PS1 is set and
       $- includes i  if bash is interactive, allowing  a shell script
       or a startup file to test this state.


Global configuration files
==========================

These files are machine-wide: every user's session will use them (or a
subset of them)


o  /etc/environment

   It's   always  read,   even  from   graphical  login   manager,  as
   xdm/gdm/kdm.

   It's  the right  place  for really  important  things, as  language
   configuration


o  /etc/profile

   System-wide  .profile for  all the  user  in the  system that  uses
   Bourne compatible shells.

   It  is read from  bash login  shells, so  not from  graphical login
   manager, as xdm/gdm/kdm. Note  that every login shell configuration
   file won't be  read from graphical login manager  since they do not
   invoke any shell (this remains  true even for some of the following
   configuration files).

   If  you  want  X  to   load  these  configuration,  try  to  modify
   ``/etc/X11/Xsession.d/99xfree86-common_start''    files    changing
   ``exec $STARTUP'' into ``exec -l  $SHELL -c "$STARTUP"'': X will be
   loaded from a login shell, hence loading all configurations.


   If  you need to  modify the  PATH machine-wide,  this is  the right
   place.


o  /etc/bash.bashrc

   System-wide .bashrc  file for interactive bash  shells. It contains
   general bash configurations.

   This is a good place to put your ``alias''es for all the users.


o  /etc/bash_completion

   Configuration file for programmable completion; it will enable some
   programmable completion  functions to  complete names no  more only
   for files  (e.g., apt-get install <package>,  package is double-tab
   completed).


o  complete.tcsh
   csh.cshrc
   csh.login
   csh.logout

   Those are  some other configurations  files found on my  Debian, in
   this case, for csh and tcsh shells.

o  /etc/shells

   It's the list of available login shells.


o  /etc/skel/*

   The directory contains the  default user's bash configuration file:
   they are copied into the user's home at user creation.


User specific files
===================

These files are relative to the  current user and they reside into the
user's  $HOME.   They  modify   the  global  environment  with  user's
configurations.


o  ~/.bash_profile

   Bash configuration  file read for  login shells. This is  the first
   user configuration file read.

   If you  need to  modify the PATH  only for  this user, this  is the
   right place.

   It's usual to include the following lines into this files

   if [ -f ~/.bashrc ]; then
       . ~/.bashrc
   fi

   so that  configurations done into  ~/.bashrc are available  even in
   login shell.


o  ~/.bash_login

   Configuration  files read  if ~/.bash_profile  does not  exists, as
   second choose.

   It contains configuration loaded at login time.


o  ~/.bash_logout

   List  of commands to  be executed  at logout;  it's only  read from
   login shells.


o  ~/.profile

   Configuration file used for login shells; this file is only read if
   ~/.bash_profile and ~/.bash_login do not exist.


o  ~/.bashrc

   Read  for  interactive,  non-login   shells.  It's  the  user  bash
   configuration file.

   This is  a good  place to  put your ``alias''es;  if you  choose to
   write  your ``alias''es  into  ~/.aliases, then  add the  following
   lines

   if [ -f ~/.aliases ]; then
       source ~/.aliases
   fi

   so that they will be loaded.


o  ~/.aliases

   Hold the ``alias''es.

   This file only  exists if you opted to  separate ``alias'' commands
   from ~/.bashrc.