How to make spreadsheets in a Linux terminal

If you are on a quest to get rid of your desktop environment and do everything from the console, well good luck with that. However, if you are a bit more serious, and would like to learn to do a new thing from the terminal, what about mastering spreadsheets?

Sure, LibreOffice or any office suite of your choice may do it very well in the first place, but sometimes using a pick up truck to go to the kitchen is not the most appropriate path. What I mean by that is that it happens that you may need to create a quick spreadsheet with just a few simple formulas, but nothing so complicated that you need all the power of a traditional office suite. Plus, if your system is a bit old, or if you are running a lot of applications in the background, you may have to wait a few dozens of seconds watching that splash screen load. On the other hand, a spreadsheet application in the console is fast, simple, and efficient. Among the magical software that will allow you to do that, I propose you sc, anagram for “spreadsheet calculator.”

Install sc on Linux

The sc package is available in the universe repo for Debian-based distros such as Debian, Ubuntu or Linux Mint, so installation on such systems is easy:

$ sudo apt-get install sc

On Archlinux, check out the AUR.

For other distros, you can download its source, and build it.

Basic Usage of sc

As usual, the first screen is always the scariest. But good news: a lot of the shortcuts for sc are inspired by those of vim (or I guess it's bad news if you only know Emacs). So you can move around with the traditional hjkl keys:

  • 'h' for left
  • 'j' for down
  • 'k' for up
  • 'l' for left

Or just use the arrow keys if you are not afraid of being burn for heresy.

The second thing you might want to do in a spreadsheet is to enter some numerical value. I was a little thrown off at first because the insertion mode is a bit different here.

To enter a numerical value in the selected cell press '=', then your value.

To enter some text instead, type '<', then your text. If you need to save your work at any time, use:


to dump your work into a .sc file.



will retrieve your work.

If you haven't guessed by yourself, the command 'q' serves to quit the program.

But what we all want is to create some formulas. Just like in any traditional spreadsheet, start with '=' sign and refer to the other cells by their coordinate.

For example, to do the sum of the first two cells of the first row, do:


To copy the content of a cell, get the cursor over it and press 'ma'. Then go to an empty cell and do 'ca'.

Finally, using the last technique and our earlier example, we can extend the formula to add the values of two adjacent cells with:


where [#] is just the number of cells we want to extend the formula to. As you may have noticed, this is just like in vim, where you do [#][command] to repeat a command a certain number of times. In our previous example:


will extend the addition formula to the next 3 cells in the row, giving them the values of B0+C0, C0+D0, and D0+E0 respectively.

Advance Usage of sc

If you know your vim shortcuts, you will be able to make the most out of sc after a few experiments:

Use 'c' to refer to a column. So 'dc' and 'yc' to delete and yank the current column respectively.

Use 'r' to refer to a row. Same idea here, 'dr' and 'yr' to delete and yank the current row.

The command 'g' to move to a particular line in vim also works in sc with the syntax:

g[coordinate of a cell]

For example, 'gC22' to go straight to the cell C22.

I said earlier that 'ma' was to mark a cell. To be exact, it stores the content of the cell into the variable a, that you can then copy with 'ca'. Alternatively, you can use any other letter to refer to a different variable: 'mb', 'mc', 'md', etc.

Check out more by typing '?' at anytime from the interface.

To conclude, sc is another one of these programs which will make people debate over its utility. Is a console spreadsheet calculator obsolete, now that our computers are powerful enough to run LibreOffice or whatever? Or on the contrary, should we stick to the basics for simple tasks and not waste resources?

I also heard good things about oleo, which does sensibly the same thing, but never tried it myself. Is it a viable alternative to sc?

Anyway, let us know what you think in the comments.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.

Adrien Brochard

I am a Linux aficionado from France. After trying multiple distributions, I finally settled for Archlinux. But I am always trying to improve my system by stacking up tips and tricks.

Latest posts by Adrien Brochard (see all)

13 thoughts on “How to make spreadsheets in a Linux terminal

  1. Isn't this a Visicalc clone ? Or, more importantly, there should be a Visicalc clone.

  2. I tried using the source code on fedora 20 and got the following error

    xmalloc.c:9:14: error: conflicting types for ‘malloc’
    extern char *malloc();
    xmalloc.c:10:14: warning: conflicting types for built-in function ‘realloc’ [enabled by default]
    extern char *realloc();
    make: *** [xmalloc.o] Error 1

    Edit xmalloc.c and comment out or delete the line

    extern char *malloc();

    Afterwards make completes. Good Luck

  3. In my humble opinion, the time it would take to become proficient in this tool could be better spent elsewhere. If at work, I would just use what I am already familiar with; at home, that time would be better spent learning a new way to cook sweet potatoes.

    I am all for learning new ways to do things, but this seems to be a way to do the same task, in a more tedious way.

    • I agree with you on that. But if you are already comfortable with all those vi shortcuts, it's not a terribly bad idea or too much efforts to adopt it.

  4. The terminal is a much easier place on the eyes, esp. with a personally pleasing color scheme; I live there as much as I possibly can, in white on blue. I've also used SC since 2002 for my personal records etc.

    One of the really nifty things about SC is the save file. Here is a partial example:

    # This data file was generated by the Spreadsheet Calculator.
    # You almost certainly shouldn't edit it.

    set numeric tblstyle = tbl color colorneg
    leftstring A0 = "2012"
    rightstring B0 = "SP500"
    rightstring E0 = "TSX"
    leftstring A1 = "feb07 fb"
    let B1 = 1347
    let E1 = 12512
    leftstring A2 = "feb21 ns"
    let B2 = 1362
    let C2 = B2-B1
    let E2 = 12623
    let F2 = E2-E1
    leftstring A4 = "mar08 fb"

    As you can see, it is an ordinary text file, in human readable form,
    and the data could easily be reconstructed on a piece of paper with a grid drawn on it. Shades of statistical analysis back in my uni days in the 70s!

  5. @meanpt & sylvain

    My thoughts exactly er for us younger 'techies'. Lotus, before there was Notes :)


Leave a comment

Your email address will not be published. Required fields are marked *