命令行神器推荐

前端之家收集整理的这篇文章主要介绍了命令行神器推荐前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

作为程序员都习惯在命令行下操作,今天就推荐些命令行神器,可能让你大开眼界。

统计当前目录代码数 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

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

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
$ 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

更多
命令行工具
公众号:苏生不惑

原文链接:https://www.f2er.com/bash/392786.html

猜你在找的Bash相关文章