The following lists some of my favorite Unix commands and maps the associated PowerShell and DOS commands, if any. If there is one Unix command I would love to have in PowerShell, it is the grep command with its regular expression support. I have noticed significant improvement in Vista's search capabilities compared to earlier versions of Microsoft operating systems that I have used and I would love to see that harnessed in PowerShell so that I could use it from the command line. The table appears a ways down, so scroll down to it.
UPDATE (24 March 2008): Note that I have updated this table with information on a grep
equivalent and on the availability of less
as an extension. Thanks to Kirk Munro for pointing both of these out (see Comments) and to Jeffrey Snover for his write-up of Select-String
at http://blogs.msdn.com/powershell/archive/2008/03/23/select-string-and-grep.aspx.
Thanks also to Marco Shaw for pointing out that start-transcript (which can be closed with stop-transcript) provides functionality like Unix's script command. Thanks to Jonathan for mentioning tasklist as an alternative to ps and mentioning F7 for a graphical presentation of history commands.
Unix/Linux | PowerShell | Windows Vista DOS |
---|
ls | ls dir | dir |
cp | cp copy | copy |
mv | mv move | move |
rm | rm del | del |
netstat | netstat | netstat |
man | man help | help |
ps | ps tasklist | tasklist |
finger | finger | finger |
script (stop with CTRL-D) | start-transcript (stop with stop-transcript) | |
clear | clear cls | cls |
cat | cat type | type |
history / h | history / h F7 | F7 |
unzip | unzip | unzip |
zip | zip | zip |
tee | tee | |
grep | Select-String | |
more | more | more |
less | less (extension) | |
edit | edit | edit |
kill | kill taskkill | taskkill |
Type ‘man
’ without any options in PowerShell command-line
to see long list of supported commands and scripting keywords.
The Windows PowerShell Quick Reference and Getting Started with Windows PowerShell are also useful resources.
Không có nhận xét nào:
Đăng nhận xét