• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Justin Joyce

Practical tips and tutorials about software development.

  • Standing Invitation
  • Featured Posts
  • Latest
  • About

Command Line

Bash ampersand (&)

Posted May 10, 2023 — Updated Jan 10, 2024

The single ampersand & is used to run commands asynchronously in the background. From the bash docs: If a command is terminated by the control operator ‘&’, the shell executes the command asynchronously in a subshell. This is known as executing the command in the background, and these are referred to as asynchronous commands. The […]

Filed Under: Command Line, Shell

How to kill a process

Posted May 5, 2023 — Updated Jan 10, 2024

The easiest way: use pkill to kill a running process by name. Let’s say you have a background task running: Those sleep commands will run for 60 seconds and 600 seconds, respectively. Kill a process by name If we want to kill them sooner, we can just pkill them by name: pkill works similar to […]

Filed Under: Command Line

The Bash trap command

Posted Apr 29, 2023 — Updated Jan 10, 2024

Bash’s trap command is used to catch and react to signals sent to your shell. It’s similar to an event listener in the browser, or a pubsub topic subscriber. The typical use case is to run some kind of cleanup command when a process terminates, like this: The command above will run cleanup_job when it […]

Filed Under: Command Line, Shell

Save your shell history to log files

Posted Mar 28, 2023 — Updated Oct 26, 2023

Every command I enter on my computer is written to a log file. These logs have come in handy countless times; I tell anyone who will listen to save their logs too. My inspiration for doing this came from this atomic object post many years ago, and I am so glad I followed their advice. […]

Filed Under: Command Line, Featured, Productivity, Tips

Copy and paste from the command line

Posted Feb 22, 2023 — Updated Jan 10, 2024

We use copy and paste all the time, so why not use them from the command line? I do it all the time, so let’s do a quick run down. First, the commands: Copy something from the web and paste it to a file This is my most frequent usage of either of these commands, […]

Filed Under: Command Line, Productivity, Tips

How to free up disk space

Posted Feb 8, 2023 — Updated Jan 10, 2024

Part of being a developer means constantly downloading new packages, updates, codebases, etc. Eventually, your computer starts to fill up. This post details how to clean it out. The du command This is the disk usage command, and it is key to figuring out what is using your space. Here’s my usual workflow: Starting at […]

Filed Under: Command Line, Tips

Command line manual pages and tldr

Posted Jan 20, 2023 — Updated Jan 10, 2024

When looking into command line … commands, you’ve probably seen the man command, which is short for manual. For instance, if I want to know all about the ls command I can run man ls, which returns this on my mac: That’s a lot of info, and the screenshot above just the tip of the […]

Filed Under: Command Line, Tips, Tools

How to find files on linux / mac

Posted Jan 19, 2023 — Updated Jan 10, 2024

Command line find is a powerful, underutilized tool. In this post, I’ll go through the following use cases: Find files by name I use this all the time. Let’s say I’m in my ~/Downloads directory. That directory has several hundred files in it—and quite a few subdirectories—so it’s a bit hard to comb through in […]

Filed Under: Command Line, Productivity

Grep, grep options, and grep’s faster open-source alternative: ripgrep

Posted Dec 24, 2022 — Updated Feb 7, 2024

Tldr: Grep In large codebases just finding the things you need can be hard. The built-in solution on linux/unix is grep. The basic format is grep {search_term} {file_path}. Here are a few simple examples: Here are a few commonly-used useful flags for grep: Flag Effect -i makes search case-insensitive -r recursively search directories -n show […]

Filed Under: Command Line, Featured, Productivity, Tools

Primary Sidebar

Recent Posts

  • Every Built-In Vim Color Scheme (with screenshots)
  • Reverse a string in Python
  • Meeting Cost Calculator
  • Vim find and replace
  • What makes an effective development team

Categories

  • Arrays (5)
  • Command Line (9)
  • Dates (3)
  • Featured (7)
  • Git (7)
  • Golang (5)
  • Javascript (8)
  • Productivity (8)
  • Projects (4)
  • Python (15)
  • Regex (2)
  • Ruby (3)
  • Shell (2)
  • Thoughts (2)
  • Tips (11)
  • Tools (3)
  • Tutorials (1)
  • Vim (4)

Archives

  • July 2024 (1)
  • February 2024 (1)
  • January 2024 (1)
  • December 2023 (1)
  • November 2023 (1)
  • October 2023 (4)
  • September 2023 (1)
  • August 2023 (2)
  • July 2023 (5)
  • June 2023 (3)
  • May 2023 (6)
  • April 2023 (5)
  • March 2023 (5)
  • February 2023 (10)
  • January 2023 (6)
  • December 2022 (7)

Copyright © 2025 · Contact me at justin [at] {this domain}

  • Privacy Policy