Step 01: Check go lang version:

go version

go install:

sudo apt - fix-broken install
sudo apt install gccgo-go
sudo apt install golang-go

Step 02: Now we can install the GF tool via Go:

go install github.com/tomnomnom/gf@latest

optional:

go install github.com/tomnomnom/waybackurls@latest

After installation, make sure Go's bin folder is in your PATH:

echo 'export PATH=$PATH:/home/usr_name/go/bin' >> ~/.zshrc
source ~/.zshrc

or

echo 'export PATH=$PATH:/home/usr_name/go/bin' >> ~/.bashrc
source ~/.bashrc

example:

echo 'export PATH=$PATH:/home/hafiz/go/bin' >> ~/.zshrc
source ~/.zshrc

Step 03:

Then download the different patterns to use with gf tool:

git clone https://github.com/NitinYadav00/gf-patterns.git

or

git clone https://github.com/Sherlock297/gf_patterns.git

Step 04:

mkdir -p ~/.gf
cd gf-Patterns

Now copy all patterns to the .gf folder, which we had created above:

cp -r *.json ~/.gf

Move downloaded gf tool and waybackurls in the bin folder for easy access:

cd go/bin 
cp gf waybackurls /usr/bin/
cd ..
cd .gf
or
root path

That's it. Installation is complete, you can check:

ls
gf -h
gf -list

Usage Example:

waybackurls testphp.vulnweb.com | gf xss | tee xssfilter.txt

Use GF with httpx or gau results:

cat find_urls.txt | gf xss | sort -u | tee final_output.txt
cat Find_urls.txt | gf sqli | sort -u | tee final_output.txt

count url:

wc -l xssfilter.txt
cat xssfilter.txt

Simply use the below one-liner command :

go install github.com/tomnomnom/gf@latest && cp ~/go/bin/gf /usr/bin/ && gf -h && mkdir ~/.gf && git clone https://github.com/NitinYadav00/gf-patterns.git && cd gf_patterns/ && cp *.json ~/.gf && gf -list