Command Line Equivalents – mpc and bc

Command Line Equivalents - mpc and bcbc is a *nix calculator that can provide a command line equivalent for gnome-calculator for quick calculations. bc can do detailed mathematical calculations in programs or can be a very basic calculator. To use bc just type bc and return and enter 2*2. This isn’t so bad but it would be better just to enter bc 2*2 from the command line. A basic script will do this:
echo "$*" | bc

A program mpc isn’t more useful than GUI equivalents unless you use the terminal alot. MPD fronts like Gimmix and GMPC, and even Sonata leave small footprints and do a nice job of creating playlists.

Mpc is very simple and easy to use though, to install in Gentoo:
sudo emerge USE="bash-completion" mpc

A little setting up is necessary. For bash-completion a script will need to be entered into ~/.bashrc.
cat /usr/share/doc/mpc-0.12.1/mpc-bashrc >> ~/.bashrc

By default, mpc connects to localhost:6600 edit this in the ~/.bashrc if using MPD on a network: host or password@host.

mpc listall
mpc add Rock/Bon-Jovi/Its-my-life.mp3
mpc play



About Gen2ly

<3's linux

Posted on 2008-02-11, in Linux. Bookmark the permalink. 2 Comments.

  1. Whenever I need a calculator I just start python (actually ipython, a better interactive python). You have all the power of a calculator with all the nice things a mature programming language gives you (like variables, functions, iterators).

    You can type 2*2 or 13**7 (which means 13^7) but can also quickly get to more complex calculations seamlessly.

  2. nice, I hadn’t thought of this – python functioning as a calculator. Very very handy if doing a good amount of programming. python looks like it handles functions as such similar to bc:

    define f(x) { return x+2 }

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 58 other followers

%d bloggers like this: