Toolchain
Package Manager
Rpm
安装和卸载时同时存在依赖性(包依赖、库依赖)
rpm 查询:
- -q 包名 查询已安装的包 //必备参数
- -a 查询所有已安装的包
- -i 查询软件信息
- -l list
- -f 查询系统文件属于哪个软件包
- -R 查询软件包的依赖性
- -p 查询未安装包 //普适参数
rpm 校验(查看 Cracker 信息):
- -V 校验已安装包 相应信息不是.号便是被修改项 可用于找回丢失的系统命令
Yum
源配置文件:/etc/yum.repos.d
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bk
wget https://mirrors.163.com/.help/CentOS7-Base-163.repo
yum makecache
- yum list
- yum search 'keyword'
- yum -y(自动回答 yes) install 包名
- yum -y update 包名
- yum -y remove 包名
- yum grouplist
- yum groupinstall 软件组名
- yum groupremove 软件组名
Source Code Installation
指定位置:
- /usr/local/软件名/
- /usr/local/src/软件名/
(如上述脚本出错,执行 make clean)
make install
e.g. apache /var/www/html/index.html /usr/local/apache/htdocs/index.html
Applications Management
- desktop shortcut:
/usr/share/applications - startup apps:
gnome-session-propertiesorgnome-tweaks
Default Management
update-alternatives: maintain symbolic links determining default commands.
sudo update-alternatives --get-selections
sudo update-alternatives --install /usr/bin/x-terminal-emulator
\ x-terminal-emulator /opt/Hyper/hyper 50
sudo update-alternatives --config x-terminal-emulator
APT Key
# Add key
sudo apt-add-repository ppa:user/repo
sudo apt update
# Delete key via last 8 bits
sudo apt-key list
sudo apt-key del 73C62A18
sudo apt update
C++ Binary
Ldd
ldd ./lib.sio
Nm
nm -Ca ./lib.so
Plot
chart.gp
#!/usr/bin/env gnuplot
set term wxt enhanced
set xtics
set view
set multiplot
set size
set origin
fit
plot 'data.dat' using 1:2, 'data.dat' using 1:3
#!/usr/bin/gnuplot -c
set terminal png enhanced
set output ARG1.".png"
set style data linespoints
show timestamp
set title ARG1
set xlabel "time (seconds)"
set ylabel "Segments (cwnd, ssthresh)"
plot ARG1 using 1:7 title "snd_cwnd", \
ARG1 using 1:($8>=2147483647 ? 0 : $8) title "snd_ssthresh"
Modern Unix
- Cross-platform Rust rewrite of the GNU core utils.
- Modern alternatives to common unix commands.
scoop install volta zoxide bat eza delta dust duf fd ripgrep fzf jq fx tlrc bottom gping procs curlie
alias app="scoop"
alias cc="claude"
alias ccc="claude -c"
alias code="cursor"
alias np="pnpm"
alias vim="nvim"
alias cd="z"
alias cat="bat"
alias ls="eza"
alias du="dust"
alias df="duf"
alias find="fd --hidden --follow --exclude .git"
alias grep="rg"
alias man="tldr"
alias top="btm"
alias ping="gping"
alias ps="procs"
alias curl="curlie"
eval "$(zoxide init bash)"
eval "$(fzf --bash)"
source <(fx --comp bash)
bind 'set bell-style none'
# Use fd for listing path candidates
_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" . "$1"
}
# Use fd for list directory candidates
_fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix --hidden --follow --exclude .git"
export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
Scoop
# Command-line installer for Windows
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
scoop search bat
scoop install eza
scoop info fzf
scoop bucket add extras
WinGet
winget search steam
winget install Microsoft.VisualStudioCode
winget show vscode
winget list
Scoop vs WinGet
Scoop is command line installer, while WinGet is app installer.
Volta
curl https://get.volta.sh | bash
scoop install volta
winget install Volta.Volta
volta setup
volta install node
volta list
Zoxide
brew install zoxide
scoop install zoxide
winget install ajeetdsouza.zoxide
alias cd="z"
eval "$(zoxide init bash)"
Bat
bat:
brew install bat
scoop install bat
winget install sharkdp.bat
alias cat="bat"
Eza
eza:
brew install eza
scoop install eza
winget install eza-community.eza
alias ls="eza"
Delta
brew install git-delta
scoop install delta
winget install dandavison.delta
git config --global core.pager delta
git config --global interactive.diffFilter 'delta --color-only'
git config --global delta.navigate true
git config --global delta.dark true
git config --global delta.line-numbers true
git config --global delta.side-by-side true
git config --global merge.conflictStyle zdiff3
git diff
git show
git add -p
git log -p
git stash show -p
git reflog -p
Dust
dust:
brew install dust
scoop install dust
winget install bootandy.dust
alias du="dust"
Duf
duf:
brew install duf
scoop install duf
winget install muesli.duf
alias df="duf"
Fd
fd:
brew install fd
scoop install fd
winget install sharkdp.fd
alias find="fd --hidden --follow --exclude .git"
RipGrep
rg:
brew install ripgrep
winget install BurntSushi.ripgrep.MSVC
scoop install ripgrep
alias grep="rg"
export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
$HOME/.ripgreprc:
# Add 'web' type.
--type-add
web:*.{html,css,js,jsx,ts,tsx,vue,svelte,astro}*
# Search hidden files / directories (e.g. dotfiles) by default
--hidden
# Using glob patterns to include/exclude files or folders
--glob
!**/.git/*
# Ignore case unless all caps
--smart-case
# Show file list with `-l`
rg -l text
Fzf
fzf:
brew install fzf
winget install fzf
scoop install fzf
# ~/.bashrc
eval "$(fzf --bash)"
# ~/.zshrc
source <(fzf --zsh)
# Use fd for listing path candidates
_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" . "$1"
}
# Use fd for list directory candidates
_fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
# Respecting `.gitignore`
export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix --hidden --follow --exclude .git"
Command line fuzzy finder:
ctrl-r: find commands.ctrl-t: find files and directories.alt-c:cdinto directory.code **<TAB>/code $(fzf -m): fuzzy completion for files and directories.ctrl-k/ctrl-j: move cursor up and down.- Multi-select(
-m):tabandshift-tabto mark multiple items.
Jq
jq:
brew install jq
scoop install jq
winget install jqlang.jq
echo "version=$(jq -r '.devDependencies["@playwright/test"]' package.json | sed 's/^[^0-9]*//')"
Fx
fx:
brew install fx
scoop install fx
# ~/.bashrc
source <(fx --comp bash)
# ~/.zshrc
source <(fx --comp zsh)
Terminal JSON viewer and processor:
# Hello world
echo '{"name": "world"}' | fx 'x => x.name' 'x => `Hello, ${x}!`'
# Bump version
fx package.json 'x.version = x.version.replace(/\d+$/, n => +n + 1), x'
# Interactive JSON viewer
curl -i https://fx.wtf/example.json | fx
TLDR
TLDR:
brew install tlrc
scoop install tlrc
winget install tldr-pages.tlrc
alias man="tldr"
Bottom
brew install bottom
scoop install bottom
winget install Clement.bottom
alias top="btm"
Gping
brew install gping
scoop install gping
winget install orf.gping
alias ping="gping"
Procs
brew install procs
scoop install procs
winget install dalance.procs
alias ps="procs"
Curlie
brew install curlie
scoop install curlie
alias curl="curlie"