做爲程序員都習慣在命令行下操做,今天就推薦些命令行神器,可能讓你大開眼界。php
//https://github.com/MorganZhang100/line-counter //find . -name '*.py' -exec wc -l {} + //wc -l pip install line-counter $ line Search in /Users/Morgan/Documents/Example/ file count: 4 line count: 839 $ line -d Search in /Users/Morgan/Documents/Example/ Dir A/file C.c 72 Dir A/file D.py 268 file A.py 467 file B.c 32 file count: 4 line count: 839 //https://github.com/AlDanial/cloc npm install -g cloc $ cloc wechat-cli.py 1 text file. 1 unique file. 0 files ignored. github.com/AlDanial/cloc v 1.72 T=0.14 s (7.4 files/s, 779.4 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Python 1 12 7 87 -------------------------------------------------------------------------------
//https://github.com/nvbn/thefuck pip install thefuck ➜ apt-get install vim E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? ➜ fuck sudo apt-get install vim [sudo] password for nvbn: Reading package lists... Done
npm install -g codedog codedog xx.md or codedog xx.md width height
// https://github.com/dbcli/mycli pip install -U mycli $ mycli -h localhost -uroot Password: Version: 1.8.0 Chat: https://gitter.im/dbcli/mycli Mail: https://groups.google.com/forum/#!forum/mycli-users Home: http://mycli.net Thanks to the contributor - Tech Blue Software mysql root@localhost:(none)> use test You are now connected to database "test" as user "root" Time: 0.005s mysql root@localhost:test> show t TABLE STATUS TABLE STATUS TABLES TABLES TRIGGERS TRIGGERS STATUS [F2] Smart Completion: ON [F3] Multiline: OFF [F4] Emacs-mode
$ npm install -g vian (1)截取 github 首頁 $ vian https://github.com (2)截取 github 首頁 (非全屏) $ vian --no-fullpage https://github.com (3)保存 github 首頁爲圖片,模擬 iPhone 6 $ vian -d 'iPhone 6' -f github.jpg https://github.com (4)保存 github 首頁爲 pdf 文檔,紙張尺寸選擇 A4 $ vian -t pdf -s A4 https://github.com (5)查看全部的可模擬設備 $ vian devices //https://github.com/Runjuu/page2image npm i page2image --global # Single page > page2image https://github.com/Runjuu --type=jpeg --quality=80 # Multi-page > page2image https://github.com/Runjuu https://github.com/Runjuu --type=jpeg --quality=80
npm install -g pdf-bot
css
//https://github.com/stedolan/jq http://blog.chinaunix.net/uid-24774106-id-3830242.html $ cat json_raw.txt {"name":"Google","location":{"street":"1600 Amphitheatre Parkway","city":"Mountain View","state":"California","country":"US"},"employees":[{"name":"Michael","division":"Engineering"},{"name":"Laura","division":"HR"},{"name":"Elise","division":"Marketing"}]} cat json_raw.txt | jq '.location.state' "California" echo '{"foo": 42, "bar": "less interesting data"}' | jq .nofoo null cat json_raw.txt | jq 'keys' [ "employees", "location", "name" ]
//https://github.com/koalaman/shellcheck apt-get install shellcheck shellcheck test.sh
// axel.alioth.debian.org/ sudo apt-get install axel axel -n 10 -a <url> axel -n 20 http://centos.ustc.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso
//https://httpie.org/ https://github.com/jakubroztocil/httpie pip install --upgrade httpie http PUT example.org X-API-Token:123 name=John http -f POST example.org hello=World http example.org/file > file http httpbin.org/post -- -name-starting-with-dash=foo -Unusual-Header:bar POST /post HTTP/1.1 -Unusual-Header: bar Content-Type: application/json { "-name-starting-with-dash": "value" }
// https://github.com/tldr-pages/tldr npm install -g tldr $ tldr curl Cache is out of date, you should run "tldr --update" curl Transfers data from or to a server. Supports most protocols including HTTP, FTP, POP. - Download a URL to a file: curl "URL" -o filename - Send form-encoded data: curl --data name=bob http://localhost/form - Send JSON data: curl -X POST -H "Content-Type: application/json" -d '{"name":"bob"}' http:// localhost/login - Specify an HTTP method: curl -X DELETE http://localhost/item/123 - Head request: curl --head http://localhost - Include an extra header: curl -H "X-MyHeader: 123" http://localhost - Pass a user name and password for server authentication: curl -u myusername:mypassword http://localhost
//https://github.com/chrisallenlane/cheat pip install cheat cheat tar # To extract an uncompressed archive: tar -xvf '/path/to/foo.tar' # To extract a .gz archive: tar -xzvf '/path/to/foo.tgz' # To create a .gz archive: tar -czvf '/path/to/foo.tgz' '/path/to/foo/' # To extract a .bz2 archive: tar -xjvf '/path/to/foo.tgz' # To create a .bz2 archive: tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'
//http://pm2.keymetrics.io/ npm install pm2 -g pm2 list
//https://linux.cn/article-3205-1.html pip install ngxtop ngxtop -n 20 ngxtop info
//https://github.com/google/yapf pip install yapf >>> from yapf.yapflib.yapf_api import FormatCode # reformat a string of code >>> FormatCode("f ( a = 1, b = 2 )") 'f(a=1, b=2)\n'
//https://github.com/junegunn/fzf brew install fzf find * -type f | fzf > selected
//https://github.com/darknessomi/musicbox pip(3) install NetEase-MusicBox $ git clone https://github.com/darknessomi/musicbox.git && cd musicbox $ python(3) setup.py install
//https://github.com/aria2/aria2 aria2c http://a/f.iso ftp://b/f.iso aria2 下載百度雲連接https://github.com/acgotaku/BaiduExporter
//https://github.com/indexzero/http-server npm install http-server -g http-server 8888 alias hs="source ~/.bash_profile && http-server -a $(ifconfig en0 | grep 'inet ' | cut -d ' ' -f 2)" //瀏覽器打開http://localhost:8888
pip install pypinyin $ pypinyin 有哪些命令行的軟件堪稱神器 yǒu něi xiē mìng lìng xíng de ruǎn jiàn kān chē
https://github.com/yandex/gixy pip install gixy gixy /etc/nginx/nginx.conf
pip install http-prompt pip install httpie # No parameters initially > httpie http http://localhost # Send a request with some overrided parameters > post /api/v1 --form name=jane # Current state remains intact > httpie http http://localhost
https://github.com/ksky521/nodePPT npm install -g nodeppt 執行 nodeppt start 訪問 http://127.0.0.1:8080/ 在線demo: http://js8.in/nodeppt/
npm install -g caniuse-cmd $ caniuse flex Flexible Box Layout Module √ 83.86% Θ 13.63% [W3C Candidate Recommendation] Method of positioning elements in horizontal or vertical stacks. Support includes the support for the all properties prefixed with `flex` as well as `display: flex`, `display: inline-flex`, `align-content`, `align-items`, `align-self`, `justify-content` and `order`. #CSS3 IE × 5.5+ Θ 10+ᵖ² Θ 11⁴ Edge √ Firefox Θ 2+ᵖ¹ Θ 22+³ √ 28+ Chrome Θ 4+ᵖ¹ √ 21+ᵖ √ 29+ Safari Θ 3.1+ᵖ¹ √ 6.1+ᵖ √ 9+ Opera × 9+ √ 12.1+ √ 15+ᵖ √ 17+ ¹Only supports the [old flexbox](http://www.w3.org/TR/2009/WD-css3-flexbox-20090723) specification and does not support wrapping. ²Only supports the [2012 syntax](http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/) ³Does not support flex-wrap, flex-flow or align-content properties ⁴Partial support is due to large amount of bugs present (see known issues) ⓘ Most partial support refers to supporting an [older version](http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/) of the specification or an [older syntax](http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/).
npm install terminal-translate -g //相似 npm install fanyi -g https://github.com/afc163/fanyi $ tl great ~ great - [greɪt] 美[ɡret] 英[greɪt] ~ 偉大的 - n. 大師;大人物;偉人們 - adj. 偉大的,重大的;極好的,好的;主要的 1. Great 偉大的,Great,Great 2. Great Lakes 五大湖,五大湖,大湖區 3. Great Recession 經濟大衰退,大衰退,大蕭條
npm i -g u.nu
html
npm install baidu-ocr-api -g ocr --help # 遠程圖片 ocr http://7pun4e.com1.z0.glb.clouddn.com/test.jpg # 本地圖片 ocr ./test.jpg
npm install -g diffchecker diffchecker file1.js file2.js diffchecker --expires day file1.js file2.js
# Uploading is easy using curl $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt $ curl -H "Max-Downloads: 1" -H "Max-Days: 5" --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt # Download the file $ curl https://transfer.sh/66nb8/hello.txt -o hello.txt
First, create a config.json with your SMTP settings: { "host": "smtp.foobar.net", "port": 465, "user": "noreply", "pass": "foobar!" } Install the app and start it up to point at the config: npm i mailit -g mailit --config /path/to/config.json And presto, a mail endpoint! Let's try it out: curl --data "to=d@me.net&subject=hi&text=hey world" http://127.0.0.1:3000/email
npm install -g bash-handbook
node
$ git clone https://github.com/codezjx/netease-cloud-music-dl.git $ python setup.py install $ ncm -s 123123 or $ ncm -s http://music.163.com/#/song?id=123123
pip install httpstat httpstat httpbin.org/get
//https://github.com/purifycss/purifycss $ npm install -g purify-css $ purifycss -h purifycss <css> <content> [option] Options: -m, --min Minify CSS [boolean] [default: false] -o, --out Filepath to write purified css to [string] -i, --info Logs info on how much css was removed [boolean] [default: false] -r, --rejected Logs the CSS rules that were removed [boolean] [default: false] -w, --whitelist List of classes that should not be removed [array] [default: []] -h, --help Show help [boolean] -v, --version Show version number [boolean]
pip install http #驗證代理ip有效性 將響應與真實IP進行對比,若是不同就有效 $ http --proxy http://59.49.129.60:8998 http://ip.cip.cc HTTP/1.1 200 OK Connection: keep-alive Content-Length: 13 Content-Type: text/plain; charset=utf-8 Date: Sat, 09 Sep 2017 01:06:40 GMT P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NO I DSP COR' Proxy-Connection: keep-alive Server: nginx Vary: Accept-Encoding 59.49.129.60 >>> pro={'http':'59.49.129.60:8998'} >>>pro=requests.get('http://lab.crossincode.com/proxy/get/?num=35&head=https').json()['proxies'] >>> import requests as rq >>> r=rq.get('http://ip.cip.cc',proxies=pro) >>> r.text '59.49.129.60\n'
npm install -g cellocate cellocate 13888888888 13888888888 雲南 昆明 移動
python3 -m http.server port npm install http-server -g npm install -g serve npm install -g anywhere npm -g install puer php -S localhost:9999
pip install iSearch s sun sun 不在數據庫中,從有道詞典查詢 sun /sʌn/ N-SING The sun is the ball of fire in the sky that the Earth goes around, and that gives us heat and light. 太陽 例:The sun was now high in the southern sky. 太陽當時正高掛在南面天空上。 例:The sun came out, briefly. 太陽出來了,時間很短。
npm install capteer -g capteer <url> [filename] [options]