最常用Linux命令的Windows对应命令
The Windows equivalents of the most used Linux commands

原始链接: http://techkettle.blogspot.com/2026/04/the-windows-equivalents-of-most-used.html

## Windows 命令提示符与 Linux 命令的对应关系 虽然 Linux 以其命令行功能而闻名,但 Windows 通过其命令提示符 (cmd) 提供了类似的功能。这使得在操作系统之间平滑过渡成为可能。 以下是一些关键的对应关系:过滤输出 (Linux `grep`,Windows `findstr`),使用 `tcpdump` 和 Wireshark 捕获网络流量(使用内置的 Windows SSH 客户端),检查监听端口 (`netstat` 在两者中都可用),查看文件内容 (`cat` vs. `type`),以及列出目录内容 (`ls` vs. `dir`)。 对于系统管理,Windows 提供 `tasklist`(类似于 Linux 的 `top` 或 `ps aux`)来查看进程,以及 `taskkill`(类似于 `kill`)来终止它们。可以使用 `ipconfig /all`(vs. `ifconfig`)检查网络配置,并使用 `tracert`(vs. `traceroute`)跟踪网络路由。最后,`cls` 清屏,就像 Linux 中的 `clear` 一样。 掌握这些 cmd 对应关系可以帮助用户有效地排除故障并管理系统,无论操作系统如何。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 工作 | 提交 登录 Windows 中最常用 Linux 命令的等效命令 (techkettle.blogspot.com) 10 分,由 elsadek 发表于 3 小时前 | 隐藏 | 过去 | 收藏 | 3 条评论 帮助 WaterRun 2 分钟前 | 下一个 [–] 我最近也有过类似的想法。 https://github.com/Water-Run/Cmdset jmclnx 10 分钟前 | 上一个 | 下一个 [–] 不错,但一个主要的批评是,永远不要先使用 'kill -9',如果使用 -9 杀死,程序将无法自行清理。使用以下其中之一: -TERM 然后等待,如果不行 -INT 然后等待,如果不行 -HUP 然后等待,如果不行 -ABRT 如果你确定所有这些都失败了,那么使用 -9 (-KILL)。但假设程序存在重大错误,并尝试找到另一个可以完成相同任务的程序来使用。 jpease 12 分钟前 | 上一个 [–] CTRL-ALT-DEL? 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Whether it is to pipe the Tcpdump output to another machine hosting Wireshark or checking which service is listening on which port, Windows cmd has similar commands that are present in Linux. Here is some of the most command used in Linux that have equivalent purpose on Windows:

Filtering the output of a commande:

  • Linux: lsof -s | grep 'https'
  • Windows: netstat -n -a | findstr "https" (//note the double quotes)

Piping tcp dump to another machines that hosts Wireshark

Author's note: From here on, the content is AI-generated

  • Linux: ssh root@remote-linux "tcpdump -s 0 -U -n -w - -i eth0 not port 22" | wireshark -k -i -
  • Windows: ssh root@remote-linux "tcpdump -s 0 -U -n -w - -i eth0 not port 22" | "C:\Program Files\Wireshark\wireshark.exe" -k -i - (//note that Windows 10 and 11 come with a native SSH client built into cmd!)

Checking which service is listening on which port

  • Linux: netstat -tulpn
  • Windows: netstat -ano (//note that this gives you the PID (Process ID) which you can then look up in the Task Manager or using the 'tasklist' command)

Viewing the contents of a file directly in the terminal

  • Linux: cat filename.txt
  • Windows: type filename.txt

Listing the contents of a directory (including hidden files)

  • Linux: ls -la
  • Windows: dir /a

Finding a specific file by name across the system

  • Linux: find / -name "config.txt"
  • Windows: dir \config.txt /s (//the /s flag tells it to search all subdirectories)

Checking network interface configurations and IP addresses

  • Linux: ifconfig (or ip a)
  • Windows: ipconfig /all

Viewing a list of active running processes

  • Linux: top (or ps aux)
  • Windows: tasklist

Terminating or "killing" a process by its Process ID (PID)

  • Linux: kill -9 1234
  • Windows: taskkill /F /PID 1234 (//the /F flag forces the termination of the process)

Tracing the network route to a remote host

  • Linux: traceroute google.com
  • Windows: tracert google.com

Clearing the terminal screen

  • Linux: clear
  • Windows: cls

Conclusion

While Linux often gets the spotlight for its powerful command-line interface, Windows has a highly capable native command prompt as well. Whether you are troubleshooting network connectivity, managing local files, or monitoring system processes, mastering these equivalent Windows commands will make seamlessly transitioning between both operating systems a breeze.

联系我们 contact @ memedata.com