上传文件至 /
This commit is contained in:
425
alias (1).txt
Normal file
425
alias (1).txt
Normal file
@@ -0,0 +1,425 @@
|
||||
alias docker-compose='docker compose'
|
||||
alias sc='syncthing'
|
||||
alias nhs='nano ~/.bash_history'
|
||||
nc() {
|
||||
nano /etc/caddy/sites/$1.txt
|
||||
systemctl restart caddy
|
||||
systemctl status caddy
|
||||
}
|
||||
alias op='openlist'
|
||||
alias ct='cd /opt/tmp'
|
||||
alias nsh='nano ~/.ssh/config'
|
||||
alias las='echo $SSH_CLIENT'
|
||||
alias csh='cd /opt/data/oplist/share && ls'
|
||||
alias dip="docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
|
||||
alias tal='tar -tvf'
|
||||
tax() {
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: tax <archive.tar.*> <destination_directory>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local archive="$1"
|
||||
local destination="$2"
|
||||
|
||||
case "$archive" in
|
||||
*.tar)
|
||||
tar -xvf "$archive" -C "$destination"
|
||||
;;
|
||||
*.tar.gz|*.tgz)
|
||||
tar -xzvf "$archive" -C "$destination"
|
||||
;;
|
||||
*.tar.bz2|*.tbz2)
|
||||
tar -xjvf "$archive" -C "$destination"
|
||||
;;
|
||||
*.tar.xz|*.txz)
|
||||
tar -xJvf "$archive" -C "$destination"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported archive format: $archive"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
tac() {
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: tac <archive.tar.*> <file_or_directory1> [<file_or_directory2> ...]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local archive="$1"
|
||||
shift # 移除第一个参数,剩下的都是要压缩的文件或目录
|
||||
|
||||
case "$archive" in
|
||||
*.tar)
|
||||
tar -cvf "$archive" "$@"
|
||||
;;
|
||||
*.tar.gz|*.tgz)
|
||||
tar -czvf "$archive" "$@"
|
||||
;;
|
||||
*.tar.bz2|*.tbz2)
|
||||
tar -cjvf "$archive" "$@"
|
||||
;;
|
||||
*.tar.xz|*.txz)
|
||||
tar -cJvf "$archive" "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported archive format: $archive"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
alias csv='cd /etc/systemd/system/ && ls'
|
||||
alias sql='mysql -u root -p'
|
||||
alias hs='history'
|
||||
alias lg='journalctl -xeu'
|
||||
alias gc='git clone'
|
||||
alias gcm='git commit -m'
|
||||
alias gph='git push'
|
||||
alias gph='git pull'
|
||||
alias sq='sqlite3'
|
||||
alias sbx='sing-box'
|
||||
|
||||
coa() {
|
||||
conda activate $1
|
||||
}
|
||||
|
||||
cod() {
|
||||
conda deactivate
|
||||
}
|
||||
|
||||
coc() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: cac <env_name> [python_version]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
echo "y" | conda create --name "$1"
|
||||
else
|
||||
echo "y" | conda create --name "$1" python="$2"
|
||||
fi
|
||||
}
|
||||
|
||||
alias col='conda env list'
|
||||
|
||||
cor() {
|
||||
conda env remove --name $1 --yes
|
||||
}
|
||||
|
||||
alias py='python'
|
||||
|
||||
alias sts='systemctl status'
|
||||
alias sdr='systemctl daemon-reload'
|
||||
|
||||
function str() {
|
||||
systemctl start "$1" && systemctl status "$1"
|
||||
}
|
||||
|
||||
function stp() {
|
||||
systemctl stop "$1" && systemctl status "$1"
|
||||
}
|
||||
|
||||
function rstr() {
|
||||
systemctl restart "$1" && sleep 3 && systemctl status "$1"
|
||||
}
|
||||
|
||||
alias enable='systemctl enable'
|
||||
alias disable='systemctl disable'
|
||||
alias sdr='systemctl daemon-reload'
|
||||
alias nsr='nginx -s reload'
|
||||
alias a='aria2c -c -s4 -x4'
|
||||
alias pon="export ALL_PROXY=http://localhost:2080 https_proxy=http://localhost:2080 http_proxy=http://localhost:2080 && curl ip.sb"
|
||||
alias pof="unset ALL_PROXY http_proxy https_proxy && curl ip.sb"
|
||||
alias d='docker'
|
||||
alias ds='docker stop'
|
||||
alias dst='docker stats'
|
||||
alias dr='docker run'
|
||||
alias drs='docker restart'
|
||||
alias drm='docker rm'
|
||||
alias dlg='docker logs'
|
||||
alias dc='docker compose'
|
||||
alias dp='docker ps'
|
||||
alias dbp='echo "y" | docker builder prune'
|
||||
alias dpa='docker ps -a'
|
||||
alias dcu='docker compose up'
|
||||
alias dcud='docker compose up -d'
|
||||
alias dcd='docker compose down'
|
||||
alias dcr='docker compose restart'
|
||||
alias dcp='docker compose pull'
|
||||
alias dcs='docker compose stop'
|
||||
alias dct='docker commit'
|
||||
alias dim='docker images'
|
||||
alias dvl='docker volume ls'
|
||||
alias dvi='docker volume inspect'
|
||||
alias dvc='docker volume create'
|
||||
alias dpr='echo "y" | docker image prune && docker images'
|
||||
|
||||
dln() {
|
||||
ln -s /var/lib/docker/volumes/$1/_data $2
|
||||
}
|
||||
|
||||
dt() {
|
||||
docker run --rm -it $1 sh
|
||||
}
|
||||
|
||||
dbd() {
|
||||
docker build -t git.nvme.cc/adminroot/$1 .
|
||||
docker images
|
||||
}
|
||||
|
||||
dpu() {
|
||||
docker push git.nvme.cc/adminroot/$1:latest
|
||||
}
|
||||
|
||||
alias dvr='docker volume rm -f'
|
||||
alias dfv='docker system df -v'
|
||||
|
||||
alias w='wget --content-disposition'
|
||||
alias h='htop'
|
||||
|
||||
c() {
|
||||
if [ -z "$1" ]; then
|
||||
cd ~
|
||||
else
|
||||
cd "$1"
|
||||
fi
|
||||
ls
|
||||
}
|
||||
|
||||
alias cdd='cd ../ && ls'
|
||||
|
||||
alias cv='cd /var && ls'
|
||||
alias ce='cd /etc && ls'
|
||||
alias co='cd /opt && ls'
|
||||
alias cw='cd /opt/web && ls'
|
||||
alias cn='cd /etc/caddy/sites && ls'
|
||||
alias dfh='df -h | grep -v '/var/lib/docker' | grep -vE '^tmpfs''
|
||||
alias sr='source /etc/profile && source ~/.bashrc'
|
||||
alias nn='nano'
|
||||
alias nnd='nano compose.yml'
|
||||
alias wgq='wg-quick'
|
||||
alias dush='du -sh'
|
||||
|
||||
function din() {
|
||||
docker exec -it "$1" /bin/sh
|
||||
}
|
||||
|
||||
portcheck() {
|
||||
lsof -i :$1
|
||||
}
|
||||
alias p='portcheck'
|
||||
|
||||
countfiles() {
|
||||
dir="${1:-.}"
|
||||
find "$dir" -type f | rev | cut -d"." -f1 | rev | sort | uniq -c
|
||||
}
|
||||
alias lst=countfiles
|
||||
|
||||
lsd() {
|
||||
du -h --max-depth=1 $1 | sort -h
|
||||
}
|
||||
|
||||
findfile() {
|
||||
find . -type f -name "*.$1" -exec du -h '{}' + | sort -h
|
||||
}
|
||||
alias f='findfile'
|
||||
|
||||
alias neo='neofetch'
|
||||
alias nb='nano ~/.bashrc'
|
||||
alias na='nano ~/.alias.txt'
|
||||
alias mk='mkdir -p'
|
||||
alias scr='screen -r'
|
||||
alias scs='screen -S'
|
||||
alias scl='screen -ls'
|
||||
alias l='ls'
|
||||
alias ln='ln -s'
|
||||
|
||||
alias tt='tmux'
|
||||
alias tn='tmux new'
|
||||
alias tns='tmux new -s'
|
||||
alias tls='tmux ls'
|
||||
alias t='tmux attach'
|
||||
alias tat='tmux attach -t'
|
||||
alias trt='tmux rename-session -t'
|
||||
alias tst='tmux switch -t'
|
||||
#alias sa='find / -type f -name'
|
||||
#alias fi='find . -type f -name'
|
||||
alias s='ls'
|
||||
|
||||
alias cc='cbm'
|
||||
|
||||
alias v2='v2ray'
|
||||
|
||||
alias ary='apt remove -y'
|
||||
alias auy='apt update -y'
|
||||
alias aiy='apt install -y'
|
||||
alias agy='apt upgrade -y'
|
||||
|
||||
alias rm='rm -r'
|
||||
alias cp='cp -r'
|
||||
|
||||
alias 7za='7z a -m0=Copy'
|
||||
#alias 7zx='f() { 7z x "$1" -o"$2"; }; f'
|
||||
function 7zx() {
|
||||
local archive="$1"
|
||||
local outdir="${2:-.}"
|
||||
|
||||
if [[ ! -f "$archive" ]]; then
|
||||
echo "❌ 文件不存在: $archive" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "$outdir"
|
||||
|
||||
local lower_name="${archive,,}" # 全小写处理后缀名,提升兼容性
|
||||
|
||||
# 支持的 .tar.* 格式(多层压缩)
|
||||
local tar_pattern='\.(tar\.xz|txz|tar\.gz|tgz|tar\.bz2|tbz2|tar\.zst|tzst)$'
|
||||
|
||||
# 支持的直接压缩格式
|
||||
local direct_pattern='\.(zip|7z|rar)$'
|
||||
|
||||
if [[ "$lower_name" =~ $tar_pattern ]]; then
|
||||
# 先解压外层(xz/gz/bz2/zst),再解tar
|
||||
7z x -so "$archive" | 7z x -si -ttar -o"$outdir"
|
||||
elif [[ "$lower_name" =~ $direct_pattern ]]; then
|
||||
# 直接解压
|
||||
7z x "$archive" -o"$outdir"
|
||||
else
|
||||
echo "⚠️ 不支持的格式: $archive" >&2
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
function 7zxd() {
|
||||
local password="$1"
|
||||
local files=()
|
||||
|
||||
# 搜索所有压缩包(支持分卷 .part1.rar/.001)
|
||||
while IFS= read -r -d '' f; do
|
||||
files+=("$f")
|
||||
done < <(find . -maxdepth 1 -type f \( \
|
||||
-iname '*.zip' -o -iname '*.7z' -o -iname '*.rar' -o \
|
||||
-iname '*.tar.gz' -o -iname '*.tgz' -o -iname '*.tar.bz2' -o -iname '*.tbz2' -o \
|
||||
-iname '*.tar.xz' -o -iname '*.txz' -o -iname '*.tar.zst' -o -iname '*.tzst' -o \
|
||||
-iname '*.part1.rar' -o -iname '*.001' \
|
||||
\) -print0)
|
||||
|
||||
if [[ ${#files[@]} -eq 0 ]]; then
|
||||
echo "📂 当前目录下无可解压的压缩包"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
echo "📦 正在解压: $file"
|
||||
local base="${file%.*}"
|
||||
|
||||
if [[ -n "$password" ]]; then
|
||||
7z x "$file" -p"$password" -aoa -y
|
||||
else
|
||||
7z x "$file" -aoa -y
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "✅ 解压成功,删除源文件..."
|
||||
|
||||
# 删除所有相关分卷,如 .part1.rar .part2.rar 等或 .001/.002
|
||||
local prefix="${file%%.*}"
|
||||
find . -maxdepth 1 -type f -regex "./$prefix\\..*" -delete
|
||||
else
|
||||
echo "❌ 解压失败: $file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
alias vn='vnstat'
|
||||
alias cdk='composerize'
|
||||
|
||||
pnv() {
|
||||
python3 -m venv "/www/venv/$1"
|
||||
}
|
||||
|
||||
alias dea='deactivate'
|
||||
|
||||
start_blur() {
|
||||
tmux new-session -d -s "blur"
|
||||
tmux send-keys -t "blur" "source /www/venv/face/bin/activate" C-m
|
||||
tmux send-keys -t "blur" "python /www/face/blur.py" C-m
|
||||
tmux split-window -t "blur"
|
||||
tmux select-layout -t "blur" tiled
|
||||
tmux send-keys -t "blur".1 "htop" C-m
|
||||
tmux attach-session -t "blur"
|
||||
}
|
||||
alias blur='start_blur'
|
||||
|
||||
mtm() {
|
||||
find $1 -type f \( -iname "*.mp4" -o -iname "*.avi" -o -iname "*.mov" \) -exec mv {} $2 \;
|
||||
}
|
||||
|
||||
alias gp='gping'
|
||||
alias nt='nexttrace'
|
||||
|
||||
function ua() {
|
||||
ufw allow $1 && ufw status
|
||||
}
|
||||
function ud() {
|
||||
ufw delete allow $1 && ufw status
|
||||
}
|
||||
alias us='ufw status'
|
||||
function ura() {
|
||||
ufw route allow $1 && ufw status
|
||||
}
|
||||
function urd() {
|
||||
ufw route delete allow $1 && ufw status
|
||||
}
|
||||
|
||||
alias o3='ollama run llama3'
|
||||
alias ip4='curl ip.sb -4'
|
||||
alias ip6='curl ip.sb -6'
|
||||
|
||||
alias nnc='nano /etc/caddy/Caddyfile'
|
||||
alias csr='systemctl restart caddy && systemctl status caddy'
|
||||
alias cap='caddy hash-password'
|
||||
|
||||
alias psr='systemctl restart php8.2-fpm && systemctl status php8.2-fpm'
|
||||
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
#alias =''
|
||||
|
||||
# if [ -f ~/.alias.md ]; then
|
||||
# . ~/.alias.md
|
||||
# fi
|
||||
|
||||
# 保存后运行 source ~/.bashrc
|
||||
|
||||
|
||||
bk() {
|
||||
# 检查tmux是否在运行状态,如果不是,则启动tmux
|
||||
if ! tmux ls >/dev/null 2>&1; then
|
||||
tmux new-session -d -s benchmark 'tmux rename-window "Benchmark"; /www/bk/webBenchmark_linux_x64 -c 32 -s '$1''
|
||||
else
|
||||
# 如果tmux已经运行,创建一个新窗口来运行命令
|
||||
tmux new-window -n "Benchmark" '/www/bk/webBenchmark_linux_x64 -c 32 -s '$1''
|
||||
fi
|
||||
# 可选:如果你希望自动连接到tmux会话,取消下面的注释
|
||||
tmux attach-session -d
|
||||
}
|
||||
|
||||
alias pyv='pyenv virtualenv'
|
||||
alias pya='pyenv activate'
|
||||
alias pyd='pyenv deactivate'
|
||||
alias ll='ls -a'
|
||||
Reference in New Issue
Block a user