6 Ways to Check if a Package is Installed on a Linux Mint or Ubuntu PC

 How To, Linux  Comments Off on 6 Ways to Check if a Package is Installed on a Linux Mint or Ubuntu PC
Sep 102018
 

This morning I was checking via the command line to see if MySQL Server was installed on my Linux Mint 18 (Sarah) system and fumbled around a bit about how to do it.

Presumably, there are many other Linux users who wish to install a package and unsure how to check it on the command line.

So I decided to do this blog post on the various ways to check if a particular package is installed on a Linux Mint or Ubuntu system.

For each unique method, I will illustrate with two examples (the first example for a package not installed and the second for a package that’s already installed).

1. apt-cache policy Method

Not Installed

$ apt-cache policy mysql-server
N: Unable to locate package mysql-server

apt-cache policy is a quick way to determine if a particular package is installed on a Ubuntu or Linux Mint system.

Already Installed

$ apt-cache policy grsync
grsync:
  Installed: 1.2.5-1
  Candidate: 1.2.5-1
  Version table:
 *** 1.2.5-1 500
        500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        100 /var/lib/dpkg/status
2. dpkg -l Method

Not Installed

$ dpkg -l | grep mysql-server

Since mysql-server is not on my system, I did not get any output when I ran the dpkg -l | grep mysql-server command.

Already Installed

$ dpkg -l | grep grsync
ii  grsync        1.2.5-1       amd64        GTK+ frontend for rsync
3. dpkg-query Method

Let’s now consider the dpkg-query way to see if a specific package is installed on Ubuntu or Linux Mint.

Not Installed

$ dpkg-query -s mysql-server
dpkg-query: package 'mysql-server' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

The above example clearly demonstrates that mysql-server is not installed on my Linux Mint 18 PC.

Already Installed

$ dpkg-query -s grsync
Package: grsync
Status: install ok installed
.....output truncated
4. dpkg -s Method

dpkg -s package_name is another quick way to determine if a package is installed on an Ubuntu system.

Not Installed

$ dpkg -s mysql-server | grep Status
dpkg-query: package 'mysql-server' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

Already Installed

$ dpkg -s cherrytree | grep Status
Status: install ok installed
5. apt list Method

Not Installed

$ apt list mysql-server
Listing... Done
mysql-server/xenial-updates,xenial-updates,xenial-security,xenial-security 5.7.23-0ubuntu0.16.04.1 all

Already Installed

$ apt list firefox
Listing... Done
firefox/sarah,now 61.0.1+linuxmint1+sylvia amd64 [installed]
N: There is 1 additional version. Please use the '-a' switch to see it
6. dpkg -l | grep package Method

Not Installed

$ dpkg -l | grep mysql-server

Since mysql-server is not installed on my Linux desktop, the above example did not produce any output.

Already Installed

$ dpkg -l | grep firefox
ii  firefox                     61.0.1+linuxmint1+sylvia            amd64        Safe and easy web browser from Mozilla
ii  firefox-locale-en           61.0.1+linuxmint1+sylvia            amd64        English language pack for Firefox
 Posted by at 1:25 pm

How to Create a File on Linux

 Linux  Comments Off on How to Create a File on Linux
Aug 132018
 

As I say often, there are many ways to skin a Linux cat.

Here are a few ways to create a new file on a Linux system.

I have tested the following commands on CentOS 7 and Linux Mint 18.

Creating a New File

1. Touch method

$ touch file_name

Example:

$ touch jennifer

$ ls
Interview-Questions       Favorite-Beer.txt             REdHat-Release-Dates.odt               Ubuntu-Tips
jennifer

2. Echo method

$ echo -n > New_file

Example:

$ echo -n > sammy
$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  sammy  Templates  Videos  VirtualBox VMs

3. Echo method with some content in file

$ echo jack and jill went up the hill > new_file

Example:

$ echo jack and jill went up the hill > donald_trump
$ ls
Desktop  Documents  donald_trump  Downloads  Music  Pictures  Public  sammy  Templates  Videos  VirtualBox VMs
$ ls
Desktop  Documents  donald_trump  Downloads  Music  Pictures  Public  sammy  Templates  Videos  VirtualBox VMs
$ cat donald_trump
jack and jill went up the hill

4. Quickie Method

$ > New_File

$ > Hillary_clinton
$ ls
$        Documents     Downloads        Music     Public  Templates  VirtualBox VMs
Desktop  donald_trump  Hillary_clinton  Pictures  sammy   Videos

5. Via Nano Text Editor

$ nano new_file

Once new_file is opened, hit ctr-o (i.e., the alphabet o and NOT zero).

You can also create a new file via the Vim text editor:

6. Use the Vim Text Editor

$ vi new_file

To save your new_file, hit Esc, then type :wq the file will then be saved and you will exit vim.

 Posted by at 2:36 pm

Linux Mint 19 Won’t Support Minimal Install Option

 Linux  Comments Off on Linux Mint 19 Won’t Support Minimal Install Option
Apr 302018
 

The bigwigs at Linux Mint have spoken.

The nice minimal install option available in the new Ubuntu 18.04 LTS distro will NOT be offered with the upcoming Linux Mint 19 aka Tara.

With Ubuntu 18.04’s minimal install, you only get the Firefox browser and a few basic utilities, not the fancy stuff like LibreOffice, etc.

Linux Mint did not provide any reason why such a cool feature as minimal install would not be made available in the next major version of the popular distribution.

Well, you can’t really question the wisdom of the Delphic oracles. Can you?

Although based on Ubuntu 18.04 LTS, Linux Mint 19 will likely differ from its parent in another important way too.

Linux Mint developers are considering retaining support for home directory encryption, a feature stripped in the Ubuntu 18.04 installer. But a final decision has yet to be made in this matter.

No Minimal Install Support with Linux Mint 19 aka Tara

Tara – Other Features

Besides leveraging the various improvements in its upstream parent Ubuntu 18.04 LTS, the love-child (Tara) should also feature improvements in Mint tools, with the focus on Update Manager, Software Manager and Welcome Screen. Continue reading »

 Posted by at 3:03 pm

Ubuntu 18.04 LTS – My First Impressions

 Linux  Comments Off on Ubuntu 18.04 LTS – My First Impressions
Apr 262018
 

Ubuntu 18.04 LTS aka Bionic Beaver is out today (April 26, 2018) and you can download it here.

After downloading it, go to the folder and do a shasum check to ensure your download’s integrity.

Here’s how to do the shasum check:

$ sha256sum bionic-desktop-amd64.iso
adf9c1cbb2529cb06a67bbb16af881d8d918078e7e155a897ac30a9e0cf2bafa  bionic-desktop-amd64.iso

Since this is a LTS (long term support) version, users of Desktop, Server and Core editions will get support in terms of security and other updates for the next five years, i.e., until April 2023.

I’m not a stranger to Ubuntu 18.04 LTS since I had already downloaded beta 2 (desktop version) a few days back on a Dell Optiplex 780 PC and launched it via Virtualbox.

Here are my first impressions of the official release of Ubuntu 18.04 LTS, which hews close to beta 2. Continue reading »

 Posted by at 7:43 pm

How to Check If an Application is Installed in Ubuntu

 Linux  Comments Off on How to Check If an Application is Installed in Ubuntu
Dec 012016
 

In this brief post, I’ll quickly show you how to check via the terminal if a particular program is installed on an Ubuntu Linux system.

For easy understanding, I will consider a program that is already installed (keepassx) on my computer and one that is not installed nmap.

On the terminal, there are two reliable ways to find out if a program is installed on an Ubuntu or Linux Mint system: Via apt-cache policy or by running dpkg. Continue reading »

 Posted by at 10:20 am

Differences between yum info and yumdb info with Example

 Command Line, Linux  Comments Off on Differences between yum info and yumdb info with Example
Apr 262016
 

Wise folks say a picture is worth a thousand words.

In Linux, an example is worth ten thousand words.

In this post, we’ll use an example to understand the difference between the commands yum info and yumdb info.

For purpose of this post, I will use the popular Cherrytree notes application.

In both examples I’ve run the commands after installing cherrytree.

By the way, I’m running the below commands on a CentOS 7 system.

So here we go, first with the yum info command.

yum info

[tommy@localhost ~]$ yum info cherrytree
Loaded plugins: aliases, changelog, fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: linux.cc.lehigh.edu
 * epel: mirrors.mit.edu
 * extras: mirror.vtti.vt.edu
 * updates: mirror.net.cen.ct.gov
Installed Packages
Name        : cherrytree
Arch        : noarch
Version     : 0.36.9
Release     : 1.el7
Size        : 3.1 M
Repo        : installed
From repo   : epel
Summary     : Hierarchical note taking application
URL         : http://www.giuspen.com/cherrytree/
License     : GPLv3+
Description : CherryTree is a hierarchical note taking application, featuring rich text and
            : syntax highlighting, storing all the data (including images) in a single XML
            : file with extension ".ctd".

Now let’s consider yumdb info with the same cherrytree application.

yumdb info

[tommy@localhost ~]$ yumdb info cherrytree
Loaded plugins: fastestmirror, langpacks
cherrytree-0.36.9-1.el7.noarch
checksum_data = febc31650e96f822cb1a4e52c66aa4a9e71503f861680b3fa3385a478300b7ed
checksum_type = sha256
command_line = install cherrytree
from_repo = epel
from_repo_revision = 1461632780
from_repo_timestamp = 1461640240
installed_by = 1000
origin_url = http://ftp.osuosl.org/pub/fedora-epel/7/x86_64/c/cherrytree-0.36.9-1.el7.noarch.rpm
reason = user
releasever = 7
var_infra = stock
var_uuid = 72c6b420-9095-4304-90a7-fbb60a47ec6a
[tommy@localhost ~]$ 

yumdb info provides information like the checksum data and type, command used to install it, the repository and the person (userid) who installed it but nothing about the application or the developer.

However yum info provides information about the application (both in summary form and in a slightly longer version) as well as the file size. But yum info provides no information about the checksum data or type, the command used for installation or the person (userid) who installed it.

So which command you want to use will depend on your unique needs.

 Posted by at 12:34 pm