昨天发布了《30 个方便的 Bash shell 别名》之后,一位读者也向我们分享了他的工具盒,特此向大家推荐:Charles 的脚本。这个工具盒可以配合作者的博客:《Ubuntu Gnome 酷炫完整指南系列》使用。
他的脚本或许写得不够精妙,也许会存在一些 bug,但是正是这种对工作、生活中的积累进行整理,才是 Linux 生活的乐趣和进取之道。大家喜欢的话,也可以贡献自己的代码和贡献,使之更加完善。
以下内容引自他的项目说明。
凡是喜欢折腾的朋友肯定经常会遇到下面几个困扰:
apt
和git
)最初因为我经常会因为愚蠢的操作把操作系统搞得崩溃,写下了本项目以便减轻重装系统之痛。后来我写了许多方便的小工具和脚本,把它们整合起来就变成了本项目:
本项目会将所有资料备份到 $CHARLES_BACKUP
即 ~/.config/CharlesBackup
,可以使用网盘或 git 自动上传备份(git备份已经集成在charles-update
命令中)
下面是是相关命令介绍:
add-ppa
: 添加 ppa
的时候同时备份 ppa
列表,在fish-shell
中运行 add-ppa (add-ppa)
可以自动添加列表中全部 ppainst
: 使用 apt
安装软件的时候同时备份软件名,在fish-shell
中运行 inst (inst)
可以自动安装列表中全部软件gnome-shell-extensions-backup
和 gnome-shell-extensions-restore
: 备份和恢复 Gnome
桌面的插件omf-backup
和 omf-restore
: 备份和恢复 oh-my-fish
(fish-shell
的包管理器)的插件列表charles-backup
: 调用上述部分命令备份各种插件(可以放到 cronjob
里面实现自动备份)charles-update
: 更新本项目及相关依赖;自动使用git上传备份通知类:
ef
、 fifo
: ef
相当于一个短时备忘录,可以用来记录笔记,相当于编辑 fifo
命令;输入fifo
即可运行之前写入的内容。notify
: 提醒你一定时间之后做某事tomato
: 简单的蕃茄钟,定时运行 fifo
命令系统操作:
update
: 相当于 pacman -Syyu
,更新所有软件apt-unlock
: 删除 apt
因为异常退出而没有删掉的文件锁get-path
: 获得选定的文件绝对路径,并放到剪贴板内mac-addr-flush
: 重置 MAC 地址(重启失效)wallpaper-earthview
: 更新桌面壁纸(需要先设置好桌面壁纸位置为 ~/.cache/wallpaper/background-image.jpg
)其他:
ssr
: ShadowSocksR 的一键安装、配置、使用客户端aria2c-daemon-start
: 启动 aria2
的下载服务gh-md-toc
: Forked 自 gh-md-toc, 为 GitHub 的 Markdown 文件加入目录gojuon
: 日语五十音学习小工具ipgw
ipgw_py
: 命令行版的东北大学校园网登录器网页相关:
wechat
: 打开微信pocket
: 打开 Pocketshanbay
: 打开扇贝单词包含在 .bashrc
或 fish-shell config.fish
中的简便操作:
写在CharlesScripts/charles/shell.rc.d
中的脚本函数:
backup
: 将文件备份(复制一份并添加.bak
后缀)cls
: cd
到指定文件夹然后ls
dict
: 将 dict
查到的单词输出到less
内,以免单词解释过长显示不完还要再翻回去看g
: 使用git
一条龙地执行 git add -A
,git diff --cached
,git status
,git commit -m <commit message>
,git push
,并检查 push 是否成功,若失败则提醒你检查一下mcd
: 先mkdir
再cd
到刚刚创建的文件夹内md5check
: md5check <file> <md5>
,用grep
检查md5是否一样viz
: 使用graphviz
编译为指定格式的图片,用法为viz source.dot png
在CharlesScripts/charles/installation.d/conf.d/config-fish
配置好的命令缩写
...
-> cd ...
c
-> clear; cd
cl
-> cd ..;ls
eg
-> grep -E
ftps
-> python3 -m http.server 8080
: 快速开启一个简易 ftp 服务器gaa
-> git add -A
gb
-> git branch -c
gck
-> git checkout
gcm
-> git commit -m
gl
-> git l
: 显示结构化的 git 日志gm
-> git merge --no-ff
gp
-> git push
gpl
-> git pull
gst
-> git status
histg
-> history | grep
i
-> ipython --no-confirm-exit --no-banner --pprint -i --pylab=auto
l
-> ls --color=auto
la
-> ls --almost-all --color=auto
le
-> ls --almost-all --color=auto|egrep
lg
-> ls --almost-all --color=auto|grep
ll
-> ls --almost-all -lh --color=auto
n
-> xdg-open .
o
-> xdg-open
p
-> python
pdb
-> python -mpowerline.bindings.pdb
su
-> sudo su
u
-> update
脚本在 CharlesScripts/charles/installation.d/get.d
标 *
的是推荐安装的
get.d/
├── get-calibre
├── get-docker
├──*get-fasd
├──*get-oh-my-fish
├──*get-powerline
├── get-spacemacs
├── get-spacevim
├── get-sublime-text-3
├──*get-thefuck
└── get-xsh
脚本在 CharlesScripts/charles/installation.d/conf.d
标 *
的是推荐安装的
conf.d/
├──*config-bash
├──*config-fish
├──*config-git
├──*config-gnome
├──*config-powerline-bash
├── config-powerline-ipython
└──*config-tmux
装前必读:
逐步安装:
git clone https://github.com/the0demiurge/CharlesScripts.git ~/.local/share/CharlesScripts
cd ~/.local/share/CharlesScripts/charles/installation.d
安装脚本(测试中):
bash <(curl -L https://git.io/get-charles)
按照《Ubuntu Gnome 酷炫完整指南系列》介绍的内容配置后如下图所示。