Post Installation Tips
From ArchWiki
| i18n |
|---|
| English |
| Español |
| 简体中文 |
Here are some performance tweaks and other useful information for Arch Linux newbies.
[edit] Hardware Auto-Recognition
-
lshwdis 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
[edit] Lilo Boot Process Speed-Up
- to speed up lilo boot process, add the following command to
/etc/lilo.conf:
compact
[edit] Pausing at End of Boot Process
- to pause at the end of the boot process before getting the login prompt (usually used for debugging your boot messages), add at the end of
/etc/rc.local:
read KEY
- or else remove the first character in
/etc/issuefile, which is a "clear screen" escape code. - Alternatively, running
dmesgfrom the bash prompt will display all the boot messages prior to initd.
[edit] Colorize your PS1 and Console
~/.bashrc and /root/.bashrc 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/.bashrc
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.
[edit] 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.
[edit] 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
[edit] 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
[edit] 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
fi
to ~/.bashrc
[edit] 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
gpmintoDAEMONSarray in/etc/rc.confto have it started at boot. - Mouse support in the console is useful for many things, including programs such as Links and Lynx.
[edit] Start X at boot
[edit] Beautifying Fonts for LCD's
See Fonts
[edit] Activating Numlock on Bootup
[edit] 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
absrun and it's easier to keep track of them.
[edit] 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.
[edit] Timesaving Command-aliases
- You can create your own commands-aliases using
<homedir>/.bashrcor/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' )"
}
[edit] Disabling IPv6
Until the widespread adoption of IPv6, you may benefit from disabling the IPv6 module.
[edit] 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-iparameter))pkill/killall <process_name>- kills processes by name (example:killall kdm)ps- display process status (example:ps -xauwill display all active processes)locate- quickly locates files on your hard drive (uselocate -ufirst to create/update the files db...) (example:locate Xserverswill find all files named Xservers)
[edit] pacman
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.
[edit] makepkg
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.
[edit] abs
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.
[edit] 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)