𦫠Installing Go and Go-Based Tools (like `hakrevdns`) on Linux
Walks through installing Go on Linux and using `go install` to build tools like `hakrevdns`, then moving them to a system-wide PATH.
What this file does
Walks through installing Go on Linux and using go install to build tools like hakrevdns, then moving them to a system-wide PATH.
When to use it
- Setting up a fresh Linux pentesting or development environment
- Installing Go-based security tools like
httpxorsubfinder - Learning how Go separates compiler files from user-installed binaries
- Automating global tool installation with a shell function
Assumes this stack
𦫠Installing Go and Go-Based Tools (like hakrevdns) on Linux
š§ Step 1: Check if Go is Installed
go version
If it says command not found, continue below.
š§© Step 2: Download and Install Go
Visit the official Go download page: š https://go.dev/dl/
Then download the latest Linux tarball, for example:
wget https://go.dev/dl/go1.23.2.linux-amd64.tar.gz
Remove any old installation:
sudo rm -rf /usr/local/go
Extract it to /usr/local:
sudo tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz
āļø Step 3: Add Go to Your PATH
If you use Zsh (default on Kali, Parrot, etc.):
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.zshrc
source ~/.zshrc
If you use Bash:
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
Check Go version:
go version
ā
Should print something like go version go1.23.2 linux/amd64
š§ Understanding Go's Folder Structure
Itās important to understand how Go separates its compiler from user-installed tools:
| Location | Purpose | Owner |
|---|---|---|
/usr/local/go | Go compiler & standard library | Root/system |
~/go/bin | Where Go installs new tools (like httpx, hakrevdns, etc.) | Your user |
/usr/local/bin | Where you can move tools to make them globally available | Root/system |
š Explanation
/usr/local/goā contains the Go runtime and compiler. You should not install tools here.~/go/binā Go automatically puts new binaries here when you rungo install ..../usr/local/binā already in your PATH system-wide, so moving tools here makes them available everywhere.
Even though Go is installed in /usr/local/go, your tools are still built under ~/go/bin by default. This design keeps system files separate from user data.
If you want your tools to be globally accessible, you can manually move them:
sudo mv ~/go/bin/hakrevdns /usr/local/bin/
Now you can run it from anywhere:
hakrevdns -h
š§° Step 4: Install a Go Tool (Example: hakrevdns)
Method 1 ā Regular Install (Default Behavior)
go install github.com/hakluke/hakrevdns@latest
This builds the binary in:
~/go/bin/hakrevdns
Move it globally:
sudo mv ~/go/bin/hakrevdns /usr/local/bin/
Test:
hakrevdns -h
Method 2 ā Automated Helper Function (Optional)
Add this function to your ~/.zshrc:
goinstall() {
go install "$1"
tool=$(basename "$1" | cut -d'@' -f1)
sudo mv ~/go/bin/$tool /usr/local/bin/ 2>/dev/null
echo "$tool installed globally."
}
Reload your shell:
source ~/.zshrc
Now install globally in one line:
goinstall github.com/hakluke/hakrevdns@latest
ā Output example:
hakrevdns installed globally.
š§ Notes
/usr/local/go/binā Go compiler~/go/binā Build output for tools/usr/local/binā Global tools location
š Verify
which go
which hakrevdns
Both should show paths under /usr/local/.
ā Example Summary
| Task | Command |
|---|---|
| Install Go | sudo tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz |
| Add PATH | export PATH=$PATH:/usr/local/go/bin |
| Install tool | go install github.com/hakluke/hakrevdns@latest |
| Move globally | sudo mv ~/go/bin/hakrevdns /usr/local/bin/ |
What's inside
5 steps, 2 installation methods, 1 optional helper function, 1 comparison table, 1 summary table
Change this for your project
- Replace
go1.23.2.linux-amd64.tar.gzwith the latest Go version URL - Replace
github.com/hakluke/hakrevdnswith the tool you want to install - Replace
~/.zshrcwith~/.bashrcif you use Bash
Where it goes
A standard operating procedure. Keep where the team or agent running the process will find it.
Worth borrowing
- Using a shell function to combine
go installandsudo mvinto one command - Explaining the three key directories and their ownership to demystify Go's layout
Related Documents
Comprehensive AI Assistant Tools Reference
Lists 80+ tools with MCP server associations, bulk support, parallel capability, resource impact, and execution type for AI agent workflows.
iOS Deployment Guide
Walks through setting up an iOS development environment, building a Tauri app for iOS, and publishing to the App Store or alternative channels.
How to Add Resources to Your FastMCP Server
Teaches how to add static and dynamic MCP resources to a FastMCP server, with six ready-to-copy examples for a GitHub crawler.
Continue.dev MCP Integration Setup Guide
Walks through configuring Continue.dev to connect an MCP server for spatial transcriptomics tasks, with local and remote setup options.