你是不是經常在終端敲錯指令,其實這都是因為該死的終端不配合,不能領會你的意思。
每當這個時候,甚至當你一再敲錯的時候,你的内心肯定是崩潰的,一定在默念“……”。
而現在,是讓你的終端覺悟的時候了!

當你的終端沒有按你想象的輸入指令時,請 <code>fuck</code> 它!
當你的終端沒有按你想象的以 sudo 執行指令時,請 <code>fuck</code> 它!
當你的的終端不知道填上顯而易見的參數時,請 <code>fuck</code> 它!
當你輸入錯誤的指令時:
<code>puthon</code>
<code>no command 'puthon' found, did you mean:</code>
<code>command 'python' from package 'python-minimal' (main)</code>
<code>command 'python' from package 'python3' (main)</code>
<code>zsh: command not found: puthon</code>
<code></code>
<code>fuck</code>
<code>python [enter/↑/↓/ctrl+c]</code>
<code>python 3.4.2 (default, oct 8 2014, 13:08:17)</code>
<code>...</code>
當你忘記輸入參數時:
<code>git push</code>
<code>fatal: the current branch master has no upstream branch.</code>
<code>to push the current branch and set the remote as upstream, use</code>
<code>git push --set-upstream origin master</code>
<code>git push --set-upstream origin master [enter/↑/↓/ctrl+c]</code>
<code>counting objects: 9, done.</code>
當你輸入錯誤的參數時:
<code>git brnch</code>
<code>git: 'brnch' is not a git command. see 'git --help'.</code>
<code>did you mean this?</code>
<code>branch</code>
<code>git branch [enter/↑/↓/ctrl+c]</code>
<code>* master</code>
當你忘記輸入 <code>sudo</code> 時:
<code>apt-get install vim</code>
<code>e: could not open lock file /var/lib/dpkg/lock - open (13: permission denied)</code>
<code>e: unable to lock the administration directory (/var/lib/dpkg/), are you root?</code>
<code>sudo apt-get install vim [enter/↑/↓/ctrl+c]</code>
<code>[sudo] password for nvbn:</code>
<code>reading package lists... done</code>
如果生活是如此的不如意,你可以不斷的“教誨”它:
<code>aptget install vim</code>
<code>no command 'aptget' found, did you mean:</code>
<code>command 'apt-get' from package 'apt' (main)</code>
<code>zsh: command not found: aptget</code>
<code>aot-get install vim [enter/ctrl-c]</code>
<code>e: unable to lock the administration directory (/var/lib/dpkg), are you root?</code>
還需要權限?再來!
<code>sudo apt-get install vim [enter/ctrl-c]</code>
<code>building dependency tree... 0%</code>
<code>... ...</code>
虐我千百遍 我待如初戀
好了,我想你肯定也想擁有這樣的神器,請如此這般……
<a target="_blank"></a>
首先,你需要這些:
python (2.7+ or 3.3+)
pip
python-dev
然後,在不同的作業系統上(沒錯,有 python 的地方就行):
在 ubuntu 上可以通過 <code>apt</code> 安裝:
<code>sudo apt update</code>
<code>sudo apt install python3-dev python3-pip</code>
<code>pip3 install --user thefuck</code>
<code>brew install thefuck</code>
其它的系統上,隻要你有 <code>pip</code> 就行:
<code>pip install --user thefuck</code>
上述安裝的軟體包名字是:“thefuck”——别問我為啥不能直接叫 “fuck”。是以,你可以設定個别名:
bash
将下述行加入到 <code>.bashrc</code> 或 <code>.bash_profile</code> (用于 osx):
<code>eval "$(thefuck --alias)"</code>
将下述行加入到 <code>.zshrc</code>:
當然,我覺得我更喜歡給它起個别名叫 “<code>kao</code>”。:d
要讓别名立刻生效,你需要用 <code>source</code> 指令,如:
<code>source ~/.bashrc</code>
<code>或 </code>
<code>source ~/.zshrc</code>
還等什麼?趕快去裝啊!
原文釋出時間為:2017-05-03
本文來自雲栖社群合作夥伴“linux中國”