Category: Linux

A Bash Script Shortcut to Echo Multiple Lines To A New File

Script or batch file writing can be very rewarding, especially when the script written works as planned. What is particularly rewarding is when a shortcut is found that greatly simplifies how the script is written and executed. Here is a couple of shortcuts that I picked up from the Internet. The end result all seem to be the same. This…

Read More »

Install JBoss on CentOS with Two Scripts

Several years ago, I wrote a set of instructions how to install JBoss on a RHEL / CentOS Linux operating system. Then, the procedure utilized the GUI, mouse clicks, and the terminal. Well, as my comfort level with Linux has grown, so has the instructions into a script. A prerequisite for JBoss is Java JDK. For JBoss 5.1.0.GA, I elected…

Read More »

Upgrade CentOS 5.6 to CentOS 5.9

While in the process of updating a development virtual machine of CentOS 5.6, it became clear that the updates would not update CentOS 5.6 to it’s final release of CentOS 5.9. The traditional yum update approach produced the status of No Packages marked for Update. However, a couple of additional commands produced the desired result of CentOS 5.9. The traditional…

Read More »
Linux Logo

VMware – RHEL / CentOS 6.2 Network Issues

After installing CentOS 6.2 i386 minimal ISO as a VMware virtual machine, immediate attempts to perform a yum update failed. The virtual machine network is bridged to the host computer. Pings to the router were successful, however, after some Internet searches, a solution that remediated this situation was found. Before getting to the “fix”. An attempt to change the network…

Read More »

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 »

How to change the IP address of a Linux computer using a script

There was a CentOS server where the IP address needed to be changed. Searches through the Internet revealed a series of commands that would do the trick. This script incorporates these commands into a single utility or bash script. This may not be all inclusive, but it did work for me on a CentOS 5.8 server. To use this script,…

Read More »

How to rename the host name of a Linux computer using a script

There was a CentOS server where the name needed to be changed. Searches through the Internet revealed a series of commands that would do the trick. This script incorporates these commands into a single utility or bash script. This may not be all inclusive, but it did work for me on a CentOS 5.8 server. To use this script, simply…

Read More »

Enable The Root User In Ubuntu 10.0.4

Many Linux distributions permit the use of the root user as a primary login, however, the dominant and popular Ubuntu has left some users in a conundrum. In order to perform tasks as a root user, this must be performed within a terminal window with the sudo command. However, here are a set of instructions that will allow the root…

Read More »

Use scp command for file transfer in Linux

The goal is to copy files from one Linux computer to another Linux computer. The scp command is the command of choice. To get help, type scp –help, the result is the following usage syntax. Basic syntax is scp source destination on a local Linux computer. However if the source is a remote computer, add the following to the syntax….

Read More »

Delete with wildcards from FTP server

Most FTP users use an FTP client to access their FTP server. While there may be a client that is capable of deleting files with wildcards, FileZilla Client does not. After a little research, there is a command available to Windows and Linux users accessible via command line. The command is simply called FTP. Windows / Linux usersAside from some…

Read More »
Linux Logo

Linux server with incorrect date [FIXED]

Every now and again, a server may lose its date and time. One pesky server is continuously using the incorrect date and time. If there was only a way to change the system date. There is, and the easiest way to correct this is by using a simple little command called – date. There are a couple of ways to…

Read More »

How to uninstall Java for LInux

If the native Java for Linux has been installed and the goal is to remove it from the system and install the Oracle Java JDK. Here are the steps to do just that. This is here for reference, I have not fully tested this, in that the installation I was verifying did not have JRE as indicated in the original…

Read More »

How to mount a Windows share from Linux

To access a Microsoft Windows share from a CentOS Linux server there are a few commands that worked for this configuration: Microsoft Windows Server 2003 and CentOS 5.8. This is a quick and dirty guide assumes that a Windows share already exists and uses root. In a production environment, an alternate user would be more appropriate. From the Linux server….

Read More »