Ubuntu – How to effectively navigate the Terminal and installed packages/commands

androidaptbashcommand linepackage-management

I am an electrical & computer engineer that has recently started using Ubuntu 16.04 to modify an Android-based Computer on Module (COM) to suit the needs of a new product I am working on for the company I work for.

Naturally, Android development at the level I am working on (HAL, kernel, etc… not so much 'applications' at this point) does not seem to be appropriate on the platform I am most comfortable with (Windows), so it made the most amount of sense to move to Ubuntu, a very-much supported platform in terms of Android development.

Now to the more relevant part.

I have no problem "using" Ubuntu (install and configuration was a breeze), and am no stranger to command line interfaces like the Terminal, which I very much prefer to use and "master".

However, my biggest hurdle in "mastering" the terminal is not the syntax or even the various binaries/packages themselves, but finding those binaries/packages!

I have been using man and info extensively, but those commands only help if you know the command/function you're looking for ahead of time, and even though the searching abilities of both man and info are great, I still feel like I'm lacking an index of what is available to me.

To summarize and clearly enumerate my questions:

  1. Is there a "list" of everything I can call at the terminal that is dynamic and adapts to the current set of packages/binaries/functions currently installed?

  2. Where exactly are the various installed packages stored? I've looked in /bin/, but that seems to only be a fraction of what is available to me. /bin/ seems to have a lot of core binaries, but other seemingly core binaries like info and whatis seem to be absent. Likewise, none of my installed packages obtained through apt, nor apt itself, are present.

  3. Extra Credit What thought processes should be different in a Linux environment as opposed to a Windows environment? Like, where is/is there a path environment variable specifying where the system will look for binaries? Is there an equivalent to a "Program Files", or an "Add and Remove Programs" (just to enumerate what is installed!)? Any other "pro-tips" for a well-versed Windows guy/developer, but complete stranger to Linux?

This is my first post on any Stack Exchange website, so please forgive me if I have violated any rules or accepted decorum. I read through the guidelines and don't think I'm violating any of them! In any case, any help would be greatly appreciated!

Thank you.

Best Answer

Is there a "list" of everything I can call at the terminal that is dynamic and adapts to the current set of packages/binaries/functions currently installed?

Yes! If you're using bash as your shell (which I assume as it is the standard shell) you can press TAB twice which will give you a complete list of commands you can run (beware that it can be quite long).

Edit: I've learned that pressing tab twice without any characters only works when bash uses its default configuration - not Ubuntu's one. So you may want to run bash --norc. Pressing TAB twice should work then.

Another alternative would be installing and configuring zsh or fish which are nice replacements for bash and offer more functionality. (I prefer fish because it provides a nice autocompletion when you type.)

Where exactly are the various installed packages stored? I've looked in /bin/, but that seems to only be a fraction of what is available to me. /bin/ seems to have a lot of core binaries, but other seemingly core binaries like info and whatis seem to be absent. Likewise, none of my installed packages obtained through apt, nor apt itself, are present.

You can see where your shell is looking for installed programs:

$ echo $PATH
/home/niklas/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/niklas/.gopath/bin:/home/niklas/.gopath/bin

(Note that this may look a bit different for you.)

Today, most executables are located in /usr/bin as per FHS.

If you want to know where one particular program is located, use which:

$ which apt
/usr/bin/apt

As I don't have great experience of Windows, I don't think I can answer the last part of the question, but:

  • $PATH is the "path environment variable specifying where the system will look for binaries".
  • Most programs are installed to /usr. (This is split into executables (/usr/bin), libraries (/usr/lib), and shared files (/usr/share). The documentation is in /usr/share/doc.)