Tag: Command Line

Browse all articles, tutorials, and guides about Command Line

Guides

Posts

Linux
2025-04-12|7 min read

How to Kill All Processes with a Given Partial Name in Linux

Learn how to terminate multiple processes by matching partial names using pkill, killall, and other methods. Understand the risks and safe practices for bulk process termination.

Git
2025-04-05|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
2025-03-28|7 min read

How to Get Current Date and Time in Linux Terminal and Create Custom Commands

Learn how to display the current date and time in various formats using the date command, and create custom shell aliases for quick access to your preferred formats.

Windows
2025-03-28|7 min read

How to Close TCP and UDP Ports via Windows Command Line

Learn how to close open ports on Windows using command-line tools. Find and terminate processes listening on ports, manage Windows Firewall rules, and stop services to free up ports.

Linux
2025-03-10|7 min read

How to Tar a Directory While Excluding Files and Folders

Create tar archives without including unnecessary files like node_modules, .git, or build artifacts. Learn to use --exclude patterns effectively for cleaner backups.

Linux
2025-02-20|6 min read

How to Force cp to Overwrite Files Without Confirmation

Learn how to use cp command to overwrite existing files without prompts, understand the -f flag, and handle alias conflicts that cause unexpected confirmation requests.

Linux
2025-02-15|5 min read

How to Remove a Symlink to a Directory in Linux

Removing a symlink to a directory can be tricky if you're not careful. Learn the correct way to delete symlinks without accidentally removing the target directory's contents.

Linux
2025-01-22|6 min read

How to Get the Full Path of a File in Linux

Learn different methods to get the absolute path of a file in Linux, from simple commands like realpath to handling relative paths and symlinks correctly.

Bash
2025-01-15|7 min read

How to Redirect All Output to a File in Bash

Learn how to redirect stdout and stderr to files in Bash, capture both standard output and errors together, and understand the different redirection operators.

Linux
2025-01-08|6 min read

How to Exclude Directories from grep -R

Learn how to exclude specific directories when searching recursively with grep, including node_modules, .git, and other directories you want to skip.

Linux
2024-12-15|5 min read

How to Check Which Process is Using a Specific Port from Command Line

Learn how to identify which processes are listening on specific ports using netstat, lsof, and ss commands across different operating systems.

Linux
2024-12-15|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
2024-12-15|5 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
2024-12-14|5 min read

How to Reset or Revert a File to a Specific Revision in Git

Learn multiple ways to reset or revert a specific file to a previous version in Git, including using git checkout, git restore, and git show commands with practical examples.

Git
2024-12-13|5 min read

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

Learn how to push a new local Git branch to a remote repository and set up tracking, including different methods for initial push, setting upstream branches, and managing branch relationships.

Git
2024-12-12|5 min read

How to Revert Git Repository to a Previous Commit Safely

Learn multiple safe methods to revert your Git repository to a previous commit, including using git revert, git reset, and git checkout with practical examples and safety considerations.

Git
2024-12-10|7 min read

How to Undo the Most Recent Local Commits in Git

Learn different ways to undo recent Git commits using reset, revert, and rebase commands. Understand when to use each method safely.

Linux
2024-12-08|6 min read

How to Count Number of Lines in Files Using Linux Terminal

Learn different methods to count lines in text files like CSV, TXT, and other non-binary files using wc, awk, sed, and other Linux command-line tools.

Git
2024-12-08|6 min

How to Delete a Git Branch Locally and Remotely

Learn how to safely delete Git branches both on your local machine and remote repositories using different Git commands and safety checks.

Git
2024-12-05|8 min

What is the Difference Between Git Pull and Git Fetch?

Understand when to use git pull versus git fetch, how they affect your local repository, and which command is safer for different workflows.

Linux
2024-12-05|5 min read

How to Use Grep to Show Only Filenames on Linux

Learn how to use grep options to display only the names of files containing matches, making it easier to identify relevant files in large searches.

Linux
2024-12-05|6 min read

How to Recursively Count Files in a Linux Directory

Learn different methods to count files in a directory and its subdirectories, including fast one-liners and options for filtering by type, size, or pattern.

Git
2024-12-02|5 min read

How to Rename a Local Git Branch

Learn how to rename Git branches locally using git branch -m, handle the current branch, and update remote tracking references safely.

Git
2024-12-01|7 min read

How to Reset Git to a Previous Commit

Learn different ways to reset your Git repository to a previous commit state. Understand the differences between soft, mixed, and hard resets and when to use each approach.

Linux
2024-11-30|6 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, including advanced filtering and performance optimization techniques.

Git
2024-11-28|6 min read

How to Undo Git Add Before Commit

Learn how to unstage files that you've added to Git's staging area using git reset, git restore, and other methods before committing.

Git
2024-11-25|7 min

How to Force Git Pull to Overwrite Local Files

Learn how to use git reset, git clean, and git checkout to force git pull to overwrite local changes when you need to match the remote repository exactly.

Linux
2024-11-25|6 min read

How to Use sudo to Redirect Output to a Privileged Location

When you try to redirect output to a file you don't have permission to write, sudo doesn't help the way you'd expect. Learn the right techniques to write to protected files.

Git
2024-11-22|6 min

How to Check Out a Remote Git Branch

Learn different methods to check out remote Git branches locally using git checkout, git switch, and git fetch commands with practical examples.

Git
2024-11-16|6 min read

How to Remove Local Untracked Files from Git Working Tree

Learn how to use git clean to remove untracked files and directories from your Git working tree safely with different options and safety checks.

Linux
2024-11-12|7 min read

How to Compare Two Directory Trees and Find Files That Differ by Content

Learn different methods to compare two directory structures and identify which files have different content, using tools like diff, rsync, and custom scripts.

Linux
2024-11-08|7 min read

How to Fix "Argument List Too Long" Error for rm, cp, and mv Commands

Solve the 'argument list too long' error when working with thousands of files. Learn to use find, xargs, and loops as alternatives to wildcards for bulk file operations.

Linux
2024-10-18|6 min read

How to Grep a Continuous Stream in Real-Time

Learn how to filter live log streams with grep, including line-buffering for immediate output, following log files, and monitoring command output as it happens.

Linux
2024-09-25|6 min read

How to Copy Command Output Directly to Your Clipboard in Linux

Learn how to pipe command output to your clipboard using xclip, xsel, or pbcopy. Make terminal output available for pasting into applications without selecting and copying manually.

Bash
2024-09-18|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
2024-09-01|7 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.