Category How To

Using chkconfig to start services on boot in Red Hat

In Red Hat distros such as CentOS, you are able to use the chkconfig command to have services start or not start when the machine boots.  You will normally need to be the root user or use sudo in order to use it.  To list the current status of the services, you will use the –list flag.


[root@localhost ~]# chkconfig --list

NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth 0:off 1:off 2:off 3:on 4:on 5:on 6:off
certmonger 0:off 1:off 2:off 3:o...

Read More

System Load Monitor (Ubuntu 11.xx or highter) Unity

If you are new to Ubuntu or you recently upgraded your installation to 11.xx or higher you will notice that the system monitors you are familiar with are not compatible with new desktop. No worries though, there are a number of monitors available going by the name of “Indicators”, these tools will embed into your unity tool bar much the same way that your previous monitors had.

General System Monitor:

monitor You can install this indicator by using the following commands or by searching for “multiload” from the Ubuntu Software Center

sudo apt-get install indicator-multiload

or from the ppa repository:

sudo add-apt-repository ppa:indicator-multiload/stable-daily
sudo apt-get update
sudo apt-get install indicator-multiload

This indicator is a port of the original System Monitor GNOME Panel a...
Read More

CPU Information / Speed

How do I find out CPU Information such as speed, processor, and cache on Linux operating systems?

You can get information about your CPU by using the following command in a terminal window.

cat /proc/cpuinfo

Sample output:processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 20
model           : 2
model name      : AMD E-300 APU with Radeon(tm) HD Graphics
stepping        : 0
microcode       : 0x500010d
cpu MHz         : 780.000
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
f...

Read More

Bash For Loops

ow do I use bash for loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using for statement? How do I use three-parameter for loop control expression?

A ‘for loop’ is a bash programming language statement which allows code to be repeatedly executed. A for loop is classified as an iteration statement i.e. it is the repetition of a process within a bash script.

For example, you can run UNIX command or task 5 times or read and process list of files using a for loop. A for loop can be used at a shell prompt or within a shell script itself.

for loop syntax

Numeric ranges for syntax is as follows:

for VARIABLE in 1 2 3 4 5 .. N
do
	command1
	command2
	commandN
done

OR

for VARIABLE in file1 file2 file3
do
	command1 on $VARIABLE
	command2
	command...
Read More

Executing PHP scripts over HTTP Using Cron Jobs

In programming there are a number of ways to execute on an idea and get a result, executing a php file on your web server is no different. Below I will provide examples of how to execute a php script or other type of script over http using configurable cron jobs.

Just about all webhosts also provide a method of adding cronjobs through their control panels including cpanel and plesk.

Method 1: Execute the script using php from the crontab

Just like how you call your shell script (As show in our crontab 15 examples article), use the php executable, and call the php script from your crontab as shown below.

To execute myscript.php every 1 hour do the following:

# crontab -e
00 * * * * /usr/local/bin/php /home/john/myscript.php

Method 2: Run the php script using URL from the crontab

If your ph...

Read More

Adding Aliases to your .bashrc


Ever wonder how you can make shortcuts for some of those long cumbersome Linux commands?  You can by making an alias for it.  What is an alias?  It is a shortcut, let me demonstrate.  Say you want to restart Gnome Network Manager.  To do that you would type the following in a terminal:

sudo /etc/init.d/networking restart

Now you could make an alias called
netre to save yourself some typing and this tutorial will show you how.

Remember this tutorial is for BASH and not SH, CSH, Korn, etc. and more specifically for use with Ubuntu.  I cannot guarantee that this will work with other Linux distributions.

The first thing you will need to do if open your .bashrc file located in your home directory.  To do this type the following in a terminal:

gedit ~/.bashrc

This will bring up the Gedi...

Read More

dtv.py – The Linux Command Line DirecTV Remote

It’s safe to say that I spend a lot of time on the command line, and really prefer to do as much as possible from there.  So, it only makes since to be able to control my DVR from the command line too.  So, I created dtv.py, the DirecTV command line remote.  As of now, you can operate almost all of the buttons that would be on the remote, as well as get information about different channels and see a scrolling list of what is on all of the channels

.

Download:

You will need to edit the following line in the script to add the IP address of the DirecTV box to the script.

####### Put the IP of your DVR here! #######

boxip = ‘192.168.1.125’

You can also set your favorite channels for the -f flag in the favorit...

Read More

How to install a .deb file from the command line

So you have downloaded a .deb file with a program that you would like to install. Most distros that are using a graphical interface will have a package manager that you can use to install these. But if you’re like me, you prefer to do it from the command line. To install it from there, you will need to use the dpkg command, using the -i flag, which does the install. In this example, I have dowloaded Google chrome for Linux from their website and am installing it on Ubuntu.

root@Desktop:/home/user/Downloads# dpkg -i google-chrome-stable_current_i386.deb 

Selecting previously unselected package google-chrome-stable.
(Reading database ... 296976 files and directories currently installed.)
Unpacking google-chrome-stable (from google-chrome-stable_current_i386.deb) .....
Read More

Download the RandomLinux.com Android app!

Download v1 of the RandomLinux.com Android app! Stay up to date on everything that’s Linux right from your phone or tablet!

Download below!

Read More

How to install Samba on Ubuntu – Automated installation script available

Samba is an open source software suite which provides file and print services. This can be installed using a few commands, or using our installation script at the bottom of this post.

The first thing that you need to do is install the Samba and samba-common packages.

sudo apt-get install samba samba-common

You will then want to make sure that python-glade2 is installed.

sudo apt-get install python-glade2

After that, you will want to install the Samba configuration tool.

sudo apt-get install system-config-samba

You then need to add a user account for the Samba user. You can use any name you would like.

sudo useradd sambauser

You will also want to create a user for you to log into your Samba server when you connect.

sudo smbpasswd -a sambauser

You will also want to run the Samba Configurat...

Read More