What is the difference between installation using Ubuntu Software Center and command line?

Solution 1:

TL;DR: there is a lot of gray areas and it depends on what you're doing. Mostly, Software Center and command-line methods do similar things when it comes to .deb packages, but other software packages may require different steps.


Here's the reality: installation is nothing more than throwing the files that come with software package into appropriate directories. It doesn't matter if it's done via command line or via Software Center - they do the same thing - throws the files into their respective directories. What matters, however, is the package and how you handle it. Here I'll go over some of the basic packages that you can deal with on Ubuntu. As for the difference between command-line and Software Center, the most basic difference is that in Software Center you click buttons; in command-line you type in commands. I know Software Center uses a lot of python code, but in command-line it depends on the utility you use. There's also amount of how much Software Center can remove ( read below about that )

The software packages for Ubuntu can come in three ways: .deb file, .run file, and just raw source-code in compressed zip or tar archive. Depending on which one you're dealing with, command line installation can be more or less painful. This is not something you as new user should really worry about, at least not in the first year of using Linux.

You will see mostly .deb files - they are pre-compiled packages of software, ready for use. These are less painful. They also very often specify dependencies - other software without which your program won't run. Command line utilities such as apt and apt-get will install dependencies automatically for you. In fact, Software Center uses apt-get as back-end , so it also installs dependencies automatically.

.run files are typically proprietary and encoded binary files. You can't really see what they're doing.

With raw source code, you have to do everything yourself - build software and install dependencies.

There is also ways to install packages from other distros, like .rpm packages, but this is done very very rarely.

There also exists a class of software known as containers. There is docker and lxd containers. As of recently, Ubuntu has introduced something known as snap packages. What is good about all those ? They can run anywhere , securely isolated from your main system, and can be installed/reinstalled quite quickly. These types of software are not installable via Software Center and generally for professional system administrators or techie/advanced users. As new user you don't have to worry about those, just be aware that they exist and they're awesome :)

Finally, something like a script ( and typically a single file ) can also be considered an application and again - installation is nothing more than throwing that file where it belongs or supposed to belong.

A search (pressing the windows / super) fails to produce some of the packages that I have installed via command line.

Again, this really depends on the package. If the developers of the software decided to include .desktop file with their package, you will be able to search it in the Dash. .desktop files are sort of like Windows shortcuts,although they do much much more. Good example of command-line utility that comes with .desktop file is Byobu - a very handy program for splitting terminal into extra tabs/windows.

You can , however, create your own .desktop file for each program and place it into ~/.local/share/applications/ folder.

Again, this has nothing to do with app being command-line or GUI. It depends on choices app developers make

I would like to know whether it is possible to write the installation command so that my installed software will be so listed.

Again, depends on what you're doing. If you are installing software from official Ubuntu repositories, then you can simply do sudo apt-get install my-software

If you're installing a .deb package, you may use either dpkg command or apt-get. Here's example of me installing google-chrome deb package with apt-get. NOTE: at the moment of installation i am in the same directory as .deb file, therefore have to specify ./ part

$ sudo apt-get install ./google-chrome-stable_current_amd64.deb                
[sudo] password for xieerqi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'google-chrome-stable' instead of './google-chrome-stable_current_amd64.deb'
The following NEW packages will be installed:
  google-chrome-stable
0 upgraded, 1 newly installed, 0 to remove and 54 not upgraded.
Need to get 0 B/50.0 MB of archives.
After this operation, 190 MB of additional disk space will be used.
Get:1 /home/xieerqi/下载/google-chrome-stable_current_amd64.deb google-chrome-stable amd64 53.0.2785.101-1 [50.0 MB]
Selecting previously unselected package google-chrome-stable.
(Reading database ... 476104 files and directories currently installed.)
Preparing to unpack .../google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (53.0.2785.101-1) ...
Processing triggers for menu (2.1.47ubuntu1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160701-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up google-chrome-stable (53.0.2785.101-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for menu (2.1.47ubuntu1) .

What is nice about apt-get ? It has --purge option, which allow you to remove everything related to a program. For example, if I just remove it with sudo apt-get remove google-chrome-stable or do it via Software Center, it may leave behind config files, so that when you reinstall the software, it's ready for use like before. --purge option will delete the config files,too. That's convenient if your software broke and you want completely fresh installation of it. Software Center doesn't do that, so that's another difference.

If you are dealing with .run file, you will need to make that file executable and run it. Like this:

$ sudo chmod +x ./software.run
$ sudo ./software.run

I noticed that a system backup and restore seemed to break some software installed via command line (e.g. subl).

It depends on type of backup you did. If your backup included all the files that are necessary to make subl to work, then it should have worked. It also could be that your backup occured before subl was installed. Ensure you configured your backup properly

I wondered whether maybe that was because the Software Center does a better job than CLI installation, for purposes of registering or preserving the relevant $PATH information.

The $PATH variable is relevant to shell (the command interpreter where you put commands ). It is not really relevant to Unity Dash. $PATH variable is really list of directories, where shell will search for programs that have executable permission set. Dash is really concerned with .desktop files only. For example, I can have a program sit in /usr/bin folder and be able to open it via command line but Dash will not, because there is no corresponding .desktop file for it.

If you want to find extra material about $PATH, literally pick up any book about Linux shell scripting. It's one of the foundation knowledge items for any Linux user who wants to use command-line.

Some closing thoughts: The complexity of software installation for Linux may sometimes be shocking to new users who come from Windows or Mac world. In reality, it's the same principles - throw everything where it belongs, and it will work. You don't find shortcut to your program ? Make one - it's just a text file ! Computers are machines, and they're meant to be operated. Windows also has %PATH% variable for its command-line, you just never knew about it, because Windows command-line is less versatile and less used than on Linux. In short, don't be intimidated by everything you may see,because on day to day basis it's all about 20% of most frequently used commands or actions, and they give you 80% of work done.

Solution 2:

There is no difference in how software is installed. But there used to be some difference in which software could be installed before 15.10. Ubuntu Software Center in Trusty used to allow users to buy applications through it, and these applications usually can't be installed with apt-get.

A search (pressing the windows / super) fails to produce some of the packages that I have installed via command line.

I think you're referring to the search using Dash here (using the super key). Dash generally shows only those programs that come with a graphical user interface and have some sort of icon (more specifically with a .desktop file) . These are good for everyday use and to be shown in Dash search. But these are not all your installed applications; Ubuntu has lots of command line applications which don't appear in Dash, because these are not suitable for use as graphical standalone applications (and because they don't come with .desktop file usually). For example, You won't see the tar program in Dash.

So, if you install a command line application, it won't appear in Dash (Windows key) search generally. Since, you haven't specified which application isn't appearing, this could be the general answer.

Note: As Serg pointed out in a comment, the appearance of icons in Dash depends on .desktop files. If a command line application comes with a .desktop file, it will appear in dash too. I agree with him. But it's true that, command line applications usually don't come with a .desktop file.

I would like to know whether it is possible to write the installation command so that my installed software will be so listed.

As said already, there is no command to install a software from command line that will force it to appear in Dash search. Some software will appear automatically, some won't. If you install atom-text-editor via command line, it will appear. If you install p7zip package, it won't appear in Dash search. It depends on the software's graphical icons availability (and configuration of launcher icons in your desktop environment, such as Unity, Xfce, etc). It doesn't depend on how you install them.

I noticed that a system backup and restore seemed to break some software installed via command line (e.g. subl).

It depends on how you backed up and restored. subl is the program name for Sublime Text Editor. If you haven't installed it already, install it. The subl command should start working.

Solution 3:

I am guessing that you are using either apt or apt-get from the command line. apt is a package manager that GUI software center relies on. Let's say for example you want to install package "gimp". To do it via command line you use

sudo apt install gimp

All Software center does is, when you select GIMP to be installed, runs that command in the background so you don't have to type it.

To search for an installable program via the command line use this command:

apt search {search term}