# CMD Run

```bash
# Get IP address
ipconfig getifaddr en0 | pbcopy

# Get macOS version
defaults read loginwindow SystemVersionStampAsString | pbcopy

# Flash DNS Cache
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

# Rebuild launch services
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister﻿ -kill -r -domain local -domain user﻿﻿﻿﻿﻿﻿﻿﻿﻿

# List all commands installed in $PATH
print -l $commands

# List all commands/aliases installed in $PATH
whence -m \*

# List all commands/aliases/functions installed in $PATH
print -rl - ${(k)builtins} ${(k)functions} ${(k)commands}

# Switch to root user on Linux
sudo su -

# Get current process PID
echo $$

# Reset launchpad
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

# List GPG secret keys
gpg --list-secret-keys --keyid-format LONG

# List GPG keys
gpg --list-keys

# Restart nginx with systemctl
sudo systemctl restart nginx

# Symlink source dir of Alfred workflow (https://gist.github.com/deanishe/35faae3e7f89f629a94e)
workflow-install -s -source

# List all processes running
ps aux

# Print exit code of last command ran
echo $?

# See all aliases assigned
alias

# List VSCode installed packages
code --list-extensions
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://woodrowpearson.gitbook.io/code-gists/cmd-run-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
