UNIX processes generally take input from standard input (keyboard), write output to standard out (screen) and may write to standard error if there are any error message which need to be displayed. Among the various powerful functions of Linux systems is the ability to redirect both input and output of commands.

The > symbol redirects output of a command. For example, cal command prints the calendar to screen. Using > we can save this calendar into a file.

bash - printing parameters

A parameter is an entity that stores value and is available to a program. There are many system variables available to BASH. They could be retrieved easily by prefixing a $ sign to the variable. Alternately, you can also surround them with curly braces and prefix a $ sign

#: Title       : print parameters
#: Version     : 1.0
#: Description : print parameters
#: Options     : None

printf "%s " "Current Working Directory"
echo $PWD
printf "%s " "Home Directory"
echo ${HOME}
printf "%s" "Command Directories $PATH"

Output of the script

Ubuntu: could not reliably determine the server’s fully qualified domain name, using for ServerName

Error: Could not reliably determine the server’s fully qualified domain name, using for ServerName

Solution: 1. Open httpd.conf for editing

sudo vi /etc/apache2/httpd.conf

You might be surprised to see that the file is empty

  1. type the following:

    ServerName localhost

  2. Save file and restart apache server

    service apache2 restart

Linux vs Linux Distributions

What is the difference between Linux and Linux distribution?

Linux is the core of the operating system i.e. the kernel. Kernel manages the physical resources of the computer and performs tasks such as starting and stopping programs, allocating memory, managing the processor, and managing network connections.

Creating users and groups in Linux

Note: To try out the examples in this document, you would need root access.

To create a new user you use the adduser command. To add a user by called linuxjunky:

$ adduser linuxjunky

If you get a command not found error

$ /usr/sbin/adduser linuxjunky

To assign a password to your new user

$  passwd linuxuser

To grant ownership of a file to the new user

$ chown linuxjunky filename

To change grant ownership of a directory to the new user

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

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.