mount /, /home on /mnt:
fdisk /dev/sda # n - new, s - save.
mount /dev/sda1 /mnt/
wifi-menu, systemctl stop dhcpcd.service, man netctl.
pacstrap /mnt base
genfstab -p /mnt >> /mnt/etc/fstab. use -U or -L for UUID or labels.
echo wcfThinkpad > /etc/hostname
ln -s /usr/share/zoneinfo/zone/subzone /etc/localtime
# Set date and time:
date +%Y%m%d -s "2017-04-11"
date +%T -s "21:39:21"
uncomment the needed locales in /etc/locale.gen, run: locale-gen. echo LANG=en_US.UTF-8 > /etc/locale.conf
mkinitcpio -p linux
change root passwd.
需要安装os-prober. 安装后, 再执行grub-mkconfig -o /boot/grub/grub.cfg
# Enable dhcpcd.service on all interfaces.
sudo systemctl enable dhcpcd
wpa_supplicant -Dn180211,wext -iwlan0 -c<(wpa_passphrase ssid psk)
scan_ssid=1 for hidden ssid.
mkinitcpio is a Bash script used to create an initial ramdisk environment.
Initial ramdisk environment is commonly used to make preparations before the real root file system can be mounted. The initial ramdisk is used for those (wikipedia):
The device drivers are included as loadable kernel modules, to boot on a wide variety of hardware.
The root file system may be on a software RAID volume, LVM, NFS (on diskless workstations), or on an encrypted partition. All of these require special preparations to mount.
Kernel support for hibernation.
initrd and initramfs refer to two different methods of achieving this.
In the initrd scheme, the image may be a file system image (optionally compressed), which is made available in a special block device (/dev/ram) that is then mounted as the initial root file system.
In the initramfs scheme (available since the Linux kernel 2.6.13), the image may be a cpio archive (optionally compressed). The archive is unpacked by the kernel into a special instance of a tmpfs that becomes the initial root file system. This scheme has the advantage of not requiring an intermediate file system or block drivers to be compiled into the kernel.
a shortcut to an application
a shortcut to a web link.
a container of meta data of a menu entry
Desktop entries for applications, or .desktop files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in /usr/share/applications or /usr/local/share/applications for applications installed system-wide, or ~/.local/share/applications for user-specific applications. User entries take precedence over system entries.
Type=Application # Indicates the type as listed above
Version=1.0 # The version of the desktop entry specification to which this file complies
Name=jMemorize # The name of the application
Comment=Flash card based learning tool # A comment which can/will be used as a tooltip
Exec=jmemorize # The executable of the application.
Icon=jmemorize # The name of the icon that will be used to display this entry
Terminal=false # Describes whether this application needs to be run in a terminal or not
Categories=Education;Languages;Java; # Describes the categories in which this entry should be shown
# To validate. It is part of the package desktop-file-utils.
desktop-file-validate your desktop file
For XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start *.desktop files found in the following directories:
System-wide: $XDG_CONFIG_DIRS/autostart/ (/etc/xdg/autostart/ by default)
GNOME also starts files found in /usr/share/gnome/autostart/
User-specific: $XDG_CONFIG_HOME/autostart/ (~/.config/autostart/ by default)
Users can override system-wide *.desktop files by copying them into the user-specific ~/.config/autostart/ folder.
#---------- -S: sync
# -w, --downloadonly: Retrieve all packages from the server, but do not install/upgrade anything.
# --noconfirm: Bypass any and all “Are you sure?” messages. It’s not a good idea to do this unless you want to run pacman from a script.
# Show all package groups
# Show all package in a group
pacman -Sgg _base_
# List all files in an installed package
pacman -Ql binutils
# To list all files in an uninstalled package
sudo pacman -S pkgfile
sudo pkgfile -u
pkgfile -s ss
pkgfile -l core/iproute2
#---------- -Q: query
# Query/search for installed packages.
pacman -Qs apache
# Find systemd unit files
pacman -Qql apache | grep -Fe .service -e .socket
#---------- -R: remove
# -s, --recursive: Remove each target specified including all of their dependencies, provided (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recursive and analogous to a backwards --sync operation, and it helps keep a clean system without orphans. If you want to omit condition (B), pass this option twice.
# -u, --unneeded: Removes targets that are not required by any other packages. This is mostly useful when removing a group without using the -c option, to avoid breaking any dependencies.
pacman -Rs packageName
pacman -Ru groupName
During a package upgrade (pacman -Syu, pacman -Su or pacman -U), .pacnew files are created to avoid overwriting a file which already exists and was previously modified by the user.
.pacsave file may be created during a package removal (pacman -R).
Pacman will output the following log both to console and /var/log/pacman.log:
warning: /etc/pam.d/usermod installed as /etc/pam.d/usermod.pacnew
warning: /etc/pam.d/usermod saved as /etc/pam.d/usermod.pacsave
To locate those files:
find /etc -regextype posix-extended -regex ".+\.pac(new|save)" 2> /dev/null
locate -e --regex "\.pac(new|save)$"
egrep "pac(new|save)" /var/log/pacman.log
# This command will automatically find all pacnew files.
# It uses vimdiff by default.
# Or set your own diff program
# Use this command to check the integrity of /etc/passwd
# Check the integrity of group
.pacnew is generated by 3-way MD5 sum comparison.
original = X, current = X, new = X
original = X, current = X, new = Y
original = X, current = Y, new = Y
Under all these conditions, the new conf will overwrite the current one directly.
original = X, current = Y, new = X
Kee current conf as is, without notifying the user.
original = X, current = Y, new = Z
New conf is saved as .pacnew.
freedesktop.org recommends to specify default (preferred) applications for MIME-types in these two kinds of files:
$desktop-mimeapps.list: Desktop specific. $desktop could be kde, gnome, xfce.
# user overrides
# sysadmin and vendor overrides
# distribution-provided defaults
When the program update-desktop-database is run (usually as root during the (un)installation of a package), it updates mimeinfo.cache under /usr/local/share/applications and /usr/share/applications directories. These files keep track of which MIME-types are associated with which .desktop files overall, and should not be edited by the user.
Open gnome-control-center, open System > Details > Default Applications.
xdg-open is a desktop-independent tool for starting default applications.
Many applications invoke the xdg-open command internally.
xdg-open uses xdg-mime to query ~/.local/share/applications/mimeapps.list.
Custom file association
In this example, 'foobar' will be associated with all *.foo files. This will only affect the current user.
Edit ~/.local/share/mime/packages/application-x-foobar.xml and add this text:
Warning: /lib/modules/4.11.9-1-ARCH/modules.devname not found - ignoring
Error: device 'UUID=b5a9a977-e9a7-4d3d-96a9-dcf9c3a9010d' not found. Skipping fsck.
Error: can't find UUID=b5a9a977-e9a7-4d3d-96a9-dcf9c3a9010d
You are now being dropped into a emergency shell.
# Use a livecd to mount all partitions and use arch-chroot.
mount /dev/sda1 /mnt
Regenerate initramfs using:
mkinitcpio -p linux
If you use grub:
grub-mkconfig -o /mnt/boot/grub/grub.cfg
# Rescale all images in a dir to 800 pixel width.
if [ -z "$1" ]; then
for i in $(ls $1); do
if [ $i != "." ]; then
convert -filter Cubic -resize 800 $i $i.s.jpg
sudo pacman -S xf86-input-synaptics
After installation of xf86-input-synaptics, a default configuration file is located at /usr/share/X11/xorg.conf.d/50-synaptics.conf. Users can copy this file to /etc/X11/xorg.conf.d/ and edit it to configure the various driver options available.
If your touchpad is too sensitive, use higher values for FingerLow and FingerHigh and vice versa. Remember that FingerLow should be smaller than FingerHigh.
VertScrollDelta and HorizScrollDelta (integer) configures the speed of scrolling, it is a bit counter-intuitive because higher values produce greater precision and thus slower scrolling. Negative values cause natural scrolling like in OS X.
A Linux-capable boot loader (GRUB, Syslinux or LILO) must be installed to the Master Boot Record (MBR) or the GUID Partition Table (GPT). The boot loader is responsible for loading the kernel and initial ramdisk before initiating the boot process. GPT is part of UEFI. UEFI has support for reading both the partition table as well as understanding filesystems.
Load Kernel. The kernel is the core of an operating system, which functions on a low level (kernelspace) interacting between the hardware of the machine and the programs which use the hardware to run. To make efficient use of the CPU, the kernel uses a scheduler to arbitrate which tasks take priority at any given moment.
Kernel unpacks the initramfs (initial RAM filesystem), which becomes the initial root filesystem. The kernel then executes /init as the first process. The early userspace starts.
This means that any modules that are required for devices like IDE, SCSI, SATA, USB/FW (if booting from an external drive) must be loadable from the initramfs if not built into the kernel.
For this reason, the initramfs only needs to contain the modules necessary to access the root filesystem; it does not need to contain every module one would ever want to use.
The majority of modules will be loaded later on by udev, during the init process.
Init process. At the final stage of early userspace, the real root is mounted, and then replaces the initial root filesystem. /sbin/init is executed, replacing the /init process. Arch uses systemd as the default init.
Getty. ArchWiki. A getty is the generic name for a program which manages a terminal line and its connected terminal. Its purpose is to protect the system from unauthorized access. The agetty program is the default getty in Arch Linux.
DM. If a display manager is installed, it will be executed on the configured tty, replacing the getty login prompt.
The login program begins a session for the user.
Shell. Once the user's shell is started, it will typically run a runtime configuration file, such as bashrc, before presenting a prompt to the user. If the account is configured to Start X at login, the runtime configuration file will call startx or xinit.
xinit. xinit runs the user's xinitrc runtime configuration file.
# Install build tools
sudo pacman -S binutils make gcc
# Get the output in English.
IBus (Intelligent Input Bus) is an input method framework, a system for entering foreign characters. IBus functions similarly to Fcitx, SCIM and UIM.
sudo pacman -S ibus
# sudo pacman -S ibus-rime
sudo pacman -S ibus-libpinyin
sudo pacman -S gnome-control-center
# First type "ibus-setup" and add input method there.
# and then type "gnome-control-center" and add languages there.
# Now type Super+space to switch input methods.
# To start ibus with GNOME, add this in ~/.profile and restart the GNOME.
export [email protected]=ibus
ibus-daemon -d -x
The mount command by default will use /usr/bin/mount.ntfs which is symlinked to /usr/bin/ntfs-3g after the ntfs-3g package is installed.
ntfs-3g /dev/your_NTFS_partition /mount/point.
# <file system> <dir> <type> <options> <dump> <pass>
/dev/NTFS-part /mnt/windows ntfs-3g defaults 0 0
# Mount internal Windows partition with linux compatible permissions, i.e. 755 for directories (dmask=022) and 644 for files (fmask=133)
UUID=01CD2ABB65E17DE0 /run/media/user1/Windows ntfs-3g uid=user1,gid=users,dmask=022,fmask=133 0 0
rTorrent is recommended for its lightweightness and speed.
To provide basic file sharing through SMB start/enable smb.service and/or nmb.service services. The nmb.service service may not always be required (nmbd - NetBIOS name server to provide NetBIOS over IP naming services to clients).
Note: In samba 4.8.0-1, the units were renamed from smbd.service and nmbd.service to smb.service and nmb.service.
The smbd/nmbd/winbindd services have been renamed to smb/nmb/winbind from samba 4.8.0-1.
#----- Add a user
smbpasswd -a samba_user
# Change password
#----- List users
pdbedit -L -v
It contains package descriptions (PKGBUILDs) that allow you to compile a package from source with makepkg and then install it via pacman.
Good packages may be entered into the community repository (directly accessible by pacman or abs).
CAUTION: carefully check the PKGBUILD and any .install file for malicious commands.
# Make sure build tools are installed.
pacman -S --needed base-devel
# Optimize /etc/makepkg.conf
tar -xvf foo.tar.gz
# -s, --syncdeps, Install missing dependencies using pacman.
# -r/--rmdeps removes the build-time dependencies after build
# -U, --upgrade, Upgrade or add package(s) to the system and install the required dependencies from sync repositories.
sudo pacman -U foo-0.1-1-i686.pkg.tar.xz
# To list all foreign packages:
# -Q, --query
# -m, --foreign, Restrict or filter output to packages that were not found in the sync database(s). Typically these are packages that were downloaded manually and installed with --upgrade.
# -s, --recursive: Remove each target specified including all of their dependencies, provided that (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recursive and analogous to a backwards --sync operation, and it helps keep a clean system without orphans. If you want to omit condition (B), pass this option twice.
pacman -Rss packageName
To verify you are booted in UEFI mode, run: efivar -l.
If you are using an Intel video chipset and the screen goes blank during the boot process, the problem is likely an issue with Kernel mode setting. A possible workaround may be achieved by rebooting and pressing Tab over the entry that you are trying to boot (i686 or x86_64). At the end of the string type nomodeset and press Enter. Alternatively, try video=SVIDEO-1:d which, if it works, will not disable kernel mode setting. You can also try i915.modeset=0.
If the screen does not go blank and the boot process gets stuck while trying to load the kernel, press Tab while hovering over the menu entry, type acpi=off at the end of the string and press Enter.
# Tab-completion is available by doing:
# To list the current status of modules, versions and kernels within the tree:
# Rebuild all modules for the currently running kernel:
# For a specific kernel:
dkms autoinstall -k 3.16.4-1-ARCH
# To build a specific module for the currently running kernel:
dkms install -m nvidia -v 334.21
# or simply:
dkms install nvidia/334.21
# To build a module for all kernels:
dkms install nvidia/334.21 --all
# To remove a module (old ones are not automatically removed):
dkms remove -m nvidia -v 331.49 --all
# or simply:
dkms remove nvidia/331.49 --all
pacman -Qo /bin/netstat
# /bin/netstat is owned by net-tools 1.60.20110819cvs-3
# So install "net-tools" will let you have netstat/route back.
# NOTE: net-tools are deprecated and you should be using iproute2 instead. e.g. use "ss" instead of netstat.
SuperUser. Whatprovides equivalent for arch/pacman.
sudo pkgfile -u
# -s, --search. It is the default operation.
pkgfile -s aclocal