Skip to main content

Command Line

Browse all articles, tutorials, and guides about Command Line

12posts

Guides

Posts

Git
|5 min read

How to Get the Current Branch Name in Git

Need to programmatically get the current Git branch name? Learn multiple methods to retrieve the branch name for scripts, CI/CD pipelines, and shell prompts.

Linux
|11 min read

How to Get the Current Date, Time and Epoch Seconds in Linux and Bash

Print and format the current date and time with date, get Unix epoch seconds and milliseconds, convert between dates and timestamps, measure how long a command takes, and turn your favorite format into a custom command.

Networking
|7 min read

Close a Port on Windows from the Command Line

Find the PID with netstat -ano | findstr :PORT, checking the Local Address column, then end it with taskkill /PID <pid> /F, or block the port with netsh.

Linux
|7 min read

How to Find Files Containing Specific Text on Linux

Need to locate files with specific content? Learn how to use grep, find, and other Linux tools to search through files and directories efficiently.

Git
|8 min read

How to Reset Local Git Branch to Match Remote Repository HEAD

Learn different methods to reset your local Git branch to exactly match the remote repository HEAD, including hard reset, fetch and reset, and when to use each approach safely.

Git
|13 min read

How to Push a New Local Branch to Remote Git Repository and Track It

Push a new branch with git push -u origin <branch>, fix "src refspec does not match any", and rename or delete a branch locally and on the remote.

Linux
|13 min read

How to Recursively Grep All Directories and Subdirectories

Learn how to use grep with recursive options to search through entire directory trees efficiently, exclude directories, list only matching file names, and filter live log streams without buffering delays.

Linux
|9 min read

How to Copy Command Output Directly to Your Clipboard in Linux

Pipe command output to the clipboard with wl-copy on Wayland, xclip or xsel on X11, pbcopy on macOS and clip.exe on WSL. Paste it back, write clipboard functions for scripts, and copy to your local clipboard over SSH.

Bash
|7 min read

How Does cat << EOF Work in Bash?

Understand heredocs in Bash - the << EOF syntax that lets you write multi-line strings, create files with embedded content, and pass complex input to commands.

Networking
|9 min read

How to Get Your Local IP Address

Learn multiple methods to find your local IP address using command line tools, programming languages, and system utilities across different operating systems.