Powershell and Bash
Last Updated
September 7, 2026
Some basic tips and rules for navigating Windows and Linux with powershell and bash. This was made for my own personal use and does assume that any reader is pretty familiar with bash commands and mainly interested in learning how to transfer these same skills to navigating a Windows system via powershell.
Powershell eccentricitys
- Get-Help (linux of -h or --help or man x)
Get-Help lsorGet-Help ls --full-Forceon ls is likels -a- example:
ls -Force C:\to seeProgramData
- example:
- As a general rule just change forward slash to backslash in Powershell and things just kind of work as you'd expect. This is because while powershell commands are weird, but have a ton of aliases that are mapped to the UNIX equivalents.
- Some exceptions to the rule:
-fbecomes-Force-rbecomes-Recurse- Often arguments needs to be at the end of a command, ex:
rm -r FILE -Recurse
- Often arguments needs to be at the end of a command, ex:
- Powershell doesn't have
lesscommand, just the old bashmore, which does still work. Select-String- ps version ofgrep-Filterlets you search for files in a directory, ex:ls C:\ -Recurese - Filter *.exewill give you so much data that you won't be able to use it for anything if you don't pipe it throughmore.
Escape Characters
- In Linux
\is the escape character.mkdir My\ Folder - Windows in it's normal weird fashion uses a backtick `
mkdir My` Folder
historyCtrl+R allows searching through recent command history in Powershell and bash.- wildcard * is handy as hell, cool example:
cp *.jpg ~/Dowloads/
# Copies all jpegs from working directory to ~/Downloads
Linux stuff
- /bin - stores apps
- /etc - system configs
- /home - duh
- /proc - currently running process
- /usr - usr intalled files
- /var - temp stuff (sort of)
ls -l broken down
| permissions | # of links | file owner group | size | date of modification | Name |
|---|---|---|---|---|---|
| drwxr-xr-x | 2 | makc makc | 3 | Sep 3 19:00 | Desktop |
| drwxr-xr-x | 13 | makc makc | 14 | Sep 6 17:49 | Documents |
| drwxr-xr-x | 4 | makc makc | 5 | Sep 6 21:22 | Downloads |
Viewing Files
cat- prints full filehead- first 10 lineshead -n 1 FILE- prints specific number of lines (10 is just a default)head --lines 1 FILE- same thing
tail- last 10 linestail -n 1 FILE- prints specific number of lines (10 is just a default)tail --lines 1 FILE- same thing
less- fills window with text file- Bash also has the legacy
morecommand, but why bother if you don't have to?
- Bash also has the legacy
Grep and His Powerful Friends
Way better than the powershell set-up (or at least less weird). Some examples follow:
grep "America is doomed" Documents/journal/*.md- finds every-time I wrote a journal entry after watching the news in 2026.grep "America is doomed" Documents/journal/*.md | less- give me an output that I can actually parse easily.grep -c "America is doomed" Documents/journal/*.md- would just brake down how mnay times I've used the phrase in a journal.- Example Output:
Documents/journal/volume-03.md:20 Documents/journal/volume-04.md:122 Documents/journal/volume-05.md:36 Documents/journal/volume-06.md:79 Documents/journal/volume-07.md:22grep -i- case insensitivegrep -n pattern- show line numbers with outputgrep -w- only returns if pattern matches exactlygrep -w data app.logwouldn't return the word "database" as a result
- Showing lines before or after pattern is found:
- Before:
grep -B 2 "data" app.log- shows two lines before "data" - After:
grep -A 85 "data" app.log- shows eighty-five lines before "data"
- Before:
grep "America is doomed | sort --unique- filters out anytime I've just timed "America is doomed" and ended the entry there.
