2 Comments

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:
#!/bin/bash
echo "$*" | bc

mpc
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

References

 

About these ads

About Gen2ly

<3's linux

2 comments on “Command Line Equivalents – mpc and bc

  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:

    a=3
    a+1
    4
    define f(x) { return x+2 }
    f(3)
    5

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

Join 51 other followers

%d bloggers like this: