commands summary

alias (set aliases)

  1. set-alias

More

alias (show aliases)

  1. get-alias

More

apropos

  1. get-help

More

basename

  1. dir | select name

More

cal

No equivalent, but see the script at http://www.vistax64.com/powershell/17834-unix-cal-command.html

cd

  1. cd

More

clear

  1. clear-host

More

date

  1. get-date

More

date -s

  1. set-date

More

df -k

  1. Get-WMIObject Win32_LogicalDisk | ft -a

More

diff

  1. Compare-Object -ReferenceObject (Get-Content file1) -DifferenceObject (Get-Content file2)

dirname

  1. dir | select directory

More

du

No equivalent, but see the link

echo

  1. write-output

More

echo -n

  1. write-host -nonewline

More

| egrep -i sql

  1. | where {[Regex]::Ismatch($\_.name.tolower(), "sql") }

More

egrep -i

  1. select-string

More

egrep

  1. select-string -casesensitive

More

egrep -v

  1. select-string -notmatch

More

env

  1. Get-ChildItem Env: | fl

or

  1. get-variable

More

errpt

  1. get-eventlog

More

export PS1=”$ “

  1. function prompt {"$ " }

More

find

  1. dir *whatever* -recurse

More

for (start, stop, step)

  1. for ($i = 1; $i -le 5; $i++) {whatever}

More

head

  1. gc file.txt | select-object -first 10

More

history

  1. get-history

More

history | egrep -i ls

  1. history | select commandline | where commandline -like '*ls*' | fl

More

hostname

  1. hostname

More

if-then-else

  1. if ( condition ) { do-this } elseif { do-that } else {do-theother}

More

if [ -f “$FileName” ]

  1. if (test-path $FileName)

More

kill

  1. stop-process

More

less

  1. more

More

locate

  1. no equivalent but see link

More

ls

  1. get-childitem OR gci OR dir OR ls

More

ls -a

  1. ls -force

More

ls -ltr

  1. dir c:\ | sort-object -property lastwritetime

More

lsusb

  1. gwmi Win32_USBControllerDevice

More

mailx

  1. send-mailmessage

More

man

  1. get-help

More

more

  1. more

More

mv

  1. rename-item

More

pg

  1. more

More

ps -ef

  1. get-process

More

ps -ef | grep oracle

  1. get-process oracle

More

pwd

  1. get-location

More

read

  1. read-host

More

rm

  1. remove-item

More

script

  1. start-transcript

More

sleep

  1. start-sleep

More

sort

  1. sort-object

More

sort -uniq

  1. get-unique

More

tail

  1. gc file.txt | select-object -last 10

More

tail -f

  1. gc -tail 10 -wait file.txt

More

time

  1. measure-command

More

touch - create an empty file

  1. set-content -Path ./file.txt -Value $null

More

touch - update the modified date

  1. set-itemproperty -path ./file.txt -name LastWriteTime -value $(get-date)

More

wc -l

  1. gc ./file.txt | measure-object | select count

More

whoami

  1. [Security.Principal.WindowsIdentity]::GetCurrent() | select name

More

whence or type

  1. No direct equivalent, but see link

More

unalias

  1. remove-item -path alias:aliasname

More

uname -m

  1. Get-WmiObject -Class Win32_ComputerSystem | select manufacturer, model

More

uptime

  1. get-wmiobject -class win32_operatingsystem | select LastBootUpTime`

More

\ (line continuation)

  1. ` (a backtick)

More