Howtos / Articles

Using sed to replace a string in a file

The ‘sed’ command can be used to easily replace all occurrences of one string in a text file, with another string. For example: sed -i “s/wordtofind/replacewithword/g” /path/to/file.txt This command will find all occurrences of “wordtofind” and replace them on the fly with “replacewithword” in the file “/path/to/file.txt”. The “-i” command switch specifies to edit the file in place, otherwise it will just display the output to the standard output. Run it without the “-i” switch to ensure it runs correctly,…

Read more [...]

Install the dig DNS lookup utility on CentOS

The dig DNS lookup utility is a handy tool for performing DNS queries. The dig utility is part of the bind utilities package in CentOS. The following command can be used to install dig. Install dig (the bind-utils package): # yum install bind-utils Note: Make sure you run the above command as a user with root privledges. You should now be able to use dig to perform DNS lookups. See ‘man dig’ for more information.…

Read more [...]

List all hard disks connected to a CentOS system

You often need to know what physical drives are attached to a system, how many drives are connected, or even what device names match up with which physical drive. There is a handy tool called ‘lshw’ which is used to extract detailed information on the hardware in the PC. Unfortunately this doesn’t come pre-installed on CentOS. The details below will go through installing lshw, and how to run it to list all the hard drives. Prerequisites This guide requires the…

Read more [...]

Save iptables firewall config on CentOS 6

Changes you make to iptables firewall rules only exist for the current boot, and if you don’t save the config, you will loose any changes upon rebooting. CentOS 6 blocks most incoming ports by default, so you will generally have to make changes to the firewall if you install any new packages. Thankfully CentOS 6 provides the ability to easily save the configuration. To save the current iptables firewall config, issue the following command: # service iptables save Example output:…

Read more [...]

Installing NGINX, PHP, and MySQL on CentOS 6

This “how to” guide will step you through the process of setting up Nginx, PHP, and MySQL on CentOS 6.…

Read more [...]



Page 1 of 3123