I've been checking out source codes of some Linux software. For instance, if I were to run cd /usr/bin and type sudo nano libreoffice, I would see the LibreOffice source code.

However most programs are different. For instance sudo nano cmatrix shows a lot of junk with few recognizable strings of text. It does state at the bottom of nano "Converted from Mac format". I'm not sure what that means, and I don't see it every time I see junk like this.

How can I see the source code of a program like this, or can't I?

Note I'm looking in /usr/bin based on this diagram. Also, note that this isn't restricted to nano. I've also tried vi, but I prefer nano.

  • 1
    The libreoffice file you're looking at happens to be a shell script. On the other hand, the majority of the files in /usr/bin are binaries and can't be viewed by a text editor. To get source code, you'll have to download the source; e.g., apt-get source cmatrix. – dsstorefile1 Mar 22 '18 at 2:29
  • also /usr/bin/libreoffice is not the source code for libre office. – ravery Mar 22 '18 at 2:32
  • 3
  • It is most likely compiled...However, you can find the source code for LibreOffice... there --> github.com/LibreOffice – NerdOfCode Mar 22 '18 at 2:56
  • If you do file cmatrix you'll probably see that this file is a binary (ELF). – muclux Mar 22 '18 at 6:42

That is not the "source code" for libreoffice, it's just a shell script that sets up the environment and starts the real libreoffice.

If you install the apt-src package, you can use it to download the actual source of ubuntu packages. Read man apt-src.

  • Or use apt-get source directly. – muru Mar 22 '18 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.