命令行神器推荐
作为程序员都习惯在命令行下操作,今天就推荐些命令行神器,可能让你大开眼界。
统计当前目录代码数 line-counter
//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
-------------------------------------------------------------------------------命令行纠错 thefuck
//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
markdown to html
npm install -g codedog codedog xx.md or codedog xx.md width height
mysql 客户端,支持语法高亮和命令补全 mycli
// 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基于puppeteer的网页截图工具
$ 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
一个生成pdf文件的微服务
npm install -g pdf-bot
json文件处理以及格式化显示,支持高亮,可以替换python -m json.tool
//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"
]shell脚本静态检查工具 shellcheck
//https://github.com/koalaman/shellcheck apt-get install shellcheck shellcheck test.sh
多线程下载工具 axel
// 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
命令行请求工具 httpie
//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"
}命令行文档 tldr
// 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命令行提示工具 cheat
//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/'
后台运行和管理进程 pm2 同python的supervisoerd
//http://pm2.keymetrics.io/ npm install pm2 -g pm2 list
在命令行实时监控 Nginx 的神器 ngxtop
//https://linux.cn/article-3205-1.html pip install ngxtop ngxtop -n 20 ngxtop info
python代码格式规范化工具 yapf
//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'命令行下模糊搜索工具 fzf
//https://github.com/junegunn/fzf brew install fzf find * -type f | fzf > selected
网易云音乐命令行版本 musicbox
//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
多线程下载工具 aria2
//https://github.com/aria2/aria2 aria2c http://a/f.iso ftp://b/f.iso aria2 下载百度云链接https://github.com/acgotaku/BaiduExporter
比 python -m SimpleHTTPServer 更好的 http 服务器 http-server
//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
获取汉字拼音 pypinyin
pip install pypinyin $ pypinyin 有哪些命令行的软件堪称神器 yǒu něi xiē mìng lìng xíng de ruǎn jiàn kān chē
Nginx配置静态分析器
https://github.com/yandex/gixy pip install gixy gixy /etc/nginx/nginx.conf
HTTP Prompt
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

node ppt
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
图片识别
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
send emails
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 "[email protected]&subject=hi&text=hey world" http://127.0.0.1:3000/emaillearnyoubash
npm install -g bash-handbook
网易云音乐下载器
$ 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
curl 统计分析 httpstat
pip install httpstat httpstat httpbin.org/get

清除多余 css
//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]http 请求工具
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 云南 昆明 移动
搭建简易静态文件http服务器
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
命令行单词管理工具 iSearch
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]

相关推荐
吹云 2020-11-05
84407805 2020-11-01
曾是土木人 2020-10-31
java0 2020-09-29
81437716 2020-09-18
81437716 2020-09-13
bluecarrot 2020-09-11
myCat 2020-09-09
83427718 2020-09-07
85560694 2020-09-03
89520991 2020-08-21
89550191 2020-08-09
katie000 2020-08-04
hunningtu 2020-07-30
89961330 2020-07-28
yuzhongdelei0 2020-07-28
yuzhongdelei0 2020-07-27