Posts

Showing posts from 2017

How to Trace Execution of Commands in Shell Script with Shell Tracing

Image
In this article of the shell script debugging series, we will explain the third shell script debugging mode, that is shell tracing and look at some examples to demonstrate how it works, and how it can be used. The previous part of this series clearly throws light upon the two other shell script debugging modes:  verbose mode  and  syntax checking  mode with easy-to-understand examples of how to enable shell script debugging in these modes. Shell tracing simply means tracing the execution of the commands in a shell script. To switch on shell tracing, use the  -x  debugging option. This directs the shell to display all commands and their arguments on the terminal as they are executed. We will use the  sys_info.sh  shell script below, which briefly prints your system date and time, number of users logged in and the system uptime. However, it contains syntax errors that we need to find and correct. #!/bin/bash #script to print brief ...

How to List Files Installed From a RPM or DEB Package in Linux

Image
Have you ever wondered where the various files contained inside a package are installed (located) in the Linux file system? In this article, we’ll show how to list all files installed from or present in a certain package or group of packages in Linux. This can help you to easily locate important package files like configurations files, documentation and more. Let’s look at the different methods of listing files in or installed from a package: How to List All Files of Installed Package in Linux You can use the  repoquery command  which is part of the  yum-utils to list files installed  on a CentOS/RHEL system from a given package. To install and use  yum-utils , run the commands below: # yum update # yum install yum-utils Now you can list files of an installed RPM package, for example  httpd  web server (note that the package name is case-sensitive). The  --installed  flag means installed packages and  -l  flags enabl...

All You Need To Know About Processes in Linux

Image
In this article, we will walk through a basic understanding of processes and briefly look at  how to manage processes in Linux  using certain commands. A  process  refers to a program in execution; it’s a running instance of a program. It is made up of the program instruction, data read from files, other programs or input from a system user. Types of Processes There are fundamentally two types of processes in Linux: Foreground processes  (also referred to as interactive processes) – these are initialized and controlled through a terminal session. In other words, there has to be a user connected to the system to start such processes; they haven’t started automatically as part of the system functions/services. Background processes  (also referred to as non-interactive/automatic processes) – are processes not connected to a terminal; they don’t expect any user input. What is Daemons These are special types of background processes that start at ...

HOW TO VERIFY CHECKSUM IN LINUX

Image
WHAT IS CHECKSUM IN LINUX? Checksum is like a digital fingerprint of a file. In technical terms, A  checksum  is a small-sized datum from a block of digital data for the purpose of detecting errors which may have been introduced during its transmission or storage. Well,  checksum  is a long string of data containing various letters and numbers. You’ll generally find them while downloading files from the web, e.g. Linux distribution image, software packages etc. Most common use of checksum is in checking if the downloaded file is corrupted. For instance,  Ubuntu MATE download page  includes SHA256 checksum for every image available there. So, after you downloaded an image, you can generate SHA256 checksum for it and verify if the checksum value matches the one mentioned on the site. If it doesn’t, that will mean your downloaded image’s integrity is compromised (maybe it was corrupted during the download process). We will use...

HOW TO RECOVER DELETED FILES IN LINUX

Image
Have you ever gotten that horrible feeling? The one you get when you realize that you  accidentally deleted files  and it’s not even in the trash? Often it is immediately preceded by denial: I know I have another copy of it somewhere. But rather than going through all the stages of grief, don’t worry. And remember you’re not alone; sooner or later everyone does this. “Don’t worry?” you counter, “I just erased the only copy of my resume!” No really, don’t worry. All that’s happened is that it’s been bumped off a list. So long as you don’t write onto the drive, it absolutely still exists. In fact, depending on the size of the file and the free space on your drive deleted files can persist indefinitely—even if you do write on the drive. “Yes, fine” you say, “I’ll rest easy knowing my resume ‘exists’ in some abstract sense. But so far as I’m concerned if I can’t open, edit or print from it, it doesn’t exist in any practical sense. What would really help would be a w...