Tag: Command Line
Browse all articles, tutorials, and guides about Command Line
Guides
Introduction to Linux
A practical guide to getting started with Linux for beginners and experienced users alike. Learn the basics of the Linux operating system, command line, and system administration skills needed to feel comfortable in a Linux environment.
Introduction to Bash
A guide to learning the basics of Bash scripting and command line usage.
Posts
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.