Commandline


Changing UUID's on LUKS Encrypted Partitions

I recently obtained a disk dock and cloning unit (StarTech.com) for working with some of my internal drives (I have too many). This unit does a bit-by-bit clone of one disk to another, which is really useful! The problem with this is that each disk now looks exactly the same to your Operating System, meaning there is no way to mount them both at the same time! Furthermore, I decided to create a LUKS encrypted drive protecting an ext4 partition.

Continue reading ↦

Fixing Backupninja: Or how I learned to stop worrying and build from source

I’m tired. So I’m going to make this as short and clear-cut as possible: backupninja is a pretty nice backup program for linux which supports rdiff-backup, rsync, and duplicity. backupninja exists as version 1.0.1 for the latest stable ubuntu and debian packages. There exists a bug in this version of backupninja which disables it from rsyncing. This is a critical bug which disables you from using any host.

Continue reading ↦

Command Redirection >&-

Bet you don’t know what >&- does? According to Jeff @ stackoverflow: /your/first/command >&- 2>&- Be careful to note the order: >&- closes stdout, which is what you want to do; &>- redirects stdout and stderr to a file named - (hyphen), which is not what what you want to do. It’ll look the same at first, but the latter creates a stray file in your working directory. It’s easy to remember: >&2 redirects stdout to descriptor 2 (stderr), >&3 redirects stdout to descriptor 3, and >&- redirects stdout to a dead end (i.

Continue reading ↦

Easily add aliases on the fly

Recently, I’ve done a lot of work on my dotfiles. One thing that always bothers me is the sheer amount of aliases I have laying around everywhere. Kinda frustrating. Additionally, I have a set of scripts I in my env which I’d really like to automatically set aliases to easily. A commonly accepted idea is to separate all your aliases out into something like an .aliasrc file. This is definitely very helpful.

Continue reading ↦

Giving non-root users' power over <1024

I needed a quick and dirty way to allow a non-root user to use lower ports. This is because I’m starting to launch docker containers where the CMD process is run as a non-root user. The first container I thought this might work well for is my docker-ncat-proxy container which runs ncat as the nobody user. Using linux capabilities, we can set a binary to be launched without locking its binding capabilities using the setcap command.

Continue reading ↦

Change an email address across multiple files in an svn directory

This one is quite easy, but a little tricky. Had to do this for work as one of our groups was changing their email address and a few of the repo’s they used had files that depended on that email. A couple requirements to keep in mind: Had to be recursive Had to excude certain file types Had to do the replacement in an svn repository, which apparantly is difficult.

Continue reading ↦

Listing out your drives, the pretty way

Just found the command I’ve forever been looking for: goliath# blkid -o list device fs_type label mount point UUID -------------------------------------------------------------------------------------------------------- /dev/sda2 ext4 golvm /mnt/ssd2 158dac38-a368-4a37-983e-8e4b63cc838f /dev/sdd linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdb1 ext4 / d288026a-a2d2-45c0-b848-3ac032909b33 /dev/md0 ext4 /mnt/raid 5193fa69-3c56-46cd-90bd-31036c931f5e /dev/sda1 ext4 /mnt/ssd1 bc2503ac-ad7a-4c70-8127-6ed37c96548f /dev/sdl1 ext4 /mnt/usb becc31d7-35ff-4145-876a-2520460ff532 /dev/sdi linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdk linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdh linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdj linux_raid_member goliath:1 (in use) 4c9df4da-6def-7a1b-f269-1137c0c49112 /dev/sdf linux_raid_member (in use) c2e53423-5bc2-a1e6-fcbf-496432a662fa /dev/sdc1 ext4 /mnt/500dump 05fe6113-5433-45b1-9fb6-2346d94534b0 /dev/md1 jfs (not mounted) 9413d08a-fd5d-4f26-a876-198565f5e392 goliath#



What happens when you bork sudo?

Made a change to sudo and fudged up the line where I give myself certain permissions… This caused a fun parse error that wouldn’t let me continue my “*sudo su*” Its ok though, just run: pkexec visudo type your pass, and you’ll be dumped into the sudoers file for fixing! Thanks, askubuntu!



I really wanted terminal printing to be in color

Yeah. ccze. is awesome! I really wanted to use it across my systems and with all applicable commands like head, tail, cat, etc.. So I wrote a zsh function to check if the command exists and utilize it. This was kind of a pain because of the corner cases (people using pipes or redirection with the command etc..) Through it all, I created two new commands, catless and tacless. Read some of the comments to find why.

Continue reading ↦