Tiny Deathstars of Foulness

August 29th, 2015

Posted In: Mac OS X, Ubuntu, Unix

By default, the Chromium OS rootfs is read-only. If you boot the system in developer mode, you will be able to disable rootfs verification and modify existing files or write new files into the file system. Before you do this, note that your file system will no longer be verifiable (won’t checksum properly) and you’ll end up needing to restore a recovery image in order to get back to normal mode. So this might be a bit dangerous if you’re not using the device for something like regression analysis (why I needed to do this).

To make the file system writeable, first fire up a command prompt via crosh, by using Control-Alt-T and then running the shell command at the shell prompt:


Then run the following shell script to remote rootfs verification and make the file system writeable:

sudo /usr/share/vboot/bin/ --remove_rootfs_verification


Then you can reboot and do whatever it is you need to do. For example, install a vine server and run automation scripts to do regression testing. Enjoy.

August 18th, 2015

Posted In: ChromeOS, Ubuntu, Unix

Tags: , , , ,

We tend to use a lot of commands in the Terminal app. That is, after all, what it’s there fore. And there’s a nice history of what we do. There are also a number of ways to view and manage the bash history. The simplest of which is the history command, which will show the previous commands run. Here, we’ll simply run it:


Keep in mind that this shows the history based on context, so if you sudo bash, you’ll potentially see a different history. You can also use the bash built-in fc command, which has the additional awesomeness of being able to edit and re-run commands from the history. To start, we’ll simply look at showing the last 16 commands using the -l option:

fc -l

You can also constraint entries in the output by specific line numbers. For example, to see lines 12 through 18, simply use them as the first two positions of the command after fc:

fc 12 18

You can load the history into an editor and remove or add entries using fc without any options:


To exit the editor, hit control-z. I’ve written in the past about using substitution. For example, sudo !! to run the last command. fc can do some basic substitution as well. For example, use the -s to start substation and then enter a string, which will append whatever you like before a command. So the following would put sudo in front and re-run the previous command:

fc -s sudo

And let’s say that you were doing a find for a string of krypted. To then swap that string with charles:

fc -s krypted=charles

Overall, the bash history can be incredibly useful. I frequently pipe the output of a series of lines into a new file with a .sh at the end as a starting point for scripts and use these substitution options to save myself a bunch of time not retyping longer commands. Enjoy.

August 14th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, Mass Deployment, Ubuntu, Unix

Tags: , , , , , , , ,

Earlier, we looked at creating thousands of empty directories. Today, we’re going to get rid of them. But we need to get rid of only empty directories. To do so, we’ll use the find command:

find . -depth -type d -empty -exec rmdir {} \;

Now, we can put both into a script:

mkdir $(printf '%05d\n' {1..10000})
find . -depth -type d -empty -exec rmdir {} \;

July 29th, 2015

Posted In: Mac OS X, Ubuntu, Unix

Tags: , , , ,

You can easily accept user provided input in bash by using the read command in bash for Linux and OS X. Here, we’ll echo out a choice to a user in a script, read the output into a variable called yn and then echo out the response:

echo "Please enter y or n: "
read yn
echo "You chose wrong: $yn"

Here, we used echo to simply write out what was chosen in the input. But we could also take this a little further and leverage a case statement to then run an action based on the choice selected:

read -p "Should the file extension change warning be disabled (y/n)? " yn
case ${yn:0:1} in
y|Y )
defaults write FXEnableExtensionChangeWarning -bool false
echo "The warning has been disabled"
* )
defaults write FXEnableExtensionChangeWarning -bool true
echo "The warning has been enabled"

The options when scripting are pretty much infinite and chances are, if you’ve written any scripts, you’ll know of a better way to do this than how I’ve always done it. One of the great things about scripting is the fact that there’s always a better way. So feel free to throw any of your examples into the comments!

July 28th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, Ubuntu, Unix

Tags: , , , , , , , ,

Sometimes when I’m writing a script, I need something to phone home to something in the script. For example, this can tell another daemon where to ssh into when I invoke it remotely. So, let’s say I want to grab my WAN address in a script. I can use curl with a number of 3rd party sites (sites that often change. But, one that we can use here is Here, we’ll look at their plain output page here:


This can then get output into a variable or file for processing in other parts of a script. For example, the output here is basically the same thing but the command is in backticks, as you might put it in when scripting:

echo `curl`

July 26th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, Ubuntu, Unix

Tags: , ,

The at command can be used to schedule jobs to be run at certain times. I have a hard time getting up in the morning. Here, we’re going to echo a command that we want to be run at a certain time. In this case, we’re going to open a song to make into our alarm clock:

echo 'open ~/Desktop/bangbang.m4v 2>/dev/null' | at 07:00 tomorrow

The job will then output. You can see jobs waiting to be run, along with when they’ll be run using the at command with the -l option:

at -l

In this case, the job is 2. You can then remove a job using the atrm command:

atrm job 2

July 23rd, 2015

Posted In: Mac OS X, Ubuntu, Unix

One of the great things about cat is that you can view the contents of a file with line numbers. You do so using the -n option, as follows:

cat -n ~/Desktop/myFile

Sometimes a file is too big to view though, so you can pipe the output to less, to combine some of the best features of each:

cat -n ~/Desktop/myFile | less

Obviously, the same thing would work with more:

cat -n ~/Desktop/myFile | less

You can also do something similar with the grep command and the -n option:

grep -n ^ ~/Desktop/myFile | less


July 21st, 2015

Posted In: Mac OS X, Ubuntu, Unix

Tags: , , ,

The cd command has lots of fun little shortcuts. One I use frequently is the -. The ~ always takes you to your home directory, but using cd – will take you to the last directory you were in. For example, if you do the following on a Mac:

cd ~

Then you do .. (which is a shortcut for the directory above the one you’re in):

cd ..

Then pwd will show that you’re in /Users. But, if you cd to – again:

cd -

Now you’re back in your home folder. The – expands to OLDPWD. Quick tip. Nothing more to see here.

July 20th, 2015

Posted In: Mac OS X, Ubuntu, Unix

Tags: , , , , ,

The ffmpeg command is pretty rad. I’ve written about it before, but now I’m using it to rip the audio out of video podcasts that don’t need video. Extracting an mp3 from video that doesn’t need any video means I can have way more on my iPhone. So here goes:

ffmpeg -i randopodcast.flv -vcodec mpeg2video randopodcast.m2v -acodec copy randopodcast.mp3

The video is pretty irrelevant for what we’re trying to do, but it’s great to have smaller files and more of ’em!

July 14th, 2015

Posted In: Mac OS X Server, Ubuntu

Tags: , , , ,

Next Page »