General recommendations (Italiano)

From ArchWiki
Revision as of 20:30, 25 May 2008 by Slapshot (Talk | contribs) (New page: Category:Getting and installing Arch (Italiano) Category:HOWTOs (Italiano) {{i18n_links_start}} {{i18n_entry|English|Post Installation Tips}} {{i18n_entry|Español|Consejos para d...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Queste informazioni sono utili per i novizi di Arch Linux, ma anche per avere migliori performance dalla propria distro.

Auto-Riconoscimento Hardware

  • lshwd è uno strumento di auto-riconoscimento hardware. Vi dirà quale modulo avete bisogno di caricare e configurare.
  • Altrimenti usate hwdetect. Spesso è in grado di rilevare un numero maggiore di disposiviti ed è più veloce di lshwd. Maggiori informazioni: hwdetect

Accelerare la sequenza di avvio di Lilo

  • Aggiungete il seguente comando al file /etc/lilo.conf:

Inserire una pausa al termine della sequenza di avvio

  • per inserire una pausa al termine del processo di avvio ma prima del prompt di login (di solito usato per scopi di debugging dei messaggi di avvio), aggiungete questa istruzione al termine del file /etc/rc.local:
 read KEY
  • oppure rimuovete il primo carattere nel file /etc/issue, che rappresenta un carattere escape di pulizia schermo.
  • Alternativamente, avviate dal prompt della bash il comando dmesg che visualizzerà tutti i messaggi di avvio precedenti initd.

Colorare PS1 e la Console

~/.bashrc e /root/.bashrc contengono la variabile PS1 di default (shell prompt) per l'utente normale e per root, rispettivamente.

Come utente normale:

nano ~/.bashrc

Commentate il prompt di default:

#PS1='[\u@\h \W]\$ '

E aggiungete:

PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[1;37m\] '

In questo modo avrete un prompt ed un tema piacevole per la console con caratteri di testo bianco brillante.

Come root, modificate il file /root/.bashrc:

# nano /root/.bashrc

Commentate la variabile PS1 di default:

#PS1='[\u@\h \W]\$ '

La variabile PS1 che segue è utile per un prompt bash dell'utente root, con The following PS1 is useful for a root bash prompt, con colore rosso per il nome utente e verde per il testo della console:

PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\] '

Per maggiori informazioni, andate alla pagina wiki Colorare il prompt di Bash.

Comando Less agli steroidi

Gli utenti che utilizzano frequentemente la linea di comando, potrebbero installare lesspipe (reperibile su AUR). Consente di digitare comandi come:

less lesspipe.tar.gz
==> use tar_file:contained_file to view a file in the archive
-rw------- solstice/users  695 2008-01-04 19:24 lesspipe/PKGBUILD
-rw------- solstice/users   43 2007-11-07 11:17 lesspipe/
lesspipe.tar.gz (END)

i.e. E' possibile usare less per vedere il contenuto di molti file, invece di usare uno specifico comando ogni volta.

Come avere pagine man a colori

Se siete nuovi utenti Linux dovrete leggere molte pagine man se davvero volete imparare. Il colore consentirà una presentazione più chiara dei contenuti e, si spera, una migliore assimilazione dei contenuti. Per avere pagine man a colori installate un programma come most(8).

pacman -S most

Esso è simile a less e more ma permette di avere il testo a colori in modo semplice.

Per averlo configurato e funzionante modificate il file /etc/man.conf e cambiate la variabile PAGER e BROWSER come segue:

PAGER           /usr/bin/most -s
BROWSER         /usr/bin/most -s

Ora potetescrivere:

man whatever_man_page

per vederlo in azione.

Se volete modificare i colori, sperimentate modificando il file ~/.mostrc file (createlo se non esiste) oppure usate /etc/most.conf.

esempio di ~/.mostrc:

% Color settings

color normal lightgray black
color status yellow blue
color underline yellow black
color overstrike brightblue black

un altro esempio per scorciatoie di tastiera di tipo less (salta alla linea con 'J'):

% less-like keybindings

unsetkey "^K"
unsetkey "g"
unsetkey "G"
unsetkey ":"

setkey next_file ":n"
setkey find_file ":e"
setkey next_file ":p"
setkey toggle_options ":o"
setkey toggle_case ":c"
setkey delete_file ":d"
setkey exit ":q"

setkey bob "g"
setkey eob "G"
setkey down "e"
setkey down "E"
setkey down "j"
setkey down "^N"
setkey up "y"
setkey up "^Y"
setkey up "k"
setkey up "^P"
setkey up "^K"
setkey page_down "f"
setkey page_down "^F"
setkey page_up "b"
setkey page_up "^B"
setkey other_window "z"
setkey other_window "w"
setkey search_backward "?"
setkey bob "p"
setkey goto_mark "'"
setkey find_file "E"
setkey edit "v"

Alternatively you can get the same coloured result for manpages with less. This method has the advantage that less has many more features than most thus comes much more handy for advanced users. Just add the following to your .SHELLrc

export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'                           
export LESS_TERMCAP_so=$'\E[01;44;33m'                                 
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'


Accessing AUR seamlessly with "Yaourt"

The most popular third-party program that can search AUR is called yaourt. This program searches both AUR and the repos, prunes comments from AUR packages pages (as they sometimes contains useful info), displays it all in nice color and allows you to automatically download and install these packages.

See a list of other programs that help you access AUR

Enabling shellcompletion

This is a very desirable feature that you will no doubt benefit greatly from.

pacman -S bash-completion

and afterwards add

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

to ~/.bashrc

Enabling mouse support in console (gpm)

  • You can enable mouse support in the console by installing gpm:
pacman -S gpm
  • If you see the mouse cursor flickering and it doesn't work properly, you will need to change /etc/conf.d/gpm.

For PS/2 mouse replace the existing line with:

GPM_ARGS="-m /dev/psaux -t ps2"

For USB mouse replace the existing line with:

GPM_ARGS="-m /dev/input/mice -t imps2"

For IBM Trackpoint, replace the existing line with:

GPM_ARGS="-m /dev/input/mice -t ps2"
  • When it works, you can add gpm into DAEMONS array in /etc/rc.conf to have it started at boot.
  • Mouse support in the console is useful for many things, including programs such as Links and Lynx.

Start X at boot

Beautifying Fonts for LCD's

See Fonts

Activating Numlock on Bootup

ABS to build your own packages

  • If you use ABS to build your own packages, remember to do it outside of the main /var/abs tree. Copy the PKGBUILD and all accompanying files to an empty directory in your homedir and build from there. That way you won't risk your modifications getting overwritten on the next abs run and it's easier to keep track of them.

Optimizing your packages

  • For optimizing the packages you build using makepkg (the kernel is a good example), set your GCC preferred settings in /etc/makepkg.conf:
 (example for Athlon CPU)
 export CFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
 export CXXFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"

See Safe CFlags for more info.

Timesaving Command-aliases

  • You can create your own commands-aliases using <homedir>/.bashrc or /etc/profile. Both can be used to define your own aliases:
 alias p="pacman"
 alias yogurt="yaourt" #if English is your native tongue ;)
 alias ll="ls -lh"
 alias la="ls -a"
 alias exit="clear; exit"
 alias x="startx"
 alias pacsearch="pacman -Sl | cut -d' ' -f2 | grep " #lets you search through all available packages simply using 'pacsearch packagename'
 alias pacup="sudo pacman -Syu" # sudo pacman -Syu by typing pacup (sudo must be installed and configured first ;) )
 alias pac="sudo pacman -S" # sudo pacman -S by typing pac (sudo must be installed and configured first ;) )

Colorized pacman -Ss search output:

# colorized pacman output with pacs alias:
alias pacs="pacsearch"
pacsearch () {
       echo -e "$(pacman -Ss $@ | sed \
              -e 's#core/.*#\\033[1;31m&\\033[0;37m#g' \
                     -e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \
                            -e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \
                                   -e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )"

Disabling IPv6

Until the widespread adoption of IPv6, you may benefit from disabling the IPv6 module.

Useful Commands & Programs

  • grep - searches for files by its contents (example: grep -i syslog /etc/* will search all files in /etc for those containing the word "syslog"; NOT case-sensitive (using the -i parameter))
  • pkill/killall <process_name> - kills processes by name (example: killall kdm)
  • ps - display process status (example: ps -xau will display all active processes)
  • locate - quickly locates files on your hard drive (use locate -u first to create/update the files db...) (example: locate Xservers will find all files named Xservers)


There are some nice ways to do a bunch of things easily with bash commands. If we want to install a number of packages sharing similar patterns in their names - not the entire group nor all matching packages - eg. kdemod, we can do:

pacman -S kdemod-{applets,theme,tools}

Of course, that is not limited and can be expanded to however many levels you need:

pacman -S kdemod-{ui-{kde,kdemod},kdeartwork}

Pacman has the -q option to hide the version column, and we can do something like reinstall packages with "compiz" as part of their name:

pacman -S `pacman -Qq | grep compiz`

The above can be achieved without -q by issuing an awk operation:

pacman -S `pacman -Q | awk '{ print $1 }' | grep compiz`

Want to reinstall everything? Easy! Wait - not so fast. Listing currently installed packages will output everything including those that have been built with makepkg (assuming we did not use yaourt). Simply running

pacman -S `pacman -Qq`

will output errors because some (or many) of them were not found in the database. We need a way to list only packages that have been installed by pacman. In order to do so, we must combine a command to list all packages, and another to hide the list of foreign packages. This, we achieve, with -m and grep -v.

pacman -S $(pacman -Qq | grep -v "`pacman -Qqm`")

Take note of the parentheses $() and `` between quotes (grep will fail because without quotes it will think each string is an independent directory). You can use the latter for the first level too (or use the former for both levels) but whatever it is, remember that parentheses is always a good programming and mathematical practice.


An automated tool to create packages - it actually automates the ./configure && make && make install procedure or whatever combination of commands involved in the building of the application. It uses a file named PKGBUILD which must exist in the same directory you will build your package. View a PKGBUILD file and read the installation document to learn more about how to work with makepkg.


An automated tool that allows you to rebuild any of pacman's packages (so you may provide your own compiler and linker settings, for better optimization, debugging info, etc). Simply executing abs will synchronize all PKGBUILD scripts from the CVS repository into /var/abs.

Extracting compressed files

 file.tar : tar xvf file.tar
 file.tgz : tar xvzf file.tgz
 file.tar.gz : tar xvzf file.tar.gz : bzip -cd | tar xvf -
 file.bz2 : tar xvjf file.tar.bz2 OR bzip2 -cd file.bz2 | tar xvf - : unzip
 file.rar : unrar x file.rar

The construction of these tar arguments is quite archaic (but nevertheless handy). Have a look at the bsdtar manpage, section COMPATIBILITY for how they work in detail. (bsdtar comes in the libarchive package)