Tuesday , 24 January 2017
Home » Linux Basics

Linux Basics

How to Change & Set the Default crontab Editor

  Most hardcore command line users and unix geeks love vi, but I prefer nano. If you want to change your default crontab editor to nano, here’s how to do this:   For a one time edit, launch the terminal and type: EDITOR=nano crontab -e If you want to set nano as your default editor in general, you use this command: export EDITOR=/usr/bin/nano …

Read More »

Linux / Unix: Sed Substitute Multiple Patterns [ Find & Replace ]

I’m using the date +’%D_%T’ to store Unix system date and time in a shell variable called $_now: _now=”$(date +’%D_%T’)” echo $_now Outputs: 01/20/12_16:10:42 I’d like to replace / and : with _. I’m aware of the following sed command: sed ‘s/\//_/g > s/:/_/g’ <<<“$_now” Outputs: 01_20_12_16_14_09 How do I specify two pattern within the same sed command to replace | and : with …

Read More »

How To Install APF Firewall on Cpanel

Advanced Policy Firewall, or APF, is basically an interface to iptables, which is the standard interface to managing network ports on Linux machines. Interacting with iptables can be complex and error-prone, and APF greatly simplifies working with it. However, APF is still only accessible by ssh. There is no way to make changes in APF through WHM or cPanel. All of the APF configuration files are located in the /etc/apf folder …

Read More »

CentOS Linux install and configure NTP to synchronize the system clock

Q. How do I install and configure NTP under CentOS Linux 5 server to synchronize the system clock? A. You can easily install NTP (Network Time Protocol, a means of transmitting time signals over a computer network) using yum command under Redhat or CentOS/Fedora core Linux. Procedure Login as the root user Type the following command to install ntp # …

Read More »

cPanel: Apache + PHP FastCGI Data Timeout Error

If you are run on cPanel server and have FastCGI enabled in Apache, you might facing following error which caused your website hang or prompting ’500 Internal Server Error’ message. When checking into/etc/httpd/log/error_log, you will see something similar as below: [warn] .. mod_fcgid: read data timeout in 40 seconds, ... [error] .. Premature end of script headers: index.php ... This …

Read More »

CentOS and RHEL 7 Restart, Stop, Start Networking Commands

I recently installed CentOS Linux version 7 or Red Hat Enterprise Linux version 7. How can I restart networking service using command line options? How can I start / stop and restart networking service on a CentOS/RHEL 7 based system?CentOS 7 / RHEL 7 / Fedora Linux (many other modern distor) uses Systemd. It is a system and service manager …

Read More »

UNIX Date Command Examples

How do I view and set date under UNIX operating systems? The date command under UNIX display date. It is also used to set date and time. You must be the super-user (root) to change the date and time. UNIX Date Command Syntax date date "+format" Task: Display Current Date and Time Type the following command: date Sample outputs: Tue …

Read More »