SEC504: Hacker Tools, Techniques, and Incident Handling

Experience SANS training through course previews.
Learn MoreLet us help.
Contact usConnect, learn, and share with other cybersecurity professionals
Engage, challenge, and network with fellow CISOs in this exclusive community of security leaders
Become a member for instant access to our free resources.
Sign UpMission-focused cybersecurity training for government, defense, and education
Explore industry-specific programming and customized training solutions
Sponsor a SANS event or research paper
We're here to help.
Contact UsLet's look at several keyboard shortcuts to speed up your PowerShell sessions.
We have a different kind of an article today. Instead of talking about PowerShell commands or PowerShell scripting, we'll look at interacting with the Windows PowerShell shell itself, and how you can use keyboard shortcuts to speed up our work.
I need to establish a clean screen before I do anything serious in PowerShell. Pressing CTRL+L is faster than running [code]Clear-Host[/code] (and it works in Linux shells too!)
In Windows PowerShell, you can highlight a command with your mouse then press CTRL+C to copy. Paste with CTRL+C. No big revelation there.
But Windows PowerShell also supports automatic command highlighting with CTRL+A. Once it's highlighted, press CTRL+C. No mouse required!
You can press the up arrow to go back through your PowerShell session history, but you can also search quickly. Press CTRL+R and type a few letters that you remember from the previous command, and PowerShell will show you any matches.
Let's say you copy-paste a PowerShell 1-liner from some GitHub gist page. You can move the cursor using the left and right arrows and add a new line without executing the command by pressing Shift+Enter. Press Ctrl+Enter if you want to add a new line above the current line.
The last argument to a command is something that is often reused. You don't have to type it more than once: press Alt+. (Option + . on macOS) to insert the last argument of the previous command automatically.
We know you can press Tab to complete a command or option, but you can also press Ctrl+Space to get a visual selection of matching commands, choosing the one you want with arrow keys. If help information is available, it will be displayed automatically.
You can press Alt+Number (e.g., Alt+7) then any added character to input that many characters. If you need more than 9 characters, keep holding Alt and press the number of characters you need.
For example, want to enter 62 [code]*[/code] characters? Press Alt+62, then press [code]*[/code]:
Want to backspace 7 times? Alt+7, then press backspace:
This works for arrow keys and any other repeated input characters as well.
Finally, get a list of keyboard shortcuts by pressing Ctrl+Alt+Shift+?
Some of these I already use all the time, but others I probably won't use. But they are all useful anytime you feel like you need to [code]+2[/code] your PowerShell game.
-Joshua Wright
Return to Getting Started With PowerShell
Joshua Wright is the author of SANS SEC504: Hacker Tools, Techniques, and Incident Handling, a faculty fellow for the SANS Institute, and a senior technical director at Counter Hack.
As Senior Technical Director at Counter Hack and SANS Faculty Fellow, Joshua has advanced cybersecurity through ethical penetration testing, uncovering critical vulnerabilities across Fortune 500 companies and national infrastructure providers.
Read more about Joshua Wright