Skip to main content

Powershell: Get-History

Illustrated: HISTORY

Get-History - Gets a list of the commands entered during the current session.

Alias: history, h, or ghy.

h : Get list of commands entered in current session
r 12 : Run command with Id 12 in current history list
ihy 12 : Run command with Id 12 in current history list
Get-History
history

or simply type 'h' instead of 'history'

h

List the command with id 1

h 1

Add '-count n' or '-c n' to list the last n run command

h -c 1

Run command with id 5 in the history list

ihy 5

Related commands

Linux command: history

Popular posts from this blog

Linux command: printenv

printenv - print all or part of environment NAME        printenv - print all or part of environment SYNOPSIS        printenv [OPTION]... [VARIABLE]... DESCRIPTION        Print  the  values  of the specified environment VARIABLE(s).  If no VARIABLE is speci‐        fied, print name and value pairs for them all.        -0, --null               end each output line with NUL, not newline        --help display this help and exit        --version               output version information and exit        NOTE: your shell may have its own version of printenv,  which  usually  supersedes  the        version  described  here.  Please refer to your shell's documentation for d...

Powershell: Get-Content - tail command on Windows

Love tail command on Linux ? Try Get-Content with Powershell 3.0+.

Data Recovery Softwares

Follow 3-2-1 backup rule so you do not need these data recovery softwares.