Rename all files to lowercase names

There seems to be several solutions offered for renaming all files in a directory from mixed or upper case to all lowercase names. Of the solutions, one of the worked without issue. ls | while read upName; do loName=`echo “${upName}” | tr ‘[:upper:]’ ‘[:lower:]’`; mv “$upName” “$loName”; done Although this was found in an Ubuntu forum, it works flawlessly in…

Read More »

Remove non-ASCII characters from file

There was a text file that contained non-ASCII characters that acted like spaces within the file, so I used the tried and true dos2unix command to attempt to clean the file; however, the characters remained.  With hundreds of lines to correct, manually deleting the offending areas of the file was not an option.  A real solution is needed. Once again,…

Read More »

The truncate command

If you ever get in a bind and a log file has gone out of control and your disk space is full, you may be tempted to delete the log file.  There may be a couple of problems with that.  One, the application is still using the file so that delete may not actually take place until the application is…

Read More »

Best Practice for chown

Over the years, I have seen a couple of variations with the use of the chown command. The “:” (colon) vs “.” (dot).  While studying for the RHEL6 exam sometime ago, the books that I had used each had one or the other in their documentation.  I have read that the posix standard is using chown with the “:” (colon)….

Read More »

How to Update a Lenovo BIOS with USB

Lenovo provides an ISO for CD/DVD burning and an EXE for running the executable from within Windows.  There is NO support for an ISO booting from a USB.  Many modern laptops are ordered without a CD ROM and maybe an extra hard drive in it’s place.  Most people use USB sticks for the majority of their effort when the need…

Read More »

How to repair a damage fstab located on an LVM

i made a change to the /etc/fstab that looked perfectly fine until I rebooted the system (CentOS 6) running as a virtual machine.  The system did not start, there was a Kernel panic, and using the single boot mode did not provide any access to the system.  I changed the “/” partition to a UUID number after changing the volume…

Read More »

Create a Port Listener to verify connectivity

How to test an open port without having the application installed. Suppose you have a situation where you just created a new Linux server (CentOS 6) and you will eventually have an application run on Tomcat port 8080/tcp. You will want this application to use some sort of a Reverse Proxy and this all goes through a firewall that sits…

Read More »

Kickstart validation

Customizing a kickstart file to meet your requirements can be challenging.  One typo or incorrect setting and it simply won’t work.  Validation of a success or fail can be achieved with a time consuming reboot.  However, there is a quicker solution. Be certain to validate the kickstart on the same operating system version as the kickstart file or you may…

Read More »

Add custom DNS entries to Pi-Hole

Pi-Hole is the black hole for the internet. As of the most recent Pi-hole Version v2.13.2 with Web Interface Version v2.5.2, a local network should have the necessary tools, DNS and DHCP servers, to run successfully. With that said, what if you want custom DNS settings? I tried this approach successfully, so now one IP resolves to several domain names….

Read More »

Add Root Certificates to a CentOS Linux Server

Adding a root authority certificate to a server that does not already have the cert may be added to the server manually. CentOS 6 Install the ca-certificates package: yum install ca-certificates Enable the dynamic CA configuration feature: update-ca-trust force-enable Add it as a new file to /etc/pki/ca-trust/source/anchors/: cp foo.crt /etc/pki/ca-trust/source/anchors/ Use command: update-ca-trust extract CentOS 7 CentOS 7.0 and later…

Read More »

Fix the CentOS Root Certificate Authority file

For whatever the reason, the /etc/pki/tls/certs/ca-bundle.crt file may get corrupted, in my case, accidentally overwritten.  I could have gone the route of copying the ca-bundle.crt file from another vanilla server, but I wanted a more elegant solution.  There is one, download a new certificate bundle. Download the new certificate bundle.  Since my ca-bundle.crt was overwritten, there was no need to…

Read More »

How to Combine Multiple Images Quickly

If you have ever started an eBay auction and wanted to add your large picture collection to it, you will quickly realize that you can only add up to 12 pictures.  While it is true pictures can be added to the body of the auction and linked to an alternate sources, that is extra work. As a work-a-round to the…

Read More »

Check if user account is locked in Linux

If you ever needed to know if an account is locked in CentOS Linux, there are a few commands to find those answers. Password Lock a password using passwd. Additional confirmation that the password is locked.  The double !! indicates that the password is locked.  Note that this user does not have a password. Unlock the password.  Note that the password…

Read More »

A quick way to install the ELK stack (Kibana 4.4)

By combining the massively popular Elasticsearch, Logstash, and Kibana (what was the ELK Stack is now the Elastic Stack), Elastic has created an end-to-end stack that delivers actionable insights in real time from almost any type of structured and unstructured data source. There are many resources that offer installation procedures from simple to complex configurations.  This is my take on a simple installation…

Read More »

Create a large file in Linux for testing

There are many ways to go about this.  A common favorite is the use of the dd command. This simple two letter command requires so many parameters to accomplish the simple goal of generating a file of a specific size. There is another way, and it’s easier to remember too. Create a 100MB file using dd will look something like…

Read More »

Reduce the number of commands with sed

Suppose there is a situation that a server has multiple files that are nearly identical and you want to remove content from them.  In this example suppose that server has multiple NIC cards.  There is content that needs to be deleted. The situation, you have five NIC cards.  Each ifcfg-ethx config file contains the values for NM_CONTROLLED, HWADDR, GATEWAY, and…

Read More »

Remove the ^M from config files

Working in both Windows and Linux environments can from time to time create undesirable effects when modifying Linux configuration files on Windows boxes. After the edits and copying the file to the Linux box, a quick check of the file using the cat revealed nothing out of the ordinary.  However, the vim revealed the hidden ^M. I’m still not entirely…

Read More »