Difference between revisions of "Post Installation Tips"

From ArchWiki
Jump to: navigation, search
(Optimizing your packages)
m (Change Console Fonts: Location of other fonts)
Line 82: Line 82:
Edit /etc/rc.conf:
Edit /etc/rc.conf:
Or find other fonts(with other sizes and styles) in /usr/share/kbd/consolefonts.
Switch fonts on-the-fly with '''setfont''':
Switch fonts on-the-fly with '''setfont''':
  setfont ter-v16b
  setfont ter-v16b

Revision as of 11:23, 2 December 2008

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


Here are some performance tweaks and other useful information for Arch Linux newbies.

Hardware Auto-Recognition

  • lshwd is your hardware auto-recognition tool. It will inform you which module you need to load and set.
  • Or you can use hwdetect. In my experience it detects more hardware and is faster than lshwd. More information: hwdetect

Lilo Boot Process Speed-Up

  • To speed up lilo boot process, add the following command to /etc/lilo.conf:

End of Boot Process

After the boot process, the screen is cleared and the login prompt appears. Some users may want to modify this behaviour such that they can see the messages that appeared during the boot process still.

You can either add one of the following to the bottom of your /etc/rc.local file:

  • Wait at the end of the process until you press a key before clearing the screen and letting you log in:
 read -n1
  • Wait for at most 5 seconds or until you press a key:
 read -t5 -n1


  • Remove the first 3 characters in /etc/issue file, which is a "clear screen" escape code. Obviously this will stop the screen from being cleared after you log out from your login session as well as just after boot.
  • Run dmesg from the shell prompt to display all the boot messages generated by the kernel.
  • comment out the agetty instance that runs on vc/1 in /etc/inittab.
#c1:2345:respawn:/sbin/agetty -8 38400 vc/1 linux

Colorize your console prompt (PS1)

~/.bashrc and /root/.bash_profile contain the default PS1 (shell prompt) variables for normal user and root, respectively.

As normal user:

$ nano ~/.bashrc

Comment out the default prompt:

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

And add:

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

This will give a very pleasing, colorful prompt and theme for the console with bright white text.

As root, edit the /root/.bashrc:

# nano /root/.bash_profile

Comment out the default PS1:

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

The following PS1 is useful for a root bash prompt, with red designation and green console text:

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

For more, see the Color Bash Prompt wiki entry.

Colorize the output of 'ls'

Your ~/.bashrc should already have the following entry copied from /etc/skel/.bashrc

alias ls='ls --color=auto'

Just add to your ~/.bashrc

eval `dircolors -b`

This will further enhance the colored ls output; for example, broken (orphan) symlinks will show in red, etc.
Note the backquote/backtick/grave accent character used here - this is not a single quote/apostrophe.

Less on steroids

If you are a frequent user of the command line interface, you might want to install lesspipe (that you will find on AUR). It will allow you to type:

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.sh
lesspipe.tar.gz (END)

i.e. use less to see the content of many files, instead of using specific command each time. Use man lesspipe to see how to activate it.

Change Console Fonts

Terminus is a popular favorite amongst Archers. Install with:

pacman -S terminus-font

Edit /etc/rc.conf:


Or find other fonts(with other sizes and styles) in /usr/share/kbd/consolefonts. Switch fonts on-the-fly with setfont:

setfont ter-v16b

Getting a colored manpage

If you're new to linux, you will have to read a lot of manpages if you want to learn. However color will allow a clearer presentation of the contents and hopefully easier digestion. To get manpages to render in color install a reader program like most(8).

# pacman -S most

This is similar to less and more but also allows you to render text in color in an easier way.

To get it up and running change the /etc/man.conf file and change the PAGER and BROWSER variable to:

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

Now you can type:

$ man whatever_man_page

to see it in clarifying colors.

If you want to modify the colors, experiment with the ~/.mostrc file (create it if it isn't there) or use /etc/most.conf.

example ~/.mostrc:

% Color settings

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

another example for less-like keybindings (jump to line with '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'

Source: http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html

Accessing AUR seamlessly

Everyone should know how to use AUR, ABS, and makepkg if they want to build packages. Tracking and updating your custom built packages can become tedious, especially if you have many. There are some programs and scripts that help make building packages more convenient.

The most popular third-party program that can search AUR is called yaourt.

See a list of other programs that help you access AUR

Enabling History Search

Usually, when typing ls and pressing <up> key, your current input will be replaced with the last command used. If you are using history seach, only past commands beginning with ls (the current input) will be shown.

You can enable this mode by adding to /etc/inputrc or your ~/.inputrc:


Enabling shellcompletion

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

# pacman -S bash-completion

and afterwards add to ~/.bashrc

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

Note: You may not need the above ~/.bashrc entries as /etc/profile will load any profiles from /etc/profile.d
In there, bash_completion.sh will source /etc/bash_completion anyway.

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: [ED: This is what works for my Synaptics touchpad, neither syn nor synps2 did.]

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 ll="ls -lh"
alias la="ls -a"
alias exit="clear; exit"
alias x="startx"

# Lets you search through all available packages simply using 'pacsearch packagename'
alias pacsearch="pacman -Sl | cut -d' ' -f2 | grep "

# sudo pacman -Syu by typing pacup (sudo must be installed and configured first)
alias pacup="sudo pacman -Syu"

# sudo pacman -S by typing pac
alias pac="sudo pacman -S"

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' ) \

You can also download pacman-color from the AUR.

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 updatedb to create a database of them first) (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 '/compiz/ { print $1 }'`

Want to reinstall everything? Easy! Wait - not so fast. Listing currently installed packages will output everything including those that have been built with makepkg. 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 by using comm -3 to show only the packages that are not foreign packages.

pacman -S $(comm -3 <(pacman -Qq) <(pacman -Qqm))


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) and packs it up into a .pkg.tar.gz to be easily installed with pacman. It uses a script file called a PKGBUILD which must exist in the build directory. View a PKGBUILD file and read the installation document to learn more about how to work with makepkg.


An automated toolkit 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 SVN 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
 file.bz : bzip -cd file.bz | tar xvf -
 file.bz2 : tar xvjf file.tar.bz2 OR bzip2 -cd file.bz2 | tar xvf -
 file.zip : unzip file.zip
 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)

Speeding up DNS queries