Manage Your Own Server

scp, rsync: Transfer Files between Remote Servers via SSH

Chances are you have a bunch of different hosts that are housing your website files, for the sake of data safety (never put all eggs in a single basket) and possibly some SEO advantage. If that is the case, you will infrequently come to the need to move some files from one host server to …

scp, rsync: Transfer Files between Remote Servers via SSH Read More »

Linux: Find files changed or modified within xx day or older than xx day

One of the utility commands of Linux that you should know in the first day of your Linux learning seminar is find. To search recursively in the directory somedir for files changed / created / modified within 1 day: find somedir -ctime -1 Or within 5 days: find somedir -ctime -5 To search recursively in …

Linux: Find files changed or modified within xx day or older than xx day Read More »

Linux: Change Directory or CD to the Previous Directory / Last Path

cd is the command in Linux to change the current working directory. While you can change to your home directory by cd ~, you can change to the previous directory or last directory you were in by: cd – Which would come very handy when you are working across multiple directories back and forth. To …

Linux: Change Directory or CD to the Previous Directory / Last Path Read More »

Linux: Check how much disk storage each directory takes up (Disk Usage command – du)

The Linux command du stands for disk usage which is used to check the amount of disk storage any particular directory or file is using. By default, the simple command: du Would return the disk usage in God-knows-what-unit of each of the directories in the current working directory and those beneath them — in a …

Linux: Check how much disk storage each directory takes up (Disk Usage command – du) Read More »

Linux: How to find all the files containing a particular text string?

At Linux command line, to find a particular text string in all the files from the current directory recursively (that is, including all those files from the child or grandchild directories), use something like this via SSH: find . -exec grep -l "needle" {} \; This command searches through all directories from the current directory …

Linux: How to find all the files containing a particular text string? Read More »

Linux wget Command to Download and Mirror a Website in Static Local Copy

wget is such a wonderful command in Linux you can ever get. Consider blessed to have it in your SSH arsenal. Now, not only does it allow you to download something neatly from the command line to the current working directory — that’s why WordPress always puts the latest version of the blog script at …

Linux wget Command to Download and Mirror a Website in Static Local Copy Read More »

How to Recover or Reset MySQL root Password after You Forgot and Lost It

MySQL has come with a safe mode wherein access privileges are not checked, which essentially enables you to log in anonymously to change anything in any database. And we are going to get in this safe mode to reset the lost MySQL root password. First, you need to stop the current MySQL daemon by: /etc/init.d/mysql …

How to Recover or Reset MySQL root Password after You Forgot and Lost It Read More »

Best Books of Apache Web Server to Learn Apache and Use It

As the most popular web server for hosting websites, Apache is second to none. It thrives for a reason, that is, it’s versatile and adapts to all situations and answer to even the slightest demands of a website. Below are some books from Amazon about administering Apache that may give you a new perspective and …

Best Books of Apache Web Server to Learn Apache and Use It Read More »

Linux, PHP: Differences between File Modification Time: filemtime() and File Change Time: filectime()

In most Unix file systems, the modification time and the change time of a file may not necessarily be the same, they are actually 2 very distinct concepts to deal with: File modification time represents when the data blocks or content are changed or modified, not including that of meta data such as ownership or …

Linux, PHP: Differences between File Modification Time: filemtime() and File Change Time: filectime() Read More »

Apache, PHP: Get Client Browser HTTP Request Headers Information

Every HTTP requests made by any client web browsers to an Apache should conform to the HTTP specification and provide certain set of headers information for the server to parse and understand. Useful headers information that can be retrieved in PHP by function apache_request_headers() includes: User-Agent: Operating System, browser and its version number, … Accept-Language: …

Apache, PHP: Get Client Browser HTTP Request Headers Information Read More »

Apache, PHP: Function to Get and Return PHP Version Number and Apache Version

To get the PHP version as well as the Apache version of the current host build, you will need the PHP function apache_get_version(): $ver = apache_get_version(); Sample output: Apache/2.2.6 (Win32) PHP/5.2.5 Which returns a string containing the Apache version number (2.2.6) as well as that of PHP (5.2.5). You can also get the PHP version …

Apache, PHP: Function to Get and Return PHP Version Number and Apache Version Read More »

Apache, PHP: Get Apache Enabled Modules in PHP Dynamically and Detect if a Apache Module is Installed

Sometimes you will need to detect if a certain Apache module is installed dynamically from PHP so as to determine for proper actions to take. For example, if you write inherent functionalities for optional SEO friendly URLs, you will want to know if the client host has the famous Apache module mod_rewrite installed and enabled, …

Apache, PHP: Get Apache Enabled Modules in PHP Dynamically and Detect if a Apache Module is Installed Read More »

Where is php.ini located?

Well it depends on the Linux distribution you are using, the version of php and the way you install it with Apache web server. Php.ini may be here: /etc/php.ini Or here: /etc/php/php.ini /etc/php5/php.ini Or here: /usr/bin/php5/bin/php.ini Anyway, you can always find any file named php.ini in this manner find / -name php.ini The simplest yet …

Where is php.ini located? Read More »

Accidental Ctrl+S Locks and Freezes Linux Terminal / SSH / Telnet

Ctrl+S happens to be a rather handy and popular combination as it’s used in Windows applications to save your current working data. I accidentally used it several times in Vim and it keeps locking the screen up and halting the interactivity — basically, after Ctrl+S I can’t do anything to the terminal (window). I use …

Accidental Ctrl+S Locks and Freezes Linux Terminal / SSH / Telnet Read More »

How to change Vim syntax highlighting colors?

Unbuntu has auto-configured Vim to use syntax highlighting for text (mostly, programs and configuration files of course) editing, the problem however, is that some of the colors appear to be darker than wanted on SSH console and it’s a little hard to recognize comfortably. So how can we change the default colors of the syntax …

How to change Vim syntax highlighting colors? Read More »

Linux: The differences between file times: atime (accessed time), ctime (changed time) and mtime (modified time).

Unless you have explicitly opted out with a noatime option mounting your Linux file system, there are generally 3 types of time on each and every file of Linux: atime or access time, ctime or change time, and mtime or modification time. These are the differences between the 3 file system times: atime — access …

Linux: The differences between file times: atime (accessed time), ctime (changed time) and mtime (modified time). Read More »

Scroll to Top