Posts Tagged Linux

How to Debug Bash Scripts

Bash is the default scripting language in most Linux systems. Its usage ranges from an interactive command interpreter to a scripting language for writing complex programs. Debugging facilities are a standard feature of compilers and interpreters, and bash is no different in this regard. In this article, I will explain various techniques and tips for debugging Bash scripts.

Read more »

Version Control for Linux Configuration (/etc) with etckeeper

Keeping a version history of files under /etc is essential for maintaining a healthy system. The benefits of tracking changes to /etc include:

  • Documentation: The log messages that are attached to configuration changes serve as documentation. These log messages record who made the change, when and why. Understanding the contents of a config file becomes much easier if you have a full history of the changes that were made to this file.
  • Troubleshooting: Misconfiguration can result in a variety of problems. When a service starts to misbehave, one of the things you can do to troubleshoot the issue is to check the version history of its config file. There, you can see if any changes were made around the time frame in which the problem happened. If you spot a change that may be causing the issue, you can easily revert it to fix the problem.

You can set up your own repository to track changes to /etc, or you can use a tool called etckeeper to handle the setup for you. This tool supports multiple version control systems, including Git, Mercurial and Bazaar. It integrates with the package management systems of a number of Linux distros, including APT (used by Debian, Ubuntu), YUM (RedHat, CentOS, Fedora), Pacman (Arch Linux). Using etckeeper instead of rolling your own has some advantages:

  • etckeeper integration with package managers means than you don't need to manually commit changes in /etc after installing packages.
  • etckeeper comes pre-configured with a list of files that live in /etc but usually do not benefit from version control (like some cache files).

Read on to learn how to install, configure and use etckeeper.

Read more »

Increase Your Linux/Unix Productivity With GNU/Screen

screen is one of my favorite GNU utilities; it provides a quick and easy way to have several open terminals and do multiple things at once. Another cool feature about screen is that it stays running even if the user logs out or disconnects. This enables the user to detach from their session and resume it later. This feature is a life saver when working on a remote machine through SSH. If I was disconnected for some reason, I can easily reconnect and resume my session.

screen is very easy to use. Below is a list of its main commands. Read on, experiment with them, and you will become proficient in screen in minutes. Believe me you will appreciate it.

Read more »

A Collection of Vim Tips

Vim is one of the most popular text editors for Linux and Unix systems. Its text-based interface may look intimidating for newcomers, but underneath it there is a wealth of functionality to be learned. Experienced Vim users often feel much more productive using Vim than GUI-based text editors.

I've been using Vim on a daily basis for years to do a wide range of tasks, from casual editing of short text files, to managing large programming projects, and every now and then I come across a new feature that considerably helps in some aspect of text editing. For this reason, I decided to compile a list of such Vim tips in this post.

Read more »

Tips to Secure Linux Workstation

If you have a Linux workstation with a direct connection to the Internet, you need to take certain measures in order to protect it from attacks. This article contains configuration information and tips on how to protect your machine. The article is applicable to all popular Linux distributions.

Read more »