作者 | Charles
昨天釋出了《30 個方便的 Bash shell 別名[1]》之後,一位讀者也向我們分享了他的工具盒,特此向大家推薦:Charles 的指令碼[2]。這個工具盒可以配合作者的部落格:《Ubuntu Gnome 酷炫完整指南系列[3]》使用。
他的指令碼或許寫得不夠精妙,也許會存在一些 bug,但是正是這種對工作、生活中的積累進行整理,才是 Linux 生活的樂趣和進取之道。大家喜歡的話,也可以貢獻自己的程式碼和貢獻,使之更加完善。
以下內容引自他的專案說明[2]。
你為什麼要安裝本專案?
凡是喜歡折騰的朋友肯定經常會遇到下麵幾個困擾:
apt和git)內容介紹
最初因為我經常會因為愚蠢的操作把作業系統搞得崩潰,寫下了本專案以便減輕重灌系統之痛。後來我寫了許多方便的小工具和指令碼,把它們整合起來就變成了本專案:
1. 備份/恢復
本專案會將所有資料備份到 $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上傳備份2. 小工具
通知類:
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[4], 為 GitHub 的 Markdown 檔案加入目錄gojuon: 日語五十音學習小工具ipgw ipgw_py: 命令列版的東北大學校園網登入器網頁相關:
wechat: 開啟微信pocket: 開啟 Pocketshanbay: 開啟扇貝單詞包含在 .bashrc 或 fish-shell config.fish 中的簡便操作:
寫在CharlesScripts/charles/shell.rc.d中的指令碼函式:
backup: 將檔案備份(複製一份並新增.bak字尾)cls: cd 到指定檔案夾然後lsdict: 將 dict 查到的單詞輸出到less內,以免單詞解釋過長顯示不完還要再翻回去看g: 使用git一條龍地執行 git add -A,git diff --cached,git status,git commit -m ,git push,並檢查 push 是否成功,若失敗則提醒你檢查一下mcd: 先mkdir再cd到剛剛建立的檔案夾內md5check: md5check ,用grep檢查md5是否一樣viz: 使用graphviz編譯為指定格式的圖片,用法為viz source.dot png在CharlesScripts/charles/installation.d/conf.d/config-fish配置好的命令縮寫
... -> cd ...c -> clear; cdcl -> cd ..;lseg -> grep -Eftps -> python3 -m http.server 8080: 快速開啟一個簡易 ftp 伺服器gaa -> git add -Agb -> git branch -cgck -> git checkoutgcm -> git commit -mgl -> git l: 顯示結構化的 git 日誌gm -> git merge --no-ffgp -> git pushgpl -> git pullgst -> git statushistg -> history | grepi -> ipython --no-confirm-exit --no-banner --pprint -i --pylab=autol -> ls --color=autola -> ls --almost-all --color=autole -> ls --almost-all --color=auto|egreplg -> ls --almost-all --color=auto|grepll -> ls --almost-all -lh --color=auton -> xdg-open .o -> xdg-openp -> pythonpdb -> python -mpowerline.bindings.pdbsu -> sudo suu -> update3. 安裝軟體
指令碼在 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
4. 配置軟體
指令碼在 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/CharlesScriptscd ~/.local/share/CharlesScripts/charles/installation.d安裝指令碼(測試中):
bash
效果圖
按照《Ubuntu Gnome 酷炫完整指南系列[3]》介紹的內容配置後如下圖所示。


知識星球







