Month: March 2013

Use tar Extract files from an alternate directory

When decompressing a compressed tar file, generally, the approach is to change directory to the root and execute the tar command from there with a full path to the compressed tar. There is an easier method that will remove a line or two of code from each script. Down to a single command line. This is how to use tar…

Read More »

How to chkconfig off and on Multiple services with a bash script

This has more applications than with just the chkconfig command. However, I found this script to be useful and wanted to add it to my database of useful scripts. This script will chkconfig off the services listed in the services variable. By changing the off to on, the script will chkconfig on the services listed in the services variable. Here…

Read More »

Bash Script Execution Timer

Suppose you wanted to determine the length of time it took to complete the execution of a bash script. Rather than sitting in front of the computer and estimating the time elapsed by watching the script execute with a stopwatch, it can be done with a few lines of code. Near the top of the script add the following variable…

Read More »

Linux: Using chkconfig

From the man pages, chkconfig is defined to provide a simple command-line tool for maintaing the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories. When chkconfig is run without any options, it displays usage information. If only a service name is given, as in the case above, it…

Read More »

Combine Linux Comands using && and ||

When using if then statements in your scripts, these statements will likely take up multiple lines. Sometimes, you may want a simple if then statement and would prefer to write only one line of code. This is a quick tip I picked up the other day. It is a simplification and explanation off how to combine multiple lines of code…

Read More »