Config文档

记录下常用的配置

git proxy

让 git 走代理, 基本可以达到满速

git config --global http.https://github.com.proxy socks5h://127.0.0.1:10808

删除代理

git config --global --unset http.https://github.com.proxy

zsh

apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

zshrc

# theme
ZSH_THEME="ys"

# alias
alias ctf="cd /mnt/hgfs/ctf"
alias tools="cd /mnt/hgfs/tools"
alias clash="~/clash/clash -d ~/clash/"
alias htbvpn="openvpn ~/cjM00N.ovpn"
alias pc="proxychains"
alias tmuxa="tmux a -t"
alias tmuxn="tmux new -s"
alias vi="vim"
alias burp="/opt/Burpsuite/start.sh"

内外网切换

netstat -nr 查看路由表
sudo route delete 0.0.0.0 删除默认路由
sudo route add -net 0.0.0.0 192.168.1.1 默认使用192.168.1.1网关
sudo route add 10.200.0.0 10.200.22.254 有线网卡使用该网关
sudo route add 10.0.1.0/24 10.200.22.254 其它网段指定网关

切换 java 版本

update-alternatives  --config  java

tmux 配置

# reload with Ctrl+r
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# vi keymap
set-option -g status-keys vi
set-window-option -g mode-keys vi

# vi-type selection and copy
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel

# choose pane with vi-key
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R

# exec command man
bind m command-prompt "splitw -h 'exec man %%'"

# add Ctrl+a to prefix key
set -g prefix2 C-a
bind C-a send-prefix -2

# new pane - =
# horizontal
unbind '"'
bind - splitw -v -c '#{pane_current_path}'
# vertical
unbind %
bind = splitw -h -c '#{pane_current_path}'

# color
set -g default-terminal "screen-256color"

# rename
setw -g automatic-rename off
setw -g allow-rename off

# mouse
set -g mouse on

# ------ status theme -------------------------------
set -g status-right "#[bg=red, fg=white, bold] #(whoami) #[bg=white, fg=black] %Y-%m-%d %H:%M " # user and time
# set -g status-right-length 600

set -g set-clipboard on
set -g history-limit 8000

powershell 设置别名

打开配置文件

code $PROFILE

设置别名样例如下

function cdTools{
Set-Location D:\tools
}
Set-Alias tools cdTools

重启 powershell 即可
如果是带参数的命令, 则可以通过$args来获取, 例如自动新建并打开 md

function newPost{
cdBlog
hexo new "$args"
code D:\CTF\blog\source\_post\$args.md
}

这里没有处理对于文件名的转换问题, 比如空格, 特殊符号等

整理如下

function cdBlog{
Set-Location D:\CTF\blog
}
function cdTools{
Set-Location D:\tools
}
function cdCTF {
Set-Location D:\CTF
}
function cdDownload {
Set-Location D:\jason\Downloads
}
function exThere {
explorer.exe .
}
function pushBlog {
cdBlog
hexo clean;
hexo d -g;
}
function viewBlog{
cdBlog
hexo clean;
hexo g;
hexo s;
}
function newPost {
cdBlog
hexo new "$args";
code D:\CTF\blog\source\_posts\$args.md
}
Set-Alias blog cdBlog
Set-Alias tools cdTools
Set-Alias ctf cdCTF
Set-Alias down cdDownload
Set-Alias ex exThere
Set-Alias hexod pushBlog
Set-Alias hexon newPost
Set-Alias hexos viewBlog


作者: cjm00n
地址: https://cjm00n.top/Linux/config-notes.html
版权声明: 除特别说明外,所有文章均采用 CC BY 4.0 许可协议,转载请先取得同意。

php和mysql开发笔记 Xman结营赛AWD总结

评论