Useful Linux commands

By • last updated at
Tags: #linux

Git - delete commit history

# Delete local repository directory.
rm -rf .git

# Initialise local repository directory,
# add and commit all files.
git init
git add .
git commit -m "initial commit"

# Overwrite remote repository with the local directory
git remote add origin git@github.com:<account name>/<repository name>.git
git push -u --force origin main

NetCat - test reverse proxy

# Server
while true ; do nc -l -p 3000 -c 'echo -e "HTTP/1.1 200 OK\n\n $(date)"'; done

# Client
curl <ip:port>

NMAP - scan all 65535 ports

nmap -p- 192.168.1.1
back