≡ Menu

HowTo

How to find the CPU architecture on Linux?

The question - I am on a shared hosting server. I need to find the CPU name and architecture on my Linux box. Is there a command that can be used to do this? There are two ways in which you can find your CPU type, architecture, 32/64 bit versions and more information. The first [...]

{ 0 comments }

The question - When I try to visit my PHP pages using a browser, I get a 500 internal server error. What could be the problem? A 500 internal server error can be caused by several reasons, some of which I describe below. The error means that something went wrong with the web server which [...]

{ 0 comments }

How to get HTTP headers on Linux shell?

Question - How do I inspect the HTTP headers that a website sends on a Linux shell prompt? There are two ways to get HTTP headers on a Linux shell prompt. One is called curl and the other command is called wget. Using curl Curl is a command line tool which can be used to [...]

{ 0 comments }

Question - I need to measure the execution time that my program takes to execute on the shell command line in Linux. Is there a Linux command or directive that can do this? The time command can be used to do this on a Bash shell (or any other shell). The time command takes as [...]

{ 0 comments }

The question - I want Bind to listen on all of my IP addresses. How do I do this using Bind on CentOS? There are listen-on and listen-on-v6 Bind directives that can be used to make Bind listen on specific ports and ip addresses. Bind has config file called the following: /etc/named.conf To change the [...]

{ 0 comments }

How to automatically run yum update using cron?

The question - I want to run a yum update automatically every day. How do I do this using cron? Cron provides a way to do this very easily. Cron jobs can run daily, hourly, weekly and monthly. There are directories in which you put the program or shell script that you want to run [...]

{ 0 comments }

The NTPD or network time protocol daemon can be used to automatically synchronize date and time from a central time server. NTPD can be installed using yum on CentOS, Fedora or Red Hat: yum install ntp On Debian or Ubuntu, you can use the apt-get command: apt-get install ntp Now that you have installed NTP, [...]

{ 0 comments }

Linux: Random Number Generation in BASH

Question - I need pick random files from a directory of 10 files. How do I generate a random number between 0 and 9 (inclusive) in a BASH shell script on CentOS Linux? The shell BASH contains a random number generator called $RANDOM. The value of this variable is a random number between 0 and [...]

{ 0 comments }

Question - I have a CentOS box and I would like to patch and update all security and other updates of all applications on my Linux machine. Is there a command that can do this? On CentOS/RedHat/Fedore machines, there is an RPM manager tool called yum. This package can be used to update or patch [...]

{ 0 comments }

How to set or update DNS servers on Linux?

Each operating system comes with a way of updating the DNS servers that the OS will use to perform name lookups. DNS is a protocol based upon UDP which allows you to convert a domain name to an IP Address. On Linux, there is a file called the following: /etc/resolv.conf This file contains the IP [...]

{ 0 comments }