Impostare Il Proprio Ambiente Di Lavoro

Se volete usare un ambiente di lavoro confortevole e' meglio fin dall'inizio impostare alcune variabili che rendono piu' graevole l'utilizzo di linux.

Nel vostro file ~/.bashrc (se non c'e' createlo) provate ad aggiugere la seguente riga:

 PS1="\n\[\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]\$ "

per migliorare la compatibilita', inseritelo anche in ~/.bash_profile e in ~/.bash_login .

mentre in /root/.bashrc (e /root/.bash_login e /root/.bash_profile) mettete la seguente linea:

 PS1="\n\[\e[1;31m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]\$ "

su Ubuntu e derivate e' meglio questo:

 PS1="\n\[\e[1;31m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]# "

Tutto cio' aggiungera' del colore, in maniera intelligente, alla vostra shell. Per saperne di piu' digitate info bash.

Mentre per attivare il completamento automatico delle parole premendo il tasto TAB, bisogna mettere nella ~/.inputrc la linea:

 set show-all-if-ambiguous  on

Se lo volete attivare per tutti gli utenti, basta metterlo in /etc/inputrc.

Alias

Cosa sono gli alias? Sono comandi che in realta' non esistono ma che lanciano altri programmi. Per esempio se con linux lanciate cd.. vi apparira':

 $ cd.. 
 Error: Try: cd .. 

in relata' l'alias e'

 "cd..=`echo -e '\Error: Try: cd ..'\`

Per sapere tutti gli alias basta digitare alias.

Se vogliamo creare dei nostri alias personalizzati basta scrivere dentro .bash_profile, all'interno della nostra home directory, righe del tipo:

 alias +='pushd .'
 alias -='popd'
 alias ..='cd ..'
 alias ...='cd ../..'
 alias A:='echo -e '\''Error: There is no such thing as a drive A: in Linux.\n    
  If you want to access your floppy, try "mount /dev/fd0" and then look\n    
  in the directory /media/floppy !'\'''
 alias C:='echo -e '\''Error: There is no such thing as a drive C: in Linux!\n   
  Your harddisk should already be mounted (via /etc/fstab or autofs).'\'''
 alias a:='A:'
 alias beep='echo -en "\007"'
 alias c:='C:'
 alias cd..='echo '\Error: Try: cd ..'\'
 alias chkdsk='echo -e '\''Error: Your filesystems are checked on bootup.\n      
   If you want to do it manually, use fsck.\n     Use df and mount for an 
   overview of your disks.'\'''
 alias copy='echo '\Error: Try the command: cp -piv'\'
 alias del='echo '\Error: Try the command: rm -iv'\'
 alias dir='ls -l'
 alias format='echo -e '\''Error: The DOS concept of formatting disk media is 
   screwed.\n If you want to create a filesystem use "mkfs". To format a floppy, use\n
   "fdformat /dev/fd0" and then "mkfs.minix /dev/fd0".'\'' #'
 alias l='ls -alF'
 alias la='ls -la'
 alias ll='ls -l'
 alias ls='ls $LS_OPTIONS'
 alias ls-l='ls -l'
 alias md='mkdir -p'
 alias mem='echo '\Error: Try the command: free'\'
 alias move='echo '\Error: Try the command: mv -iv'\'
 alias o='less'
 alias rd='rmdir'
 alias rehash='hash -r'
 alias sys='echo -e '\''Error: Linux cannot be transferred like that.\n  
    If you want to install Linux or create bootfloppies, please use YaST.'\'' #'
 alias unmount='echo "Error: Try the command: umount" 1>&2; false'
 alias ver='echo '\Error: Try the command: uname -a'\'
 alias which='type -p'