0
点赞
收藏
分享

微信扫一扫

Windows 安装 curl、touch、tree


阅读目录

  • windows下使用curl命令 && 常用 curl 命令
  • 什么是curl命令?
  • 如何在windows下使用curl命令?
  • 常用命令如下
  • 应用示例
  • windows 安装 touch指令
  • Windows 下安装 tree
  • windows系统环境下使用 tail 命令实时查看文件
  • 命令行设置编码格式

windows下使用curl命令 && 常用 curl 命令

什么是curl命令?

curl是利用URL语法在命令行方式下工作的开源文件传输工具。

它被广泛应用在Unix、多种Linux发行版中,并且有DOS和Win32、Win64下的移植版本。

如何在windows下使用curl命令?

https://curl.haxx.se/windows/

第一步: 进入curl下载官网,下载合适的版本,我这里下载的是windows 64位的curl。

Windows 安装 curl、touch、tree_windows


其中我下载的zip文件。 另外CAB文件也是压缩文件,这是微软出品,不太好用,建议使用zip压缩文件。

第二步: 解压缩文件,然后找到该文件目录下的bin子文件(bin即二进制文件,又称可执行文件), 复制文件地址:

Windows 安装 curl、touch、tree_命令行_02


第三步: 将该地址加入环境变量。

第四步: 打开CMD,然后输入 curl –help ,如果显示如下, 就代表成功了。

Windows 安装 curl、touch、tree_Windows_03

常用命令如下

获取到一个网页的document。

curl www.baidu.com
除了获取到document外,还可以获取头信息。

curl www.baidu.com -i
仅仅获取头信息。 无document。

curl www.baidu.com -I
显示更为详细的信息, v 是 verbose 的缩写。

curl www.baidu.com -v

可以看到包括解析为 ip 的过程都有。

这里实际上就是在模拟form表单,该表单使用的是get方法。

curl www.baidu.com/s?wd=d

应用示例

E:\golang\src>curl -X POST http://127.0.0.1:3000/articles
创建新的文章
E:\golang\src>curl http://127.0.0.1:3000/articles
访问文章列表
E:\golang\src>

windows 安装 touch指令

PS E:\workspace\hello> npm install touch-cli -g
C:\Program Files\nodejs\touch -> C:\Program Files\nodejs\node_modules\touch-cli\bin\touch
+ touch-cli@0.0.1
added 2 packages from 2 contributors in 1.588s
PS E:\workspace\hello> touch hello.go
Touching hello.go
PS E:\workspace\hello>

Windows 安装 curl、touch、tree_Windows_04

Windows 下安装 tree

1、打开进入 Tree for Windows 页面,选择下载 Binaries zip 文件。

Tree for Windows
https://gnuwin32.sourceforge.net/packages/tree.htm

2、解压压缩包,找到压缩包内的 bin 目录,将 bin 目录下的 tree.exe 设置到环境变量。

Windows 安装 curl、touch、tree_Windows_05


3、测试 tree 是否安装成功

进入Git Bash,输入 tree -L 1 命令,显示结果如下:

Windows 安装 curl、touch、tree_linux_06


tree 安装成功。

显示当前目录树

tree
.
├── 00Tree.html
├── es
│   ├── go.mod
│   ├── go.sum
│   ├── main
│   └── main.go
├── gen_req
│   ├── go.mod
│   └── main.go
└── shell
    ├── cat.sh
    ├── cat.tar
    ├── newfile
    ├── students.txt
    └── txt

Windows 安装 curl、touch、tree_windows_07

windows系统环境下使用 tail 命令实时查看文件

下载地址: https://tail-for-windows.en.softonic.com

Windows 安装 curl、touch、tree_命令行_08


重点:解压后需将 tail.exe 放入 c:\windows\system32 文件下

Windows 安装 curl、touch、tree_运维_09


Windows 安装 curl、touch、tree_windows_10

命令行设置编码格式

通过 CMD 执行: chcp 65001 命令,修改编码为 utf-8

Windows 安装 curl、touch、tree_Windows_11


举报

相关推荐

0 条评论