Page 2 of Command-line Interface Articles

Include files in your ~/.ssh/config

Recently as I was setting up my new rig (System 76 Galago Pro, review to come, I promise) I came to realize that my SSH config, ~/.ssh/config had turned into absolute bloatware. There’s stuff in there from previous jobs and projects, stuff for servers that don’t exist anymore and worthless […]

Set Vim background based on your terminal's background color

I’ve been spending more time at the pool lately (sorry, not sorry) and I’ve found myself manually switching between a light and a dark gnome-terminal theme. This was all well and good, but my .vimrc includes set background=dark so regardless of which theme I’m using in the terminal, vim has […]

Get your own dotfiles

These are my dotfiles. There are many like them, but these are mine. A lot of folks do it. They publish their dotfiles because they want other people to enjoy them. Free as in Freedom and all of that. And there’s not a damn thing wrong with that workflow. I […]

How to tell if your shell is a subshell of Vim

If you’re like me, you use Vim. If you’re like me, you use :sh[ell]. If you’re like me, you forget that you used :sh and open Vim again. I’ve been getting better about it, but every once in a while I end up with 2 or 3 nested Vim processes […]

Minimalist git prompt

For as long as I can remember, I have had some sort of git status as part of my shell prompt. Early on I had used the canned git prompt scripts that are floating around out there. I felt they were way too bloated with the 42-some-odd glyphs that they […]

Switching from tmux to GNU Screen

I’m was a bit late to the terminal multiplexer game. I had used GNU Screen on servers here and there to be able to keep tabs on long running processes but it wasn’t until this past year that I decided to start using tmux full-time locally. Why tmux if I […]

Using ssh-copy-id with an alternate SSH port

If you’re anything like me, you’re somewhat paranoid security-minded. Because of this, you’ve most likely moved the SSH port on your server(s) to something other than the standard port 22. Nothing wrong with a little bit of security through obscurity on top of all of the other crap you’ve done […]

How to install Tmux 2.x on Debian 8 "Jessie"

I’m happy to admit that I’m a bit of a Debian novice. Coming from a decade of using Ubuntu, I still have a bit to learn. My recent dilemma was with the version of tmux I had on one of my servers. Nothing wrong with tmux 1.9 but it was […]

You may not need Oh My Zsh

I’ve been on pursuit of less with my dotfiles. This isn’t about me hating Oh My Zsh, it’s just about relying on less code. Less code means less bugs. Less code usually means faster execution. It means more control. In turn, more control means more time researching and learning. More […]

How to pull from git

Had a peculiar request on one of my posts asking for a tutorial on how to pull from git. To be honest, I’m not entirely sure if the comment was just trolling or what, but figured may as well do a post on it. Cloning a repository If you want […]

Intentional infinite loops

It’s happened to all of us. A script just locks up and we’re unsure why. At closer inspection we find that we’re written a loop that has no terminating condition. It is an endless loop and in many cases consumes memory until it crashes. But what if you want to […]

Forcing yourself to use shell aliases

Fact: Shell aliases save you time. Fact: Saving time increases your productivity. Fact: Everybody wants to be more productive. Fact: Retraining muscle memory can be a pain in the ass. I have been fighting that last fact for a while now. I have the single character alias v pointed to […]

Using Keyring Access on the OSX Command-line

If you’re like me, you probably have a private dotfiles that supplements your public dotfiles repository. It contains private values like API keys and [hopefully not] plaintext passwords. There’s even a good chance you’re using git submodules or a setup script to manage the inclusion of the private stuff. Well […]

Command line all the things!

The start of 2014 has been an exercise in going back to basics for me. I’ve been re-evaluating my workflows when hacking and attempting to streamline as much as humanly possible. This has resulted in a ton of new aliases in an attempt to get my common CLI commands down […]

Getting PHP's version from the command-line

As you may already know, obtaining the version number of PHP is a simple php --version away. This is great if you just want to see the version number, but what if you wanted just the version number? First option would be to use write out some shell script to […]

Command-Line PHP

PHP is a powerful scripting language but did you know it can be used from the command-line as well? Using PHP from the CLI has many applications from checking what version of PHP is installed to being able to execute scripts and even check the syntax of a file. If […]

Recursive PHP Lint-inator

Just cleaning up a repository at work and came across a script I haven’t used in forever, a script to lint all PHP files in a directory, recursively. Expect something more stimulating soon as I found out the hard way that tumblr doesn’t seem to auto-save your posts once you’ve […]

Mass `svn add` script

So I have a tendency to add a bunch of new files to a project before actually doing a commit in Subversion. It’s usually not an issue, I go through an add each new file and then finally do my commit. Welp, I’m sick of it, so I wrote a […]

File Usage Reporting Script

In retrospect on writing this Python script, I probably could have pulled it off in a short Bash script. Maybe another day. Anyway, this latest utility script of mine takes a variable number of arguments, the first being the “needle” directory. The needle directory are the files you want to […]

Bash script to flatten a directory

I just came across an old CD of Fonts that I had purchased before I knew better. Well I didn’t want to throw the disc out without copying all the fonts to my system. All the fonts were broken up into directories that corresponded to the first letter of the […]

Recursive grep (grepr) for Solaris

So if you’re a Linux user that’s ever used Solaris, you know that a lot of the commands don’t translate exactly the same. One such issue is the lack of a recursive flag (-R) on the grep command. Not a problem though, bash is a powerful thing. Here’s my solution […]