8

Hi I'm new to ubuntu world. I have few questions about the software installation in ubuntu:

  1. What's the difference between installing a software in ubuntu software center and command line?

  2. Why some software I installed with command line can't be searched in software center (press the window key)?

  3. What are the correct commands to install a software from command line so that I can search them?

  4. I backed and restored up my system once but some commands worked before (like "subl") don't work after restoring the system.

I think these questions are about $PATH somehow but I can't find some material about this. Any extra material would be appreciated. :)

closed as too broad by Mark Kirby, edwinksl, Zanna, Pilot6, Eric Carvalho Sep 20 '16 at 16:15

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Which softwares you installed via command line aren't appearing on Software Center? Which version of Ubuntu are you using? – Anwar Sep 17 '16 at 6:17
  • 2
    @Andy #2 and 4 need more details please. Thanks! – Edgy1 Sep 17 '16 at 6:23
  • 1
    Welcome to Ask Ubuntu! We’re sorry, but Ask Ubuntu is not a forum, but a Question & Answer site: it works best if you ask one question, so you can receive one answer. When you ask multiple questions, you need to find one expert versed in multiple areas, which becomes unlikelier the more questions you put into, well, one question! ;-) So please, split up your question into multiple questions and drop me a comment so I can answer one of your questions. – David Foerster Sep 21 '16 at 10:15
9

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.

What's the difference between installing a software in Ubuntu software center and command line?

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.

Why some software I installed with command line can't be searched in software center(press the window key)?

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

What are the correct commands to install a software from command line so that I can search them?

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 backed and restored up my system once but some commands worked before (like "subl") don't work after restoring the system.

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 think these questions are about $PATH somehow but I can't find some material about this. Any extra material would be appreciated.

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.

  • 1
    As a matter of fact, many packages are more than some files put into some directories. Installation aspects that go beyond this are dependencies, rebuilding of caches and other triggers, service configuration, starting of services. – Anony-Mousse Sep 17 '16 at 14:27
  • The complexity of software installation for Linux may sometimes be shocking to new users who come from Windows or Mac world depends on how they've used those, as well. I've "installed" plenty of applications by unzipping them in Windows and I have see a lot of installers were literally just doing unzip somewhere in Program Files. In Linux for the most part installation is as easy as, say, on Windows. Only instead of downloading and running a .exe file, you will do that with a .deb. Or whatever. And command line execution just does that process for you. Software Center is a GUI on top. – VLAZ Sep 17 '16 at 15:05
5
  1. What's the difference between installing a software in ubuntu software center and command line?

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.

  1. Why some software I installed with command line can't be searched in software center(press the window key)?

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.

  1. What are the correct commands to install software from command line so that I can search them?

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.

  1. I backed and restored up my system once but some commands worked before (like "subl") don't work after restoring the system.

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.

  • 1
    Answer to point #2 is not entirely correct. Dash seaches for .desktop files. Good example of command-line utility that comes with .desktop file is byobu and is searcheable via dash. Icons are irrelevant – Sergiy Kolodyazhnyy Sep 17 '16 at 7:30
  • @Serg Thanks. I wanted to give a non-technical answer as much as possible. Anyway, I'll edit – Anwar Sep 17 '16 at 7:34
  • @Serg It seems byobu too comes with an icon :) – Anwar Sep 17 '16 at 7:39
  • Even if it came without an icon, it would still be searcheable in Dash, because of the .desktop file, it would just have icon with question mark then but it would still work. Icon is really optional. It's up to the developers to include icons or not. – Sergiy Kolodyazhnyy Sep 17 '16 at 7:57
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}

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