Linux Tip of the Day – Yum Search vs Yum List

 Command Line  Comments Off on Linux Tip of the Day – Yum Search vs Yum List
Jul 292015
 

Yum Search vs Yum ListYum is one of the most powerful tools in the arsenal of a RedHat or CentOS systems administrator for package management.

When installing, upgrading, removing or searching for packages, yum is the best choice because it automatically resolves dependencies.

In this post, let’s examine the difference between yum search and yum list commands.

While both command are used to find a package, yum search is more comprehensive.

When you run yum search, the command searches for package name, summaries and description.

But yum list only looks for the search term in the package name.

Here’s an example of how the two commands differ in their results.

Let’s first try yum search without any glob expression.

# yum search vim
vim-gtk-syntax.noarch : Vim syntax highlighting for GLib, Gtk+, Gstreamer, and more
vim-vimoutliner.noarch : Script for building an outline editor on top of Vim
beakerlib-vim-syntax.noarch : Files for syntax highlighting BeakerLib tests in VIM editor
golang-vim.noarch : Vim plugins for Go
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-clustershell.noarch : VIM files for ClusterShell
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor
vile-common.x86_64 : The common files needed by any version of the VIM editor
youtube-dl.noarch : A small command-line program to download online videos

As we can see in the above output, vim is present in both the package name and description.

Now let’s run the yum list command with the wildcard character * and examine the results.

# yum list '*vim*'
Installed Packages
vim-common.x86_64                                                                        2:7.4.160-1.el7                                                               @base    
vim-enhanced.x86_64                                                                      2:7.4.160-1.el7                                                               @base    
vim-filesystem.x86_64                                                                    2:7.4.160-1.el7                                                               @base    
vim-minimal.x86_64                                                                       2:7.4.160-1.el7                                                               @anaconda
Available Packages
beakerlib-vim-syntax.noarch                                                              1.10-2.el7                                                                    epel     
golang-vim.noarch                                                                        1.3.3-3.el7                                                                   base     
protobuf-vim.x86_64                                                                      2.5.0-7.el7                                                                   epel     
vim-X11.x86_64                                                                           2:7.4.160-1.el7                                                               base     
vim-clustershell.noarch                                                                  1.6-4.el7                                                                     epel     
vim-gtk-syntax.noarch                                                                    20130716-1.el7                                                                epel     
vim-vimoutliner.noarch                                                                   0.3.7-5.el7                                                                   epel

As we see from the above results, yum list only considers the search term in the package name.

By the way, yum search all is even more exhaustive but runs a bit slower.

 Posted by at 3:56 pm

How to List Software Installed by Date on a Linux System

 Command Line, Linux  Comments Off on How to List Software Installed by Date on a Linux System
Jul 202015
 

Commands to List Software Installed by Date on Linux SystemsIt’s easy to get a list of all the software installed or upgraded on a Linux system.

If you’re running CentOS, RedHat or Fedora, just run the below command on the terminal to get the complete list of all software installed on your PC or server.

$ rpm -qa

If you’re running Debian, Ubuntu or Linux Mint, go with either of the below commands.

$ dpkg --get-selections

The following command will work fine too.

$ dpkg -l

Software Installed by Date

RPM Based Linux Systems

However, there are occasions when we’d like to know about the software on our Linux system by date of installation. Continue reading »

 Posted by at 12:00 am

How to Properly Reboot or Shut Down a Linux System

 Command Line, How To, Linux  Comments Off on How to Properly Reboot or Shut Down a Linux System
Jul 092015
 

How to do Clean ShutdownLearning how to do a clean shut down of a Linux system is important if you don’t want to mess up your computer.

Just pressing your finger on the power button will certainly shut down or reboot your Linux system. But it can also cause serious damage like data corruption.

Remember, Linux is constantly writing data to disk even if it’s not apparent to you. Also, Linux keeps data in memory although it might appear to have written the data to disk.

So it’s crucial to do an orderly shutdown of a Linux desktop or server.

When you do a clean or orderly shutdown, you’re essentially informing users and processes on the Linux system of the shutdown and blocking new logins.

In this post, we’ll cover various options to properly reboot and shut down a Linux system.

You must be root or use sudo to run the shutdown command.

When I tried to run shutdown without being root or using sudo, I got the following error:

[thomas@localhost ~]$ shutdown
Must be root.

Continue reading »

 Posted by at 2:35 pm

10 Key DU Commands for Linux Newbies

 Command Line, Linux  Comments Off on 10 Key DU Commands for Linux Newbies
May 202015
 

Simply put, the du command gives you the size (disk usage) of a directory and files.

In the face of growing storage requirements and huge data warehouses, familiarity with the du command would stand Linux newbies in good stead.

Here’s the synopsis of du from the man pages.

SYNOPSIS
du [OPTION]… [FILE]…
du [OPTION]… –files0-from=F

Let’s now consider some key du commands that Linux system administrators will find extremely handy.

Default Command

$ du

Running the above command will spit out a list of all directories in the current working directory and their size.

Total size of the current directory (including sub-directories and files) is provided at the end.

Although the results will not mention it, disk usage output is given in Kilobytes.

Summary Output
Far too often, we just need summary size of a directory, not pages of details.

In such situations, we’ll go with the -s option.

$ du -s

It’s simple but not that user-friendly since the output is provided in Kilobytes (who uses Kilobytes in an era of Gigabytes and Terabytes).

Human Readable Format
When you use the -h option (-h stands for human readable format) with du, you’ll see an easy to grasp output.

$ du -h

Depending on their size, file and directory sizes are suffixed with K (kilobytes), M (megabytes) or G (gigabytes). Continue reading »

 Posted by at 12:00 pm

How to Flush IPTables Chains Selectively

 Command Line, How To, Linux  Comments Off on How to Flush IPTables Chains Selectively
May 132015
 

IPtables are a priceless resource for system administrators to secure their servers.

Given the ceaseless attempt by hackers working for money or thrills, every Linux server administrator must grasp the basics of IPtables.

In this post, I will assume that you already have IPtables installed and running on your system.

Once in a while, there might be arise a situation where you’ll have to flush the IPtables rules.

What is flushing?

Flushing basically refers to deleting the IPtables rules in a single chain or all chains.

Now you should know the difference between flushing and deleting on the command line with reference to IPtables.

In flushing, you’re just deleting the rules in a chain. Continue reading »

 Posted by at 5:03 pm

How to Find Version of Packages on CentOS

 Command Line, How To, Linux  Comments Off on How to Find Version of Packages on CentOS
May 122015
 

Find Version of Packages on CentOS
Every now and then, there arises the necessity for Linux administrators to find out what version of a particular package is running on a CentOS, RedHat or Fedora system.

As is to be expected, the commands to find out which version of a package is installed on RedHat, CentOS and Fedora are different from the commands for Ubuntu and its derivatives like the popular Linux Mint.

There are multiple ways to get the version of packages installed on CentOS, RedHat and Fedora. You can do it via the command line or through GUI utilities.

In this post, we’ll check out five simple methods to determine package version via the command line.

1. The first command line option that comes to mind when checking for the version of an application or package on CentOS  is yum info package_name.

$ yum info PACKAGE_NAME

Let’s see what version of the clamtk anti-virus software is installed on our CentOS 7 desktop.

$ yum info clamtk
Installed Packages
Name        : clamtk
Arch        : noarch
Version     : 5.15
Release     : 1.el7
Size        : 1.3 M
Repo        : installed

2. The yumdb method provides more information compared to the previous option.

$ yumdb info PACKAGE_NAME

With yumdb info, you not only get the package version number but other details such as checksum of the package (and algorithm used to produce it, such as SHA-256), repository, which user installed it, or whether it landed on the system as a dependency.

Let’s check out the yumdb command with an example.

Why not see what version of python is installed on our Linux system.

$ yumdb info python
python-2.7.5-16.el7.x86_64
     checksum_data = b03c388fe3fe1c711249564c96902852d129a0f4faf8a27accd660bf42ebab4e
     checksum_type = sha256
     from_repo = anaconda
     from_repo_revision = 1404557011
     from_repo_timestamp = 1404557037
     installed_by = 4294967295
     reason = dep
     (and more)

3. There’s another easy to remember option, rpm -qa which queries all currently installed packages.

$ rpm -qa PACKAGE_NAME

One of my favorite newsreaders on Linux is quiterss.

In the below command, we’ll see which version of quiterss is installed. Continue reading »

 Posted by at 6:14 pm  Tagged with: