Linux Little Tricks
搜索引擎小技巧
cats and dogsResult about cats or dogs"cats and dogs"Result about exact term “cats and dogs”cats -dogsFewer dogs in resultcats +dogsMore dogs in resultcats filetype:pdfPDFs about cats- Supported types: pdf, doc(x), xls(x), ppt(x), html
*模糊....范围intitle:标题inurl:网址related:相关类型define:wordetymology:"word,"joker site:drive.google.com
Proxy
- Browser:
SwitchyOmega - gfwlist:
https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt - Terminal Proxy
CapsLock -> Ctrl
X11
xev展示按下按键的信息pacman -S xorg-xmodmap:xmodmapxmodmap -pkexmodmap -pke > ~/.Xmodmap- 使用
remaps脚本
Wayland
dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:ctrl_modifier']"
触控板设置
- xorg 使用 libinput 配置触控板
- dwm 默认触控板无法使用单击, 双击等
- 在
xorg.conf.d目录下添加30-touchpad.conf配置文件, 并添加以下配置30表示执行顺序 (10 比 30 先执行).conf后缀 arch wiki 说必须加上不可以省略
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "TappingButtonMap" "lmr"
Option "NaturalScrolling" "true"
EndSection
多显示器设置
X11 默认多显示器是相同输出, xrandr 可以用来查看显示器输出端口的信息, 可以通过两种方式设置
xrandr --output DP1 --auto --right-of eDP1可以设置显示器显示不同的内容- 设置配置文件
/etc/X11/xorg.conf.d/40-monitor.conf
Section "Device"
Identifier "Intel Corporation HD Graphics 630" # 视频输出的显卡名,可以通过 `lspci -v` 查看
Option "Monitor-eDP1" "eDP1 screen"
Option "Monitor-DP1" "DP1 screen"
EndSection
Section "Monitor"
Identifier "DP1 screen"
Option "RightOf" "eDP1 screen"
EndSection
Section "Monitor"
Identifier "eDP1 screen"
EndSection
- 设置 Xorg 多显示器显示相同的内容
xrandr --output DP1 --auto --same-as eDP1--mode可以设置分辨率
Archlinux install Latex
pacman -S texlive-most-
texlive-mostis a package group, includestexlive-core texlive-bin -
texlive-lang添加除英文外的其他语言的支持, 不推荐安装
-
pdftex '\empty Hello World!\bye'查看是否安装成功texdoc查看帮助文档的命令
NetworkManager
设置 grub 主题
- 复制 grub2 主题到
/boot/grub/themes vim /etc/default/grub修改GRUB_THEME=/boot/grub/themes/{theme_name}/theme.txtgrub-mkconfig -o /boot/grub/grub.cfg重新创建 grub 配置
archlinux using 32位 gcc
首先, 修改 /etc/pacman.conf 文件
[multilib]
Include = /etc/pacman.d/mirrorlist
安装 pacamn -S multilib-devel lib32-glibc lib32-gcc-libs
使用 cronie 设置定时任务
tmux 使用 ssh 连接,断开连接后 tmux session 也会关闭的问题
- 默认应该是不会发生这种情况的,但如果发生了看下面的解决办法
- 编辑
/etc/systemd/logind.conf文件 - 设置
KillExcludeUsers=root MY_USERNAME和KillUserProcess=no - 产生问题的原因应该是 optimus manager 在这个文件中
/usr/lib/systemd/logind.conf.d/*.conf设置了KillUserProcess=yes - tmux server being killed after logging out
使用 laptop 时关闭合盖后依然保持运行
- 编辑
/etc/systemd/logind.conf文件 - 设置
HandleLidSwitch=ignore变量重启系统即可 - how to disable auto suspend when i close laptop lid
systemd
.service文件位置:/usr/lib/systemd/system//usr/lib/systemd/user/~/.config/systemd/user/- how-to-set-up-an-automatic-restart-of-a-background-ssh-tunnel
- tunnelling-with-ssh-different-approaches-and-tips
file permissions
- files
- Read – Can view or copy file contents
- Write – Can modify file content
- Execute – Can run the file (if its executable)
- directories
- Read – Can list all files and copy the files from directory
- Write – Can add or delete files into directory (needs execute permission as well)
- Execute – Can enter the directory
locale problem: not found files
- Arch: See Installation Guide
- Fedora:
dnf install langpacks-zh_CN - Ubuntu:
cd /usr/share/locales./install-language-pack zh_CN.UTF-8dpkg-reconfigure locales
X11 Debug a Window Manager
- use
Xephyr :1to start a new DISPLAY server - use
DISPLAY=:1 {gui_command}to startgui_commandin the new server
ubuntu using x11 instead of wayland
vim /etc/gdm3/custom.conf- uncomment this line
#WaylandEnable=false
ubuntu disable showing icons in desktop
sudo apt remove gnome-shell-extension-desktop-icons-ng -y- ref: How disable show folder in desktop ubuntu?
VirtualBox
Arch Linux Install
pacman -S virtualbox- 使用
virtualbox-host-modules-arch内核依赖
- 使用
- 创建虚拟机有问题就重新加载内核执行命令
sudo vboxreload - Install extpack
- download the extension manually
sudo VBoxManage extpack install <.vbox-extpack>
VirtualBox in windows 11 are so slow
< << <<< <()
<: The input redirectioncat < README.md<<: The here documentcat > output.txt <<EOFthe EOF is an DELIMITER, when stdin recives the DELIMITER, the stdin will close<<<: The here stringcat <<< "Demo text"input one line of stings to a script or a command.<(): redirection command output to another commandcat <(echo "Demo text")
login-shell and non-login-shell
login-shell does not source .*rc(.bashrc for bash) file, only source profile(.bash_profile for bash)
voidlinux fix ugly font display
sudo ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/- firefox_ugly_fonts
raspberry pi 4 & 5 unable to connect to hidden wifi network
If you have tried almost all of the methods that other people says, but also didn’t work for you, try to set the WLAN localization properly.
Using raspi-config is a simple way to set localization.