windows与linux常用命令对应表及使用技巧(Terminal、Git bash、cmd、Powershell)

5 篇文章 1 订阅

目录

windows与linux常用命令对应表

bash 命令

bash快捷键

Git bash

PowerShell命令

PowerShell快捷键

Shell Script 教程

Shell变量默认值

Windows CMD命令


windows与linux常用命令对应表

Linux通过Terminal(bash shell)执行命令。windows主要通过Command prompt(cmd)执行命令。

SNo.WindowsLinuxDescription
1.dirls -lDirectory listing
2.renmvRename a file
3.copycpCopying a file
4.movemvMoving a file
5.clsclearClear Screen
6.delrmDelete file
7.fcdiffCompare contents of files
8.findgrepSearch for a string in a file
9.command /?man commandDisplay the manual/help details of the command
10.chdirpwdReturns your current directory location
11.timedateDisplays the time
12.cdcdChange the current directory
13.mdmkdirTo create a new directory/folder
14.echoechoTo print something on the screen
15.editvim(depends on editor)To write in to files.
16.exitexitTo leave the terminal/command window.
17.formatmke2fs or mformatTo format a drive/partition.
18.freememTo display free space.
19.rmdirrm -rf/rmdirTo delete a directory.
20.taskkillkillTo kill a task.
21.tasklistps xTo list running tasks.
22.set var=valueexport var=valueTo set environment variables.
23.attribchown/chmodTo change file permissions.
24.tracerttracerouteTo print the route packets trace to network host.
25.atcrondaemon to execute scheduled commands.
26.typecatTo print contents of a file.
27.pingpingTo send ICMP ECHO_REQUEST to network hosts.
28.nslookupnslookupTo query Internet name servers interactively.
29.chdiskdu -sFor disk usage.
30.treels -R

To list directory recursively. 

31.mklink /D <软链接目录> <源目录>ln -s <目标目录> <软链接地址>创建软链接

参考自:

https://www.geeksforgeeks.org/linux-vs-windows-commands/

bash 命令

bash 终端命令梳理 - 腾讯云开发者社区-腾讯云

linux 下载 命令 wget 和 curl详解_擒贼先擒王的博客-CSDN博客

bash快捷键

Bash 快捷键大全 | 菜鸟教程

Git bash

Windows下的Git Bash配置,提升你的终端操作体验 - 知乎

Git bash 中使用 Windows 命令的正确打开方式 - 灰信网(软件开发博客聚合)

Git bash中复制粘贴快捷键:在options中keys标签下的ShortCuts中,第一个复选框“Copy and Paste”的作用:选上可使用Ctrl/Shift+Insert来复制粘贴,不过不管选不选都可使用Bash终端常用的复制粘贴快捷键Ctrl+Shift+C/V。另外,也可在Mouse标签下选择点击鼠标中键进行粘贴

 

PowerShell命令

PowerShell常用命令及使用方法:PowerShell常用命令及使用方法_Captain_RB的博客-CSDN博客_powershell命令大全

【PowerShell】常用命令_xkkui的博客-CSDN博客_powershell命令大全

PowerShell命令大全(图文详解)-windows运维-PHP中文网

PowerShell快捷键

官方文档中的快捷键:Windows PowerShell ISE 的键盘快捷方式 - PowerShell | Microsoft Learn

PowerShell不仅兼容几乎所有的cmd命令,还通过别名的方式兼容部分Linux Shell的命令,如:ls、kill、pwd、history、sleep、cd、rm、rmdir、ps、man,PowerShell命令称为cmdlet,与原本的cmd和Linux Shell不同,cmdlet的实现基于面向对象,借助.NET Framework平台强大的类库,实现强大的功能。
 

获取所有命令:get-command

给指定命令重命名:Set-Alias,如Set-Alias aaa Get-Command

与cmd一样,cls为清屏命令

帮助命令:help,首页显示不全,可以在--More--后按回车查看剩下的帮助信息

换行符:`【说明:是Esc下面那个反引号,Linux中Bash换行符是:\】

Shell Script 教程

Shell 教程 | 菜鸟教程

Shell变量默认值

在 shell 脚本中,如果要使用某个变量又想给它设置默认值,可以用:

XX=${YY-ZZ}

的方式,其中 ZZ 会是 YY 没有设置时的默认值。

另一种用法是:

XX=${YY:-ZZ}

区别是 :- 的方法在 YY 为空字符串时也会使用默认值。

例:

env=${SERVICE_ENV:-"Test"}
echo "env: ${env}" # 会输出 "env: Test"

Windows CMD命令

service.msc: 打开服务管理

regedit: 打开注册表管理器(Registry Editor)

msconfig: 打开Windows system configuration

mrt:运行 Malicious Software Removal Tool

eventvwr: 打开 Event Viewer

cleanmgr: 运行 disk cleanup

  • 4
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值