How to Install RRDtool on Redhat Enterprise Linux

RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data. The RRDtool homepage can be found here Below shows you how to install RRDtool 1.3.1 on Redhat Enterprise Linux. Update your system [root@localhost /]# yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel make -y Download and … Read more

How do I install snmpwalk / snmpget using Yum ?

To install snmpwalk or snmpget on Redhat use the command yum install net-snmp-utilsThis will install the following binaries,  [root@localhost .ssh]# snmp snmpbulkget    snmpdelta      snmpinform     snmptable      snmptrapd snmpbulkwalk   snmpdf         snmpnetstat    snmptest       snmpusm snmpconf       snmpget        snmpset        snmptranslate  snmpvacm snmpd          snmpgetnext    snmpstatus     snmptrap       snmpwalk

vi / vim – Show Line Numbers

Below shows you how to display line numbers within vi. Enable While in VI and not in `Insert Mode`type the following to display the line numbers : :set number Disable To disable line numbers enter the following : :set nonumber

Bash / CGI – Premature end of script headers

Issue When trying to add a image to your CGI script you recieve the following error and the image isnt displayed. [root@localhost cgi-bin]# cat /var/log/httpd/error_log [Fri Jul 10 20:51:39 2009] [error] [client] Premature end of script headers: picture2.jpg, referer: [Fri Jul 10 20:57:57 2009] [error] [client] (8)Exec format error: exec of ‘/var/www/cgi-bin/picture2.jpg’ failed, … Read more

Redhat / Fedora – No fonts found

Issue You receive the following error when trying to run an application (such as rrdtool), No fonts found; this probably means that the fontconfiglibrary is not correctly configured. You may need toedit the fonts.conf configuration file. More informationabout fontconfig can be found in …. Solution Run yum install deja* If you receive the following,  –> … Read more

Linux – how to use the alias command

The alias command allows you to create command shortcuts within your shell. Below shows you how, move to your home directory, [root@localhost ~]# cd ~ add the alias of os which will show the output of ‘uname -a’ [root@localhost ~]# cat >> .bash_profile [root@localhost ~]# alias os=’uname -a’ Reload you environment variables for your new … Read more

Linux : Random Fact Generator

The command below with present you with a random fact, lynx -dump | grep -A4 “\[3\]”| tail -n1 You can place it into your ~/.bash_profile file so that you receive a random fact everytime you log in.

Linux : What is my IP address location ?

The following command will retrieve your current IP city location, lynx -dump$1|sed -nr s/’^.*My IP address city: (.+)$/\1/p’

-bash: /dev/null: Permission Denied

Issue After creating a new user account you may find that on login you recieve the following error, -bash: /dev/null: Permission denied -bash: /dev/null: Permission denied -bash: /dev/null: Permission denied  Solution /dev/null is a character special device which should have read+write permissions for everybody.Run the following to confirm the current permissions for /dev/null, ls -l … Read more

AWK – By Example

Remove the columns $4 $5 $12 and $13. awk ‘BEGIN{FS=OFS=” “}{$4=$5=$12=$13=””}{print}’ file.txt Break down each line and numbers each field. awk ‘{print NR”: “$0; for(i=1;i<=NF;++i)print “\t”i”: “$i}’ Add list of numbers within a file. awk ‘{total+=$0}END{print total}’ file

Bash / Korn – Change the default session timeout

This short guide will show you how to set the default session timeout. We will set the TMOUT variable, of which is supported by both shells, Bash and Korn. To check your current timeout setting, enter the following, [root@localhost ~]# env | grep TMOUT To change this setting globally edit the /etc/bashrc. To change this … Read more

ffmpeg Commands

FFmpeg allows you to record, convert and stream digital audio and video in various formats. The installation guide can be found here Commands ffmpeg -i [source].flv -vn acodec copy [dest].mp3 Copy the sound of a video to an mp3 ffmpeg -i [source].avi -s 320×240 -b 1000k -vcodec wmv2 -ar 44100 -ab 56000 -ac 2 -y … Read more

Linux – Creating a new Logical Volume / Partition

How do I create a new Logical Volume / Partition ? We will be creating a new logical volume named DATA and mounting this on a new directory called DATA. First of we will create the logical volume, then we will create a file system on the Logical Volume. Once complete we will create a … Read more

Logical Volume Manager

What is LVM ? LVM (Logical Volume Manager) for the Linux Kernel is a method of allocating hard drive space into logical volumes, this also allows for the easy creation, resizing, or removal of new or existing partitions. There are 4 main terms with LVM ….. physical volumes – These are your physical disks, or … Read more

Ubuntu – Configuring an Interface

In order to configure an interface in Ubuntu you will need to edit the following file /etc/network/interfacesBelow is an example, auto [INTERFACE]iface [INTERFACE] inet staticaddress [IP ADDRESS]netmask [NETMASK]network [NETWORK]gateway [GATEWAY]  Once you have made the change to the interfaces file, run the following command /etc/init.d/networking restart

VI shortcuts

General Shortcuts dd delete a line x delete a character a append after cursor A append after line Useful for script editing :![command] allows you to run a command while still in VI :!! repeats previous command :! [command] % allows you to run a command, with % = current file name Motion h Move … Read more

Bourne – Different ways to execute a script

1. The following 2 types of syntax are both ways to execute a script. Using these methods a second shell will be opened and once the script has finished the variables will not persist. chmod +x [script] sh [script] 2. Below shows you a way in which you can run your script using the current … Read more

Bourne – Special Characters

& run command in the background * wildcard ? single wildcard < input redirect > input redirect | pipe outpt to one command from another # remark symbol, ignores characters after  It is best to avoid using these special characters when naming files. To pass these charaters to another program, you will need to prefix … Read more

Linux – How to Mount an ISO image

In order to mount your ISO you will need to add the ISO to your box, create the directory then mount the file, root@host:~$ mkdir /mnt/iso root@host:~$ mount -o loop -t iso9660 MYCD.iso /mnt/iso use the following command to confirm that you have mounted it correctly, root@host:~$ df -kh You should see, Filesystem           Size  Used … Read more

Debian – How to configure an interface as promisc

In order to configure your interface you will need to edit the following file, /etc/network/interfacesBelow is an example of this file, this would set eth0 an IP ( and eth1 and eth2 to promisc mode. # This file describes the network interfaces available on your system# and how to activate them. For more information, see … Read more

Linux – Setting up VNC Server

Below is a short guide to set up a VNC server within Linux. INSTALL Install the package by running the following commands, Ubuntu/Debian – apt-get install vnc4server xinetd Fedora/Redhat – yum install vnc-server PASSWORD Set the password for vnc by running the command vncpasswd START VNC Start the vnc server by running the command vncserver.You … Read more

Linux – cp: omitting directory error

When trying to use the cp command you receive the error message, cp: omitting directory This can be overcome by using the -r option, cp -r [source file] [destination file]

BASH – Adding coloured text

This will simply print your text in red.  echo -e ‘\E[31mThis prints in red.’; tput sgr0 If you need any further information or want to know how to add bold, underlining, or background colours to your text click here. 

Linux – Unable to send email using Postfix

Below outlines the issue and resoultion when trying to send email using Postfix. Issue When trying to send an email on my linux platform I get the following error message in my mail.log ?? The IP you’re using to send mail is not authorized 550-5.7.1 to send email directly to our servers.      Please use the … Read more

The Ultimate Linux Command Reference Guide

 The Ultimate Linux Command Reference Guide Note: This was produced with Ubuntu. Tip: Theres quite a few in this list so I suggest that if your looking for something spefic use the search function (ctrl+F)…. a2p               – Awk to Perl translatoraconnect          – ALSA sequencer connection manageracpi              – Shows battery status informationacpi_listen       – ACPI event listeneraddr2line         … Read more

Linux – VNC Blank Screen

Edit the/root/.vnc/xstartup file so it reads, xrdb $HOME/.Xresources xsetroot -solid grey x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” & gnome-session & After doing this kill the vnc processes and restart. Note : You may need to change the last line if you are using KDE.

Linux – Setting a Default Gateway

First of all run the command to enter the default gateway, route add default gw Then to make sure it survives a reboot, edit the file ‘/etc/sysconfig/network‘ and add the line below. Of course changing the IP address to your default gateway – GATEWAY=

Ubuntu – Cannot install via apt-get

Issue I cannot install via apt-get as I get the message, E: Package ssh has no installation candidate When running apt-get install [package name] you get, root@ubuntu:~$ sudo apt-get install sshReading package lists… DoneBuilding dependency treeReading state information… DonePackage ssh is not available, but is referred to by another package.This may mean that the package … Read more

Debian – Add a Default Gateway

Below should the configuration steps for adding a default gateway to Debian. root@host:~$ route add default gw [ip address]  Note : Remember to add it (to survive a reboot) to your ‘/etc/network/interfaces’.Add the following entry to required interface within the interface file – gateway [ip address] Below is an example : auto eth0iface eth0 inet … Read more

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial