CMD vs PowerShell vs Bash (CMD, PowerShell,Bash三种CLI Shell的对比)

CMD, PowerShell and Bash are 3 different kinds of CLI (Command Line Interface) Shells.

CMD (Command Prompt):

  • CMD, short for Windows Command Prompt, is the default command-line interpreter for Microsoft Windows operating systems.
  • CMD operates with pre-built commands like cd, copy, ping, etc.
  • The output is in the form of characters, and it treats input and output as text structures.

PowerShell:

  • PowerShell is an advanced version of CMD with added functionalities and features.
  • Designed for system administrators, it’s a task-based command-line interface based on the .NET Framework. It has a more interactive graphical command-line interface (CLI) and better support for server automation tasks.
  • Unlike CMD, PowerShell treats input and output as objects, making it more versatile.
  • PowerShell supports creating custom cmdlets and aliases for both CMD and Bash commands.
  • PowerShell learning documentation: PowerShell学习文档, PowerShell learning documentation

Bash:

  • Bash is a command-line and scripting language primarily used in Unix/Linux-based operating systems. It’s the default shell in most Linux distributions and has been around since the early days of Unix.
  • Like CMD, Bash treats input and output as text structures.
  • commands cheat sheet: linux-commands-cheat-sheet-pdf.pdf

Compatibility aliases in Windows PowerShell

PowerShell has several aliases that allow UNIX and cmd.exe users to use familiar commands in Windows. The following table show common commands, the related PowerShell cmdlet, and the PowerShell alias:
https://learn.microsoft.com/zh-cn/powershell/scripting/learn/shell/using-aliases?view=powershell-7.4

cmd.exe commandUNIX commandPowerShell cmdletPowerShell alias
cd, chdircdSet-Locationsl, cd, chdir
clsclearClear-Hostcls, clear
copycpCopy-Itemcpi, cp, copy
del, erase, rd, rmdirrmRemove-Itemri, del, erase, rd, rm, rmdir
dirlsGet-ChildItemgci, dir, ls
echoechoWrite-Outputwrite, echo
mdmkdirNew-Itemni
movemvMove-Itemmi, move, mi
popdpopdPop-Locationpopd
pwdGet-Locationgl, pwd
pushdpushdPush-Locationpushd
renmvRename-Itemrni, ren
typecatGet-Contentc, cat, type
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值