commands detail - a
alias (list all the aliases)
The Powershell equivalent of typing alias at the bash prompt is:
1 get-alias
alias (set an alias)
At it’s simplest, the powershell equivalent of the unix ‘alias’ when it’s used to set an alias is ‘set-alias’
1 set-alias ss select-string
However, there’s a slight wrinkle….
In unix, you can do this
1 alias bdump="cd /u01/app/oracle/admin/$ORACLE_SID/bdump/"
If you try doing this in Powershell, it doesn’t work so well. If you do this:
1 set-alias cdtemp "cd c:\temp"
2 cdtemp
…then you get this error:
1 cdtemp : The term 'cd c:\temp' is not recognized as the name of a cmdlet, function, \
2 script file, or operable program. Check the spelling of the name, or if a path was i\
3 ncluded, verify that the path is correct and try again.
4
5 At line:1 char:1
6
7 + cdtemp
8
9 + ~~~~~~
10
11 + CategoryInfo : ObjectNotFound: (cd c:\temp:String) [],
12
13 CommandNotFoundException
14
15 + FullyQualifiedErrorId : CommandNotFoundException
A way around this is to create a function instead:
1 remove-item -path alias:cdtemp
2
3 function cdtemp {cd c:\temp}
You could then create an alias for the function:
1 set-alias cdt cdtemp
apropos
apropos is one of my favourite bash commands, not so much for what it does…but because I like the word ‘apropos’.
I’m not sure it exists on all flavours of *nix, but in bash apropos returns a list of all the man pages which have something to do with what you’re searching for. If apropos isn’t implemented on your system you can use man -k instead.
Anyway on bash, if you type:
1 apropos process
…then you get:
1 AF_LOCAL [unix] (7) - Sockets for local interprocess communication
2
3 AF_UNIX [unix] (7) - Sockets for local interprocess communication
4
5 Apache2::Process (3pm) - Perl API for Apache process record
6
7 BSD::Resource (3pm) - BSD process resource limit and priority functions
8
9 CPU_CLR [sched_setaffinity] (2) - set and get a process's CPU affinity mask
10
11 CPU_ISSET [sched_setaffinity] (2) - set and get a process's CPU affinity mask
12
13 CPU_SET [sched_setaffinity] (2) - set and get a process's CPU affinity mask
14
15 CPU_ZERO [sched_setaffinity] (2) - set and get a process's CPU affinity mask
16
17 GConf2 (rpm) - A process-transparent configuration system
The Powershell equivalent of apropos or man -k is simply get-help
1 get-help process
2
3 Name Category Module Synopsis
4
5 ---- -------- ------ --------
6
7 get-dbprocesses Function Get processes for a particul...
8
9 show-dbprocesses Function Show processes for a particu...
10
11 Debug-Process Cmdlet Microso... Debugs one or more processes...
12
13 Get-Process Cmdlet Microso... Gets the processes that are ...
This is quite a nice feature of PowerShell compared to Bash. If get-help in Powershell shell scores a ‘direct hit’ (i.e. you type something like get-help debug-process) it will show you the help for that particular function. If you type something more vague, it will show you a list of all the help pages you might be interested in.
By contrast if you typed man process at the Bash prompt, you’d just get
1 No manual entry for process