Introduction to Unix

UNIX is a very powerful operating system which has been around for more than 30 years. Initially, it was primarily been used by industry and academia. However, since Linux, anyone can have a UNIX system installed on their computer. Having UNIX on your computer is like having an industry strength product. Much of the Internet still runs on UNIX.

Since UNIX has been in the academia for decades, much of its software is available for free. In addition, there is no shortage of blogs full of helpful comments.

tar: 0511-194 Reached end-of-file before expected

This error is caused if the size of your file is larger than the allowed filesize. Suppose the system has a limit of 1 Gb. If you tar and zip twenty 100 Mb files, then the size of the tarred file would be approximately 2 Gb. So the system would give you this error:

tar: 0511-194 Reached end-of-file before expected

To solve this problem, you would need to increase your filesize or remove the limitation as follows:

$ vi /etc/security/limits

Change fsize = -1 and save file

Quick way to find which log file is logging errors

On development systems it is common practice to have different log file to log PHP error logs for different tools and different versions of the same tool. Generally it is a good idea to use meaningful names to make it easy to distinguish between the log files. If you have doubts, you can either look inside the code to see which error log file is being called or do the following:

$ cd ~
$ ls -al /var/log/httpd before.diff

Run the tool such that it would write something to the log file. Then

Some quick APT commands

Advanced Packaging Tool (APT) is used by Debian system to manage package installations. Following are some quick commands:

Some common commands that can be used with APT:

Installing packages

$ sudo apt-get install package

Removing packages

$ sudo apt-get remove package

Getting a list of packages

$ sudo apt-get update

Upgrading packages

$ sudo apt-get upgrade

Display image properties with bash

The following bash script shows how to capture image properties from ImageMagick:

a=`identify xa.jpg`
echo 'format: ' ${strarray[1]}
echo 'dimensions: ' ${strarray[2]}
echo 'filesize: ' ${strarray[6]}

xa.jpg is an image which is stored in the same directory as this script.

identify is an ImageMagick utility. The output of identify xa.jpg is:

Getting started with Git

A version control system keeps track of changes in code. It keeps track of every change made by every developer. It allows code bases to be branched and then merged back. You can also go back in time to a point before you introduced something in the code. Version control is absolutely essential for software development.

How to modify your host file

Your host file enables your system to override the DNS setting for a domain. This change only affects your system.

The syntax of a host file entry is as follows

# this is a comment

Basically you specify an IP followed by a domain. All lines beginning with # sign are comments.

Host files should only be edited with plain text editors like notepad, notepad++, sublime, etc. Following are the locations of host files on different systems: