Posts with the tag work on the terminal

Create a git repo from .tar.gz files with versions as commits

Say you have a bunch of .tar.gz files, each representing a certain version of a program source code. If you want to compare their contents and see what changed, git would help a lot.

So I wrote a script that would do the work for me and create a repository for...

Read on

calculate pi to a 1000 digits

Here is a shell / Bash script that calculates Pi to 1000 digits:

bc -l <<< 'scale=1000; 4*a(1)'
# which is shorter than the equivalent
echo "scale=1000;4*a(1)" | bc -l

One more calculation using bc: the golden ratio to 10 digits:

bc -l...

Read on

control BOINC using the CLI boinccmd

boinccmd --join_acct_mgr user PASSWORD

If you get Authorization failure: -155 errors all the time, search for files named gui_rpc_auth.cfg and delete them if they are outside the /etc or /var directory.


Read on

Convert a String of Hex Values to its Binary Representation Using sed

Suggest you have data in a hex format that you want to convert back to binary (like an MBR) with newline characters in the middle:


Like this you can convert it back to its binary content:

cat datafile.txt | echo -n -e $(tr -d '[:space:]' | sed 's/../\\x&/g')


  • <a...

Read on

Shortcut to Access the Preview Application from Terminal using AppleScript

If you ever wanted to open PDF, JPEG, PNG files etc.

# A simple bash script that uses Applescript to
# open multiple files in Preview. For example:
# "preview hello.png world.gif *.jpg"

if [ -z "$*" ]; then

Read on

Bash Aliases ( bashrc , bash_profile and bash_login )

Edit your ~/.bashrc :

alias firefox="open -a Firefox"
alias l="ls -l"
alias la="ls -la"

and reload the .bashrc file using . ~/.bashrc or source ~/.bashrc

You might want to add the following line to your ~/.bash_profile in order to get the ~/.bashrc loaded at the start of an interactive bash session:


Read on

Terminal Shortcut for Firefox on Mac OS X

Create a terminal shortcut for Firefox:

sudo ln -s /Applications/ /usr/local/bin/firefox

or simply use the open tool with the application option -a Firefox:

open -a Firefox

Read on

Creation of ISO images, Burning of ISO images – Both on the Terminal using Mac OS X

Burning an ISO Image from Terminal

hdiutil burn image.iso

Creating an ISO Image from a Folder

hdiutil makehybrid -o ~/Desktop/[outfile] ~/Desktop/[source]

[source] can be a folder or a disk image.

Creating an ISO Image from a CD

Determine the device that is you CD/DVD drive:

drutil status

Umount the disk:


Read on

Spotlight Search and Indexing

Terminal helpers (command line tools):

  • mdfind : Search Spotlight metadata indices.
  • mdimport : Force Spotlight to import metadata for a specific directory.
  • mdls : List the metadata attributes of a specific file.
  • mdutil : A utility for managing Spotlight indices.

To erase and rebuild the index on the root partition / do:


Read on

Convert ape audio files to mp3 on the terminal

Requirements: Having the executables mac, lame and id3v2 installed.
I haven't done it myself yet, but this seems to be a nice and quick way to do a conversion and set the ID3 tags in the newly created MP3:

echo "Artist name?"
a= <span...

Read on

Split Large Monkey's Audio Files with CUE Sheets into Single Files


sudo apt-get install cuetools shntool flac wavpack


cuebreakpoints sample.cue | shnsplit -o flac sample.flac

In this example, a flac file called sample.flac is split according to the break-points contained in sample.cue and the results are output in the flac format.

To split a monkey’s audio file (.ape) by cue...

Read on

Convert a CUE / BIN CD Image to ISO Format and

A search for tools that can do the conversion

apt-cache search convert cue bin iso

reveals several candidates to fulfill this task:

bchunk - CD image format conversion from bin/cue to iso/cdr
mdf2iso - A simple utility to convert mdf to iso /...

Read on

Search for Strings Inside Files

To search for the string Find me inside text files in the working directory on a UNIX computer, do:

grep "Find me" *.*

or if you want to search in all subdirectories too:

ls `find . -type f -print  | xargs grep -l -s "Find me"`

If you want...

Read on

Save Websites to Mirror a Browsable Version Using wget or webhttrack

using wget

wget -m -k -K -E

If this command seems to run forever, there may be parts of the site that generate an infinite series of different URLs. You can combat this in many ways, the simplest being to use the -l option to specify...

Read on

Quickshare Folder using SMB and Discover SMB Shares on the Command Line

Gnome 'Share this folder'

Right click the folder you want to share in Gnome → sharing options → Share this folder (maybe this requires the installation of package samba, after installation log out and on again).

Allow SMB Connections In Your Firewall

After configuring firestarter to allow SMB, sudo iptables-save contains:


Read on

Short Of Disk Space - Find Large Files & Clear Caches

When your hard disk is getting full you might want to know why and what files are the largest. This post describes how to find that out and clean up using the disk usage analyser, package cache cleaning and a fast way to list big files on the terminal using...

Read on

Suspend Using Console

see also:

$ sudo /etc/acpi/ force


$ sudo echo mem > /sys/power/state

or as gdm does it (see /etc/gdm/gdm.conf → constant SuspendCommand):

$ sudo /usr/sbin/pm-suspend

you can run this script and therefore suspend remotely with ssh option -t to prevent echo on the terminal:


Read on