如果没有别名,这世界将毫无意思
发布日期:2021-05-07 18:05:27 浏览次数:19 分类:精选文章

本文共 3358 字,大约阅读时间需要 11 分钟。

别名的好处

别名(Alias)是一种通过为命令或操作创建简化名称来提高工作效率的技术。在实际应用中,别名能够显著简化操作流程,减少记忆量,并提升命令的兼容性。

Linux和macOS下的别名配置

在Linux和macOS系统中,用户可以通过设置别名来优化工作环境。这些操作系统都内置了alias命令,用户可以通过编辑~/.bash_profile文件来配置持久化别名。

Windows下的别名配置

Windows系统在命令行环境下(如CMD、PowerShell)同样支持别名配置,但与Linux有所不同。用户需要通过PowerShell命令来创建和管理别名。

Windows下的别名命令示例

以下是Windows命令行环境中常见的别名命令及其对应的功能:

  • %:对应ForEach-Object
  • ?:对应Where-Object
  • ac:对应Add-Content
  • asnp:对应Add-PSSnapin
  • cat:对应Get-Content
  • cd:对应Set-Location
  • CFS:对应ConvertFrom-String
  • chdir:对应Set-Location
  • clc:对应Clear-Content
  • clear:对应Clear-Host
  • clhy:对应Clear-History
  • cli:对应Clear-Item
  • clp:对应Clear-ItemProperty
  • cls:对应Clear-Host
  • clv:对应Clear-Variable
  • cnsn:对应Connect-PSSession
  • compare:对应Compare-Object
  • copy:对应Copy-Item
  • cp:对应Copy-Item
  • cpp:对应Copy-ItemProperty
  • curl:对应Invoke-WebRequest
  • cvpa:对应Convert-Path
  • dbp:对应Disable-PSBreakpoint
  • del:对应Remove-Item
  • diff:对应Compare-Object
  • dir:对应Get-ChildItem
  • dnsn:对应Disconnect-PSSession
  • ebp:对应Enable-PSBreakpoint
  • echo:对应Write-Output
  • epal:对应Export-Alias
  • epcsv:对应Export-Csv
  • epsn:对应Export-PSSession
  • erase:对应Remove-Item
  • etsn:对应Enter-PSSession
  • exsn:对应Exit-PSSession
  • fc:对应Format-Custom
  • fhx:对应Format-Hex
  • fl:对应Format-List
  • foreach:对应ForEach-Object
  • ft:对应Format-Table
  • fw:对应Format-Wide
  • gal:对应Get-Alias
  • gbp:对应Get-PSBreakpoint
  • gc:对应Get-Content
  • gci:对应Get-ChildItem
  • gcm:对应Get-Command
  • gcs:对应Get-PSCallStack
  • gdr:对应Get-PSDrive
  • ghy:对应Get-History
  • gi:对应Get-Item
  • gjb:对应Get-Job
  • gl:对应Get-Location
  • gm:对应Get-Member
  • gmo:对应Get-Module
  • gp:对应Get-ItemProperty
  • gps:对应Get-Process
  • gpv:对应Get-ItemPropertyValue
  • group:对应Group-Object
  • gsn:对应Get-PSSession
  • gsnp:对应Get-PSSnapin
  • gsv:对应Get-Service
  • gu:对应Get-Unique
  • gv:对应Get-Variable
  • gwmi:对应Get-WmiObject
  • h:对应Get-History
  • history:对应Get-History
  • icm:对应Invoke-Command
  • iex:对应Invoke-Expression
  • ihy:对应Invoke-History
  • ii:对应Invoke-Item
  • ipal:对应Import-Alias
  • ipcsv:对应Import-Csv
  • ipmo:对应Import-Module
  • ipsn:对应Import-PSSession
  • irm:对应Invoke-RestMethod
  • ise:对应powershell_ise.exe
  • iwmi:对应Invoke-WMIMethod
  • iwr:对应Invoke-WebRequest
  • kill:对应Stop-Process
  • lp:对应Out-Printer
  • ls:对应Get-ChildItem
  • man:对应help
  • md:对应mkdir
  • measure:对应Measure-Object
  • mi:对应Move-Item
  • mount:对应New-PSDrive
  • move:对应Move-Item
  • mp:对应Move-ItemProperty
  • mv:对应Move-Item
  • nal:对应New-Alias
  • ndr:对应New-PSDrive
  • ni:对应New-Item
  • nmo:对应New-Module
  • npssc:对应New-PSSessionConfigurationFile
  • nsn:对应New-PSSession
  • nv:对应New-Variable
  • ogv:对应Out-GridView
  • oh:对应Out-Host
  • popd:对应Pop-Location
  • ps:对应Get-Process
  • pushd:对应Push-Location
  • pwd:对应Get-Location
  • r:对应Invoke-History
  • rbp:对应Remove-PSBreakpoint
  • rcjb:对应Receive-Job
  • rcsn:对应Receive-PSSession
  • rd:对应Remove-Item
  • rdr:对应Remove-PSDrive
  • ren:对应Rename-Item
  • ri:对应Remove-Item
  • rjb:对应Remove-Job
  • rm:对应Remove-Item
  • rmdir:对应Remove-Item
  • rmo:对应Remove-Module
  • rni:对应Rename-Item
  • rnp:对应Rename-ItemProperty
  • rp:对应Remove-ItemProperty
  • rsn:对应Remove-PSSession
  • rsnp:对应Remove-PSSnapin
  • rujb:对应Resume-Job
  • rv:对应Remove-Variable
  • rvpa:对应Resolve-Path
  • rwmi:对应Remove-WMIObject
  • sajb:对应Start-Job
  • sal:对应Set-Alias
  • saps:对应Start-Process
  • sasv:对应Start-Service
  • sbp:对应Set-PSBreakpoint
  • sc:对应Set-Content
  • select:对应Select-Object
  • set:对应Set-Variable
  • shcm:对应Show-Command
  • si:对应Set-Item
  • sl:对应Set-Location
  • sleep:对应Start-Sleep
  • sls:对应Select-String
  • sort:对应Sort-Object
  • sp:对应Set-ItemProperty
  • spjb:对应Stop-Job
  • spps:对应Stop-Process
  • spsv:对应Stop-Service
  • start:对应Start-Process
  • sujb:对应Suspend-Job
  • sv:对应Set-Variable
  • swmi:对应Set-WMIInstance
  • tee:对应Tee-Object
  • trcm:对应Trace-Command
  • type:对应Get-Content
  • wget:对应Invoke-WebRequest
  • where:对应Where-Object
  • wjb:对应Wait-Job
  • write:对应Write-Output
上一篇:地表最强mysql命令行连接工具mycli
下一篇:windows下的终端工具和产品力

发表评论

最新留言

很好
[***.229.124.182]2025年04月13日 00时42分47秒