RAID Types – Explained

All hardware eventually fails. This is one of the painful side effects of entropy in our universe. For most of the types of hardware used in modern infrastructure, the loss of a single component usually incurs some amount of downtime. Other than the time taken to swap out something like a bad CPU or stick of RAM, sysadmins or users rarely see many long term ill-effects. But unless an admin takes particular care with storage, data loss from disk failures can have immediate and lasting consequences.

Continue reading “RAID Types – Explained”

Using lsof to Recover Deleted Files

If an open file is deleted accidentally, it is possible to use lsof to recreate a copy of the file; provided this is done before the file is closed by the application holding it open.

If you have inadvertently removed a file from the filesystem it is still recoverable if the application using the file it still running. This is because the inode is still open and therefore the data blocks are still on the disk until the application closes the file or exits.

Continue reading “Using lsof to Recover Deleted Files”

The Linux Filesystem Explained

Have you ever wondered what all the folders on the root (/) directory of the Linux filesystem are for? Which file goes into which directories and why are they saved in those directories? On this post, we’ll check out each folder and what purpose or function they serve for the operating system itself. Continue reading “The Linux Filesystem Explained”

Comparing files using the diff command

The diff command outputs the differences between two files, line by line. For files that are identical it produces no output, for binary files only reports if they are different or not.

The set of differences produced by diff is often called a diff or patch, and this output can be used later on by the patch command to change other files. Continue reading “Comparing files using the diff command”

How to effectively use the GREP command

Grep is a very important & powerful Linux commands. It stands for ‘Global Regular Expression Print’ & is used for matching & printing a search pattern or a regular expression from a single or multiple text files. It will look for the pattern if the mentioned files & will than print the result on screen or to an output file.
In this tutorial, we are going to learn to use grep command with examples. Continue reading “How to effectively use the GREP command”

bash Tips and Tricks

I call these tips and tricks – “bash kung-fu”. You can save a lot of typing with these handy bash features.

bash, or the Bourne again shell, is the default shell in most Linux distributions. It has many features to enhance user-friendliness and productivity. Unfortunately, you can’t take advantage of those features unless you know they exist. So here are some bash tips and tricks that will help you with your everyday system admin tasks.
Continue reading “bash Tips and Tricks”

How to find out PID in Linux

Every Linux process has a process ID (PID) assigned to it.  It is a unique identification number that is automatically assigned to each process when it is created in an operating system. A process is a running instance of a program. In this tutorial we’ll look into ways on how to find the PID of process.

Continue reading “How to find out PID in Linux”

Recover disk usage after deleting large file in Linux

Disks getting full on Linux is a common scenario any administrator have probably experienced. There are usually some large files in /var/log directory that can be compressed or deleted to save disk space. Have you ever experienced deleting a large log file and noticed that the disk usage remained the same ? It’s as if the file size usage is not released even though you’ve deleted it?

This scenario can happen if you deleted/renamed/moved an existing file that is currently in use by a running program. This usually happens on log files that are not rotated regularly and then when the file size becomes large, you deleted (or compressed) the file without even checking if it is in-use. Don’t worry, you can still recover your disk space as shown from the example below.

Continue reading “Recover disk usage after deleting large file in Linux”