Arch Linux Notes
////////////////////////////////////////////// Author: Created by Nixawk Time: 2014-12-17 |
1. Install Arch Linuxhttps://wiki.archlinux.org/index.php/Beginners%27_guide_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) -------- Install Awesome -------- # pacman -S slim awesome # pacman -Ss intel | grep --color -i video (install video driver) # video driver # pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils # vi /etc/slim.conf + session awesome # systemctl start slim.service # mkdir -p ~/.config/awesome/ # cp /etc/skel/rc.lua ~/.config/awesome # vi ~/.xinitrc + exec awesome # chmod u+x ~/.xinitrc -------- Install xface -------- https://wiki.archlinux.org/index.php/Xorg_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29 http://www.neuraladvance.com/installing-xfce-410-on-arch-linux.html lspci | grep VGA pacman -S xf86-video-vesa pacman -S xorg-server slim xfce4 xorg-twm xorg-xclock xterm startxfce4 -------- fluxbox/openbox ------- how to install fluxbox/openbox ? pacman -S terminus-font pacman -S alsa-utils ---- ScreenSaver pacman -S xscreensaver vi ~/.xinitrc + xscreensaver -nosplash & vi ~/.config/awesome/rc.lua + awful.key({ modkey, "Control" }, "l", function awful.util.spawn("xscreensaver-command -lock") end) |
2. Package Managementpacman guide help>> https://wiki.archlinux.org/index.php/Pacman_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29 man pacman usage>> pacman <operation> [options] [targets] <operation> -D, --database -Q, --query -R, --remove -S, --sync -T, --deptest -U, --upgrade -V, --version -h, --help <options> -b, --dbpath <full path> -r, --root <path> -v, --verbose --arch <arch> --cachedir <dir> --color <file> --config <file> --debug --gpgdir <dir> --logfile <full path> --noconfirm <TRANSACTION OPTIONS> [-S, -R, -U] -d, --nodeps --dbonly --noprogressbar --noscriptlet --p, --print --print-format <format> <UPGRADE OPTIONS> --force --asdeps --asexplicit --ignore <package> --ignoregroup <group> --needed <QUERY OPTIONS> -c, --changelog -d, --deps -e, --explcit -g, --groups -i, --info -k, --check -l, --list -m, --foreign -n, --native -o, --owns <file> -p, --file -q, --quite -s, --search <regexp> -t, --unrequired -u, --upgrades <REMOVE OPTIONS> -c, --cascade -n, --nosave -s, --recursive -u, --nneeded <SYNC OPTIONS> -c, --clean -g, --groups -i, --info -l, --list -q, --quite -s, --search <regexp> -u, --sysupgrade -w, --downloadonly -y, --refresh pacman configuration file /etc/pacman.conf DBPath ---- /var/lib/pacman/ CacheDir ---- /var/cache/pacman/pkg/ LogFile ---- /var/log/pacman.log GPGDir ---- /etc/pacman.d/gnupg Mirrorlist ---- /etc/pacman.d/mirrorlist 删除软件包 pacman -R ---- 删除软件包(删除单个软件包,保留其全部已经安装的依赖关系) pacman -Rs ---- 删除软件包(保留与其他已安装软件存在依赖的包) pacman -Rsc ---- 删除软件包(及所有的依赖,此操作是递归的,可能会删除大量的软件包) pacman -Rn pacman -Rsn 同步软件包 pacman -S --help ---- 查询远程同步的数据库 pacman -S package_name ---- 安装多个软件包(空格分开) pacman -S "package>=version" ---- 安装某个版本的软件包 pacman -Ss package_name ---- 在包数据库中查询软件包 pacman -Si package_name ---- 显示软件包信息 pacman -Sc ---- 清理软件包缓存 pacman -Su ---- 更新已安装的旧数据包 pacman -Syyu ---- 强制数据库更新和升级 pacman -Syy ---- 更新数据库 pacman -Syu ---- 升级整个系统(滚动升级) pacman -Sw package_name ---- 下载包不安装包 pacman -sS package_name == pacman -Ss package_name ---- ???? pacman -Sgl package_group ---- 查看分组包 pacman -S package_group ---- 安装分组包 查询软件包 pacman -Q --help ---- 查询本地软件包数据库 pacman -Qs package_name ---- 查询已安装的软件包 pacman -Qi package_name ---- 显示已安装软件包的信息 pacman -Qii package_name ---- 显示已安装包的备份文件与修改状态 pacman -Ql package_name ---- 获取以安装软件包所包含的文件列表 pacman -Qu ---- 识别旧版本,尝试升级 pacman -Ql openssh | grep bin 更新数据包 pacman -U /path/to/pack.pkg.tar.xz ---- 安装一个本地包 pacman -U http://demo/pack.tar.xz ---- 安装远程的包 pkgfile -l package_name ---- 查看某个包的文件列表(未安装包) psctraa package_name ---- 显示软件包的以来树 whoneeds package_name ---- 查看已安装的软件包被哪些包依赖 pacsysclean ---- 查看已安装包的大小 |
3. User Accountsuseradd -m -d /home/paul -s /usr/bin/zsh paul && passwd paul sudo password paul |
4. System Servicessystemctl # 等效于systemctl list-units systemctl list-units # 输出激活的单元 systemctl list-units --type=service # 输出当前激活的服务单元 systemctl --failed # 输出失败的单元 systemctl list-unit-files # 查看所有安装的服务 systemctl 所有可用的单元文件存放在: /usr/lib/systemd/system /etc/systemd/system systemctl is-enabled sshd.service systemctl enable/disable sshd.service systemctl reboot/poweroff/suspend/hibernate/hybird-sleep https://wiki.archlinux.org/index.php/Systemd_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) systemctl使用单元 .service ---- 系统服务 .mount ---- 挂载点 .sockets ---- sockets .device ---- 系统设备 .swap ---- 交换分区 .path ---- 文件路径 .target ---- 启动目标 .timer ---- system管理的计时器 systemctl start <单元> # 立即激活单元 systemctl stop <单元> # 立即停止单元 systemctl restart <单元> # 重启单元 systemctl reload <单元> # 重新加载配置 systemctl status <单元> # 输出单元的运行状态. 例如: systemctl status sshd.service systemctl is-enabled <单元> # 检测单元是否自动启动 systemctl enable <单元> # 开机自动激活单元 systemctl disable <单元> # 取消开机自动激活单元 systemctl help <单元> # 显示单元的手册页 systemctl daemon-reload # 重新载入systemd, 扫描所有新的或者变动的单元 电源管理 systemctl reboot # 重启 systemctl poweroff # 退出系统并停止电源 systemctl suspend # 待机 systemctl hibernate # 休眠 systemctl hybird-sleep # 混合休眠模式 |
5. System log Managementjournalctl journalctl -b -0 # 显示本次启动的信息 journalctl -b -1 # 显示上次启动的信息 journalctl -b -2 # 显示上上次启动的信息 journalctl -f # 显示最新的日志 journalctl /usr/lib/systemd/systemd # 显示最新信息 journalctl _PID=1 # 显示特定进程的消息 journalctl --unit sshd # 显示指定单元的消息 journalctl -k # 显示内核信息 journalctl --boot journalctl -l /etc/systemd/journald.conf utmpdump /var/log/wtmp == last /var/log/lastlog ---- 该日志记录最近登录成功和最后一次登录不成功的事件. /var/log/user.log # 记录所有等级用户的日志 /var/log/Xorg.x.log # 记录X的日志 /var/log/syslog acpid ---- 电源管理 avahi-daemon dbus dhclient kernel mtp-probe NetworkManager /USR/SBIN/CRON wpa_supplicant /var/log/pm-suspend.log /var/log/pm-powersave.log /var/log/messages /var/log/kern.log /var/log/faillog ---- faillog /var/log/dpkg.log ---- 软件包安装的日志 /var/run/user/ ++++++++++++ SSH 日志 systemctl status sshd.service journalctl --unit sshd ss -snt w last lastlog finger pinky who -a |
6. Misc# take a screenshot https://wiki.archlinux.org/index.php/Table_of_Contents_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29 pacman -S scrot https://wiki.archlinux.org/index.php/Taking_a_Screenshot_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29 $ xev $ vim ~/.config/awesome/rc/lua $ mkdir -p ~/screeshots + awful.key({ }, "Print", function () awful.util.spawn("scrot -e ‘mv $f ~/screenshots/ 2>/dev/null‘") end) # IRC pacman -S irssi https://wiki.archlinux.org/index.php/Irssi_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29 irssi> /connect irc.freenode.net /join #archlinux pacman -S binutils # strings pacman -S x11vnc x11vnc -display :0 pacman -S strings strace ls # Trace the Execution of an Executable strace -c ls # Generate Statistics Report of System Calls Using Option -c strace -e write ls # Trace a Specific System Calls strace -o out.txt ls # Save the Trace Execution to a File Using Option -o strace -p 3389 # Execute Strace on a Running Linux Process Using Option -p strace -t -e open ls # Print Timestamp for Each Trace Output Line Option -t strace -r ls # Print Relative Time for System Calls strace -e trace=process cat /dev/null # Trace process info [set, file, process, network, singal] strace -e open,read,write id # Trace open,read,write command. |
7. Key bindingsawesome Desktop Mod4 + Left # pervious windows Mod4 + Right # next tag Mod4 + Escape # show desktop Mod4 + j # next windpws Mod4 + k # pervious windows Mod4 + w # Main Menu Mod4 + Return # Spawn a terminal Mod4 + Control + r # awesome restart Mod4 + Shift + q # awesome quit Mod4 + l # increase 0.05 Mod4 + h # increase -0.05 Mod4 + Shift + h # increse 1 Mod4 + Shift + j # move windows to the next Mod4 + Shift + k # move windows to the previous Mod4 + space # layout Mod4 + Shift + space # layout Mod4 + Ctrl + n # Mod4 + r # run a command Mod4 + x # execute lua code Mod4 + p # menubar show Mod4 + f # fullsreen Mod4 + Shift + c # kill Mod4 + Ctrl + space # floating space Mod4 + Control + Return# Mod4 + o # screen tranfs Mod4 + t # ontop Mod4 + n # Min Mod4 + m # Max Mod4 + 1,...,9 # Windows 1 or Windows 9 |
8. VirtualBox# pacman -S virtualbox virtualbox-host-dkms virtualbox-host-modules qt4 # modprobe vboxdrv # modprobe vboxnetflt # pacman -S gksu # vim /etc/modules-load.d/virtualbox.conf + vboxdrv + vboxnetflt + vboxadp + vboxpci The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing ‘pacman -S virtualbox-host-modules‘ as root. If you don‘t use our stock kernel, install # modprobe vboxdrv # systemctl enable dkms.service VBoxManage: error: Filed to install "/home/someone/Oracle_VM_VirtualBox_Extension_Pack-4.3.20-12314.vbox-extpack": The installer failed with exit code 127: Error executing command as another user: No authentication agent was found. # pacman -S gksu |