Difference between revisions of "Post Installation Tips"

From ArchWiki
Jump to: navigation, search
Line 1: Line 1:
[[Category:Getting and installing Arch (English)]][[Category:HOWTOs (English)]]
#REDIRECT[[General Recommendations]]
Here are some sought-after tweaks and general information intended for Arch Linux newcomers.
{{i18n_entry|Česky|Poinstalační tipy (Česky)}}
{{i18n_entry|English|Post Installation Tips}}
{{i18n_entry|Français|Astuce post-installation}}
{{i18n_entry|Español|Consejos para después de Instalar (Español)}}
{{i18n_entry|Italiano|Suggerimenti Post Installazione}}
{{i18n_entry|Ελληνικά|Post Installation Tips (Ελληνικά)}}
{{i18n_entry|Türkçe|Kurulum Sonrası Ayarları (Türkçe)}}
{{i18n_entry|Русский|Подсказки после установки}}
===Hardware Auto-Recognition===
* [[hwdetect]] informs of what modules are needed for a particular device.
  # pacman -S hwdetect
* {{Package AUR|lshwd}} is an alternative.
===Lilo Boot Process Speed-Up===
To speed up [[lilo]]'s boot process, add the following command to {{Filename|/etc/lilo.conf}}:
===Start X at Boot===
See: [[Start X at boot|Start X at Boot]]
===Activating Numlock on Bootup===
See: [[Activating Numlock on Bootup]]
===End of the Boot Process===
After the boot process, the screen is cleared and the login prompt appears, leaving users unable to read init output or error messages. This default behavior may be modified in a few ways:
Add one of the following to the bottom of {{Filename|/etc/rc.local}}:
* Wait for a keypress before clearing the screen:
  read -n1
* Wait for at most 5 seconds or until a keypress occurs:
  read -t5 -n1
* Remove the first 3 characters in {{Filename|/etc/issue}}, which form a "clear screen" escape code. This will also stop the screen from being cleared after logging out from regular sessions in addition to not clearing the screen after booting.
* Run {{Codeline|dmesg}} from the shell prompt to display all the boot messages generated by the kernel.
* Comment out the agetty instance that runs on <code>vc/1</code> in {{Filename|/etc/inittab}}:
#c1:2345:respawn:/sbin/agetty -8 38400 vc/1 linux
===Colorize the Console Prompt (PS1)===
See: [[Color Bash Prompt]]
===Colorize the Output of 'ls'===
This will further enhance the colored {{Codeline|ls}} output; for example, broken (orphan) symlinks will show in red, etc.
File {{Filename|~/.bashrc}} should already have the following entry copied from {{Filename|/etc/skel/.bashrc}}:
alias ls='ls --color=auto'
The next step is adding the following to {{Filename|~/.bashrc}} and reloging:
eval `dircolors -b`
{{Note|These are not single quotes/apostrophes; these are backquotes/backticks/grave accents.}}
===Colorize the Output of 'grep'===
Beyond aesthetics, {{Codeline|grep}} color output is immensely useful for learning {{Codeline|regexp}} and {{Codeline|grep}}'s functionality.
To add it, write the following entry to {{Filename|~/.bashrc}}:
export GREP_COLOR="1;33"
alias grep='grep --color=auto'
The variable <code>GREP_COLOR</code> is used to specify the output color, in this example a light yellow color.
Although the {{Codeline|man}} page of {{Codeline|grep}} states that <code>GREP_COLOR</code> is deprecated and that <code>GREP_COLORS</code> is preferable, this variable will not work (as of grep version 2.5.4) so continue to use <code>GREP_COLOR</code> for now.
===Colorizing and the Emacs Shell===
By default, the [[emacs]] shell will rawly show escape sequences used to print colors. In other words, it will display strange symbols in place of the desired colored output.
Including the following into {{Filename|~/.emacs}} ammends the problem:
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
===Getting a Colored Manpage===
See: [[Man Page]]
===Changing Console Fonts===
Terminus is a popular favorite amongst Arch users. Install with:
pacman -S terminus-font
Edit {{Filename|/etc/rc.conf}}:
Other fonts (with differing styles and sizes) can be found in {{Filename|/usr/share/kbd/consolefonts}}
Switch fonts instantaneously with {{Codeline|setfont}}:
setfont ter-v16b
If the console font is changed during the boot process and init shows strange character output, add the ''keymap'' hook to {{Codeline|/etc/mkinitcpio.conf}} and recreate the ''initramfs'' image:
mkinitcpio -p kernel26
See: [[Mkinitcpio#Available_hooks|Available Hooks in Mkinitcpio]]
===Beautifying Fonts for LCDs===
See: [[Font Configuration#LCD filter patched packages]]
==General Console Improvements==
===Enabling History Search===
See: [[Bash#History Search|Bash:History Search]]
===Fast Bash Completion===
By appending the following into {{Filename|~/.bashrc}}:
set show-all-if-ambiguous on
it is no longer necessary to hit the ''<Tab>'' key twice to produce a list of all possible completions, as a single ''<Tab>'' press will suffice.
===Advanced Bash Completion===
See: [[Bash#Advanced Bash Completion|Bash:Advanced Bash Completion]]
===Timesaving Command-Aliases===
alias ll="ls -lh"
alias la="ls -a"
alias exit="clear; exit"
alias x="startx"
Personal aliases are preferably stored in {{Filename|~/.bashrc}}, system-wide aliases (which affect all users) belong in {{Filename|/etc/bash.bashrc}}.
===Useful Commands & Programs===
* '''grep''' - Searches the file(s) for a pattern.
grep -i syslog /etc/*
: This command will search all files in {{Filename|/etc}} for those containing the word "''syslog''", and the operand {{Codeline|-i}} enables case-insensitive matches.
* '''pkill''' and '''killall''' - Kills processes by name.
killall kdm
: To kill every {{Codeline|kdm}} thread.
* '''pidof''' - Finds the PID number of the processes, by name.
pidof init
: To print the PID # of init.
* '''ps''' - Displays status of current processes.
ps aux
: To display all active processes.
* '''locate''' - Quickly locate files on the hard drive.
locate egrep
: Find files and paths that contain ''egrep'' (the database will first need to be updated by using {{Codeline|updatedb}}).
===Extracting Compressed Files===
For {{Codeline|tar}} archives, {{Codeline|tar}} by default will extract the file according to its extension:
  tar xvf file.''EXTENSION''
Forcing a given format:
file.tar : tar xvf file.tar
file.tgz : tar xvzf file.tgz
file.tar.gz : tar xvzf file.tar.gz
file.tar.bz : bzip -cd file.bz | tar xvf -
file.tar.bz2 : tar xvjf file.tar.bz2 <b>OR</b> bzip2 -cd file.bz2 | tar xvf -
file.tar.xz : tar xvJf file.tar.xz <b>OR</b> xz -cd file.xz | tar xvf -
file.zip : unzip file.zip
file.rar : unrar x file.rar
The construction of some of these tar arguments may be considered legacy, but they are still useful when performing specific operations.  Tar's ''manpage'', section ''Compatibility'', shows how they work in detail.
The following function will decompress a wide range of compressed file-types.  Add the function to {{Filename|~/.bashrc}} and use it with the syntax {{Filename|extract
extract () {
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2)  tar xvjf $1    ;;
      *.tar.gz)    tar xvzf $1    ;;
      *.tar.xz)    tar xvJf $1    ;;
      *.bz2)      bunzip2 $1    ;;
      *.rar)      unrar x $1    ;;
      *.gz)        gunzip $1      ;;
      *.tar)      tar xvf $1    ;;
      *.tbz2)      tar xvjf $1    ;;
      *.tgz)      tar xvzf $1    ;;
      *.zip)      unzip $1      ;;
      *.Z)        uncompress $1  ;;
      *.7z)        7z x $1        ;;
      *.xz)        unxz $1        ;;
      *.exe)      cabextract $1  ;;
      *)          echo "\`$1': unrecognized file compression" ;;
    echo "\`$1' is not a valid file"
===Using 'less' for Browsing Compressed Files===
Frequent users of the command line interface might want to install [http://www-zeuthen.desy.de/~friebel/unix/lesspipe.html lesspipe]:
# pacman -S lesspipe
It allows typing:
less compressed_file.tar.gz
To list the compressed files inside of an archive:
==> use tar_file:contained_file to view a file in the archive
-rw------- username/group  695 2008-01-04 19:24 compressed_file/content1
-rw------- username/group  43 2007-11-07 11:17 compressed_file/content2
compressed_file.tar.gz (END)
It also grants {{Codeline|less}} the ability of interfacing with files other than archives; serving as an alternative for the specific command associated for that file-type (such as viewing html or pdf via html2txt or pdftotext).
Relogin after installing {{Codeline|lesspipe}} in order to activate it, or source {{Filename|/etc/profilde.d/lesspipe.sh}}
===Enabling Console Mouse Support (gpm)===
Installing {{Codeline|gpm}} provides console mouse support:
# pacman -S gpm
To start it right away:
# /etc/rc.d/gpm start
If the mouse is not working properly, edit {{Filename|/etc/conf.d/gpm}}:
* For PS/2 mice, replace the existing line with:
GPM_ARGS="-m /dev/psaux -t ps2"
* For USB mice, 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"
Once a suitable configuration has been found, adding {{Codeline|gpm}} into the <code>DAEMONS</code> array in {{Filename|/etc/rc.conf}} will make {{Codeline|gpm}} load at boot. Example:
DAEMONS=(syslog-ng '''gpm''' network netfs crond)
==Local mail delivery==
To configure postfix for a simple local mailbox delivery configuration, see [[Local Mail Delivery with Postfix]].  See also, [[SSMTP]] and [[MSMTP]].
==Mantaining and Compiling Packages==
In addition to [[Pacman|pacman]]'s standard set of features, there are ways to extend it's usability through rudimentary ''bash'' commands/syntax.
* To install a number of packages sharing similar patterns in their names - not the entire group nor all matching packages - eg. <code>kdemod</code>:
  pacman -S kdemod-{applets,theme,tools}
* Of course, that is not limited and can be expanded to however many levels needed:
  pacman -S kdemod-{ui-{kde,kdemod},kdeartwork}
* Pacman has the {{Codeline|-q}} operand to hide the version column, so it is possible to query and reinstall packages with "compiz" as part of their name:
  pacman -S `pacman -Qq | grep compiz`
* The above can be achieved without {{Codeline|-q}} by issuing an {{Codeline|awk}} operation:
  pacman -S `pacman -Q | awk '/compiz/ { print $1 }'`
On the subject of '''reinstalling every package''': listing currently installed packages will output everything, including packages that are local and/or might not be available for installation any longer.
Simply running:
pacman -S `pacman -Qq`
Will output errors because some (or many) of the packages were not found in the repositories. There needs to be a way to list only packages that can be installed from the repositories present in {{Codeline|pacman}}'s database. In order to do so, combining a command to list all packages, and another to hide the list of foreign packages is required.
This is achieved by using {{Codeline|comm -3}} to show only the packages that are not foreign packages:
pacman -S $(comm -3 <(pacman -Qq) <(pacman -Qqm))
To take full advantage of using the fastest and the most up to date mirror(s), see [[Mirrors]].
====Pacman Aliases====
See: [[Pacman Tips#Aliases]]
===Accessing the AUR Seamlessly===
Everyone should know how to use the [[AUR]], [[ABS]], and [[makepkg]] if they want to build packages. Tracking and updating custom built packages can become tedious, especially if they are numerous in quantity.
There are some programs and scripts that help building packages more convenient. See: a [[AUR Helpers|list of programs that help accessing the AUR]]
=== Using ABS to Recompile Packages ===
The Arch Build System is a ports-like system of compile files used to make packages that are already in the repositories.  To compile packages with different options see [[ABS]].
=== Compiling Optimized Packages ===
When packages are compiled with Arch's package creation tool [[makepkg]], the standard compiler (GCC) has options to be able specify machine type that can improve the load time, performance of a package.  Generally any speed improvements are slight, but if you plan to compile a lot of packages you might want to consider setting your machine specifications.
For optimized the packages built using {{Codeline|makepkg}}, find your processor type in [[CFLAGS]] and edit {{Filename|/etc/makepkg.conf}}.  Example:
# For an Athlon CPU
CFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
=== Speeding up DNS Queries ===
Consider using [[Dnsmasq]] to improve load time by caching DNS queries.
===Disabling IPv6===
Until the widespread adoption of IPv6, it may be beneficial to [[IPv6 - Disabling the Module|disable the IPv6 module]].

Revision as of 03:24, 16 January 2010