比 man 更强悍的命令行工具 cheat

经常使用命令行,比如 curl 测试接口响应时间

for i in {1..10};do curl -o /dev/null -s   -w "$i | time_namelookup: %{time_namelookup} | time_connect: %{time_connect} | time_starttransfer: %{time_starttransfer} | time_total: %{time_total}\n" "http://httpbin.org/ip";done

1 | time_namelookup: 0.016000 | time_connect: 0.016000 | time_starttransfer: 0.125000 | time_total: 0.141000
2 | time_namelookup: 0.016000 | time_connect: 0.016000 | time_starttransfer: 0.094000 | time_total: 0.109000
3 | time_namelookup: 0.016000 | time_connect: 0.031000 | time_starttransfer: 0.109000 | time_total: 0.109000
4 | time_namelookup: 0.015000 | time_connect: 0.031000 | time_starttransfer: 0.109000 | time_total: 0.109000
5 | time_namelookup: 0.031000 | time_connect: 0.031000 | time_starttransfer: 0.109000 | time_total: 0.109000
6 | time_namelookup: 0.016000 | time_connect: 0.016000 | time_starttransfer: 0.094000 | time_total: 0.109000
7 | time_namelookup: 0.016000 | time_connect: 0.016000 | time_starttransfer: 0.125000 | time_total: 0.125000
8 | time_namelookup: 0.000001 | time_connect: 0.016000 | time_starttransfer: 0.141000 | time_total: 0.141000
9 | time_namelookup: 0.015000 | time_connect: 0.015000 | time_starttransfer: 0.093000 | time_total: 0.109000
10 | time_namelookup: 0.000001 | time_connect: 0.015000 | time_starttransfer: 0.109000 | time_total: 0.125000

奈何命令行参数太多,记不住怎么办?这时候你需要个男人,它就是 man

man

#man curl 
curl(1)                                      Curl Manual                                     curl(1)

NAME
       curl - transfer a URL

SYNOPSIS
       curl [options] [URL...]

DESCRIPTION
       curl  is  a  tool  to transfer data from or to a server, using one of the supported protocols
       (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP,  LDAPS,  POP3,  POP3S,  RTMP,
       RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP).  The command is designed to work without user
       interaction.

       curl offers a busload of useful tricks like proxy support, user authentication,  FTP  upload,
       HTTP  post,  SSL  connections, cookies, file transfer resume, Metalink, and more. As you will
       see below, the number of features will make your head spin!

       curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.

URL
       The URL syntax is protocol-dependent. You'll find a detailed description in RFC 3986.

       You can specify multiple URLs or parts of URLs by writing part sets within braces as in:

        http://site.{one,two,three}.com

       or you can get sequences of alphanumeric series by using [] as in:

        ftp://ftp.numericals.com/file[1-100].txt
        ftp://ftp.numericals.com/file[001-100].txt    (with leading zeros)
        ftp://ftp.letters.com/file[a-z].txt

男人的确很强悍,给出了这么多提示,但没有我真正想要的。。。还是不知道怎么用。

相信你在技术文章里经常会看到 TL;DR 即Too Long; Didn’t Read. 太长不看, man curl 的内容就是太长了,我不看。

就是这个更强壮的男人 tldr,它一个命令行工具,直接使用 npm install -g tldr 来安装。

tldr

[root@VM_0_14_centos ~]# npm install -g tldr
/usr/local/n/versions/node/11.4.0/bin/tldr -> /usr/local/n/versions/node/11.4.0/lib/node_modules/tldr/bin/tldr
+ tldr@3.2.7
added 113 packages from 103 contributors in 60.759s


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.4.1 → 6.9.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.9.0   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

安装完后先看看 tldr 自己怎么用吧。

$ tldr tldr

  tldr

  Simplified man pages.
  More information: .

  - Get typical usages of a command (hint: this is how you got here!):
    tldr command

  - Show the tar tldr page for linux:
    tldr -p linux tar

  - Get help for a git subcommand:
    tldr git checkout

小试牛刀下

$ tldr -p linux tar

  tar

  Archiving utility.
  Often combined with a compression method, such as gzip or bzip.
  More information: .

  - Create an archive from files:
    tar -cf target.tar file1 file2 file3

  - Create a gzipped archive:
    tar -czf target.tar.gz file1 file2 file3

  - Extract an archive in a target directory:
    tar -xf source.tar -C directory

  - Extract a gzipped archive in the current directory:
    tar -xzf source.tar.gz

  - Extract a bzipped archive in the current directory:
    tar -xjf source.tar.bz2

  - Create a compressed archive, using archive suffix to determine the compression program:
    tar -caf target.tar.xz file1 file2 file3

  - List the contents of a tar file:
    tar -tvf source.tar

  - Extract files matching a pattern:
    tar -xf source.tar --wildcards "*.html"

嗯,很简洁,直接给出了tar需要的参数,再来看curl

λ tldr curl

  curl

  Transfers data from or to a server.
  Supports most protocols, including HTTP, FTP, and POP3.

  - Download the contents of an URL to a file:
    curl http://example.com -o filename

  - Download a file, saving the output under the filename indicated by the URL:
    curl -O http://example.com/filename

  - Download a file, following [L]ocation redirects, and automatically [C]ontinuing (resuming) a previous file transfer:
    curl -O -L -C - http://example.com/filename

  - Send form-encoded data (POST request of type application/x-www-form-urlencoded):
    curl -d 'name=bob' http://example.com/form

  - Send a request with an extra header, using a custom HTTP method:
    curl -H 'X-My-Header: 123' -X PUT http://example.com

  - Send data in JSON format, specifying the appropriate content-type header:
    curl -d '{"name":"bob"}' -H 'Content-Type: application/json' http://example.com/users/1234

  - Pass a user name and password for server authentication:
    curl -u myusername:mypassword http://example.com

  - Pass client certificate and key for a resource, skipping certificate validation:
    curl --cert client.pem --key key.pem --insecure https://example.com

这个男人果然更强悍,常用的curl命令都包括了,我喜欢。

除了自带的命令,安装的命令也可以

[root@VM_0_14_centos ~]# tldr python

  python

  Python language interpreter.
  More information: https://www.python.org.

  - Call a Python interactive shell (REPL):
    python

  - Execute script in a given Python file:
    python script.py

  - Execute script as part of an interactive shell:
    python -i script.py

  - Execute a Python expression:
    python -c "expression"

  - Run library module as a script (terminates option list):
    python -m module arguments

  - Interactively debug a Python script:
    python -m pdb script.py

除了node 还有其他版本 https://github.com/tldr-pages/tldr 比如Python,直接pip install tldr安装

如果你不想安装tldr,也可以直接使用网页在线查看https://tldr.sh/ image.png 有了tldr,妈妈再也不用担心我记不住命令行参数了,还有没有比 tldr更强悍的男人呢,有,比如cheat https://github.com/cheat/cheat  直接使用pip install cheat安装。

cheat

看看 cheat 怎么用吧

$ cheat cheat
# To see example usage of a program:
cheat <command>

# To edit a cheatsheet
cheat -e <command>

# To list available cheatsheets
cheat -l

# To search available cheatsheets
cheat -s <command>

# To get the current `cheat' version
cheat -v



试试 curl

$ cheat curl
# Download a single file
curl http://path.to.the/file

# Download a file and specify a new filename
curl http://example.com/file.zip -o new_file.zip

# Download multiple files
curl -O URLOfFirstFile -O URLOfSecondFile

# Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg

# Download a file and pass HTTP Authentication
curl -u username:password URL

# Download a file with a Proxy
curl -x proxysever.server.com:PORT http://addressiwantto.access

# Download a file from FTP
curl -u username:password -O ftp://example.com/pub/file.zip

# Get an FTP directory listing
curl ftp://username:password@example.com

# Resume a previously failed download
curl -C - -o partial_file.zip http://example.com/file.zip

# Fetch only the HTTP headers from a response
curl -I http://example.com

# Fetch your external IP and network info as JSON
curl http://ifconfig.me/all/json

# Limit the rate of a download
curl --limit-rate 1000B -O http://path.to.the/file

# Get your global IP
curl httpbin.org/ip

# Get only the HTTP status code
curl -o /dev/null -w '%{http_code}\n' -s -I URL

$ cheat python
# Desc: Python is a high-level programming language.

# Basic example of server with python
# Will start a Web Server in the current directory on port 8000
# go to http://127.0.0.1:8000

# Python v2.7
python -m SimpleHTTPServer
# Python 3
python -m http.server 8000

# SMTP-Server for debugging, messages will be discarded, and printed on stdout.
python -m smtpd -n -c DebuggingServer localhost:1025

# Pretty print a json
python -mjson.tool

比tldr更详细,如果你也不想安装可以直接使用curl

cht.sh

[root@VM_0_14_centos ~]# curl cht.sh/curl
# Download a single file
curl http://path.to.the/file

# Download a file and specify a new filename
curl http://example.com/file.zip -o new_file.zip

# Download multiple files
curl -O URLOfFirstFile -O URLOfSecondFile

# Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg

# Download a file and follow redirects
curl -L http://example.com/file

# Download a file and pass HTTP Authentication
curl -u username:password URL

# Download a file with a Proxy
curl -x proxysever.server.com:PORT http://addressiwantto.access

# Download a file from FTP
curl -u username:password -O ftp://example.com/pub/file.zip

# Get an FTP directory listing
curl ftp://username:password@example.com

# Resume a previously failed download
curl -C - -o partial_file.zip http://example.com/file.zip

# Fetch only the HTTP headers from a response
curl -I http://example.com

# Fetch your external IP and network info as JSON
curl http://ifconfig.me/all/json

# Limit the rate of a download
curl --limit-rate 1000B -O http://path.to.the/file

# POST to a form
curl -F "name=user" -F "password=test" http://example.com

# POST JSON Data
curl -H "Content-Type: application/json" -X POST -d '{"user":"bob","pass":"123"}' http://example.com

# POST data from the standard in / share data on sprunge.us
curl -F 'sprunge=<-' sprunge.us

看看Python的requests怎么用

[root@VM_0_14_centos ~]# curl cheat.sh/python/requests
#  python-requests: Limit Number of Redirects Followed
#
#  You have to create Session (http://www.python-
#  requests.org/en/latest/api/requests.Session) object and set
#  max_redirects variable to 3

session = requests.Session()
session.max_redirects = 3
session.get(url)

#  TooManyRedirects exception will be raised if a requests exceeds
#  maximum number of redirects.
#
#  Related github issue discussing why you can not set max_redirects per
#  request https://github.com/kennethreitz/requests/issues/1300
#
#  [Alik] [so/q/31552627] [cc by-sa 3.0]

它也有网页版 http://cht.sh/curl image.png 有了tldr和cheat,再也不用记那么多命令行参数了。

win下我执行命令行的工具是cmder,如果你用的win10,可以尝试下微软最新发布的Terminal https://github.com/microsoft/Terminal

资源

微软最爽命令行工具

Linux命令大全搜索工具

Linux工具快速教程

有趣的Linux命令行工具

命令行的艺术

假装很忙的三个命令行工具

28个UNIX/LINUX的命令行神器

命令行工具

PHPer 必知必会的 Linux 命令

推荐阅读:

那些你可能不知道的浏览器奇技淫巧

那些你可能不知道的微信奇技淫巧

那些你可能不知道的微博奇技淫巧

那些你可能不知道的网易云音乐奇技淫巧

那些你可能不知道的搜索奇技淫巧

那些你可能不知道的视频下载奇技淫巧

那些你可能不知道的免费观看 VIP 视频奇技淫巧

公众号:苏生不惑

扫描二维码关注

转载于:https://my.oschina.net/u/563231/blog/3067480

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Cheat Engine是一款非常流行的开源游戏修改工具,7.3版本是其最新发布的版本。通过使用Cheat Engine,用户可以修改游戏内的数据和变量,例如游戏中的金钱、生命值、经验值等等。它可以在受支持的游戏中实现无限生命、无限金钱等修改操作,让用户在游戏中获得多的优势和乐趣。 Cheat Engine的功能强大且灵活,它提供了一个用户友好的图形界面,用户可以通过这个界面搜索游戏内的数值并进行修改。除此之外,Cheat Engine还可以通过调试器功能来分析并修改游戏的二进制代码,实现深层次的修改。 Cheat Engine的源码是开放的,这意味着用户可以查看和修改工具的源代码。这样的开源性使得Cheat Engine成为一个充满活力的项目,吸引了许多开发者和用户的参与。通过查看源码,用户可以深入地了解Cheat Engine的工作原理,实现个性化的修改和适应不同的游戏。 然而需要注意的是,使用Cheat Engine修改游戏可能违反游戏制作者的规定,并且可能导致账号封禁等可能的后果。因此,使用Cheat Engine需要谨慎并遵守相关规定和使用条款。总之,Cheat Engine是一款功能强大的游戏修改工具,通过它可以实现对游戏内一些数值的修改,为用户带来多的游戏乐趣和挑战。 ### 回答2: Cheat Engine是一款功能强大的游戏修改工具,可以修改游戏中的各种数值,例如金钱、血量、经验等。Cheat Engine 7.3版本是最新发布的版本,具有多的优化和改进。 Cheat Engine 7.3版本的工具和源码主要包括以下几个方面的内容。首先,它提供了一个用户友好的界面,使得用户能够方便地找到和修改游戏中的数值。其次,它具有强大的搜索和筛选功能,可以通过比较、范围和精确搜索来定位特定的数值。此外,它还提供了一些高级功能,如内存编辑和脚本编写,让用户可以灵活地修改游戏。 除了工具本身,Cheat Engine 7.3版本的源码也是开源的,这意味着用户可以自由地查看、修改和定制代码。源码的开放性使得多的开发者可以参与到Cheat Engine的改进和扩展中,为游戏修改领域带来多的创新和功能。 然而,使用Cheat Engine进行游戏修改是存在一定风险的。一方面,游戏开发者通常不鼓励和支持游戏修改行为,因此可能会对使用Cheat Engine的用户采取封号等措施。另一方面,不正确的使用Cheat Engine可能导致游戏崩溃或数据损坏等问题,因此用户在使用之前需要做好备份和风险评估。 总之,Cheat Engine 7.3版本的工具和源码为游戏修改提供了强大的功能和灵活性。用户可以通过它来修改游戏中的数值,提升游戏体验。然而,需要注意的是使用Cheat Engine存在一定风险,用户需谨慎使用并遵守相关法律法规。 ### 回答3: Cheat Engine 7.3是一种用于修改游戏的工具和源码。Cheat Engine是一款功能强大的开源软件,旨在帮助玩家在游戏中获得一些额外的好处,如无限生命、无限金钱等。 Cheat Engine 7.3版本具有许多新的改进和功能。它采用了直观的用户界面,使用户能够轻松地修改游戏中的各种数值。它还提供了高级调试和扫描功能,可以帮助用户查找和修改游戏中的特定数值。此外,Cheat Engine 7.3还支持脚本编写,可以编写自定义脚本来实现复杂的游戏修改。 Cheat Engine 7.3的源代码是开放的,意味着任何人都可以查看和修改它。这使得开发人员和游戏玩家能够好地了解其工作原理,并根据自己的需求进行进行定制。此外,开放的源代码还为开发者提供了与别人共享和改进代码的机会,以不断改进工具的功能和性能。 需要注意的是,使用Cheat Engine 7.3来修改游戏可能会涉及到违反游戏开发商的使用协议和使用条款,因此,玩家在使用该工具时应该谨慎行事,并自行承担风险。 总之,Cheat Engine 7.3是一款功能强大的游戏修改工具,它提供了丰富的功能和灵活的定制选项。它的开放源代码使得用户可以好地理解和改进工具,并根据自己的需求进行定制。然而,使用该工具要谨慎,以免违反游戏开发商的使用协议和使用条款。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值