Monthly Archives: July 2025

nmcli

Basic Commands

CommandDescription
nmcliShow general help
nmcli general statusShow overall NetworkManager status
nmcli general hostnameView or set system hostname
nmcli radio allShow Wi-Fi and Bluetooth state
nmcli networking on/offEnable or disable all networking
nmcli connection showList saved connections
nmcli device statusShow status of all devices

Device Management

CommandDescription
nmcli deviceList all devices
nmcli device showShow detailed info for all devices
nmcli device disconnect <device>Disconnect a specific device (e.g. wlan0)
nmcli device connect <device>Connect a specific device

Wi-Fi

CommandDescription
nmcli device wifi listList available Wi-Fi networks
nmcli device wifi connect <SSID> password <password>Connect to a Wi-Fi network
nmcli device wifi connect <SSID> --askConnect to a Wi-Fi network and ask for password
nmcli connection show --activeShow active connections
nmcli connection up <name>Activate a connection
nmcli connection down <name>Deactivate a connection

Connections (Profiles)

CommandDescription
nmcli connection add type ethernet ifname eth0 con-name homeAdd new Ethernet connection
nmcli connection modify <name>Modify connection settings
nmcli connection delete <name>Delete a saved connection
nmcli connection clone <name> <new_name>Clone a connection profile

Reset and Troubleshooting

CommandDescription
nmcli connection reloadReload all connection profiles
nmcli networking off && nmcli networking onRestart networking
nmcli --askPrompt for password or secrets interactively

powercfg

Disable hibernation

powercfg /hibernate off

What sleep states are available?

powercfg /availablesleepstates

What device caused last wake?

powercfg /lastwake

What device blocks sleep?

powercfg /requests

# Ignore driver
powercfg /requestsoverride DRIVER "Realtek High Definition Audio" System

# View ignored drivers
powercfg /requestsoverride

git

Configure

# Config username and email
git config --global user.name jdoe
git config --global user.email [email protected]

# To avoid detected dubious ownership warning
git config --global --add safe.directory "*"

Initialize Repository

git init                     # Create a new Git repository
git clone <url>              # Clone an existing repository

Working with Changes

git status                   # Show the working directory status
git add -A                   # Stage all changes
git add <file>               # Stage a specific file
git reset                    # Unstage all files (keep changes)
git reset <file>             # Unstage a specific file
git mv <source> <dest>       # Rename file
git checkout -- <file>       # Revert local file changes
# Revert changes on single file to previous commit
git checkout <commit-hash> <file>

# Revert changes made by specified commit
git revert <commit-hash>

Commit & History

git commit -m "Message"       # Commit with a message
git log                       # View commit history
git log --oneline             # Compact log view
git log -3 --name-status      # Last 3 changes with file names
git log --follow -p -- <file> # Follow file history

Blame

# Blame from line X to Y
git blame -L X,Y <file>

# Show changes on a file from a specified commit
git show <commit-hash> -- <file>

Push & Pull

git push origin <branch>    # Push changes to the remote branch
git push origin -u <branch> # Push new branch
git pull                    # Fetch and merge changes from remote
git fetch --all             # Fetch all from remote
# Delete branch from remote
git push origin --delete <branch>

Patching

# Patch from uncommitted changes
git diff > changes.patch

# Patch from changes between two commits
git diff commit1 commit2 > changes.patch

Branching

git branch                 # List all branches
git branch <name>          # Create a new branch
git branch -d <name>       # Delete a branch
git checkout <branch>      # Switch to a branch
git checkout -b <name>     # Create and switch to a new branch
git merge <branch>         # Merge a branch into the current one

Tagging

git tag <name>             # Create new tag
git push origin --tags     # Push tags to remote
# Tag with current date / time
git tag PUB_$(date -Format 'yyMMdd')
git tag PUB_$(date -Format 'yyMMdd-HHmm')

Undoing Changes

git restore <file>           # Discard changes in a file
git reset --hard             # Discard all uncommitted changes

Remote Repositories

git remote -v                # Show remote repositories
git remote add origin <url>  # Add a remote repository
git remote rm origin         # Remove a remote repository