Coders Tent

Server Admin's Diary

Category: Ashik Daily Need

Move site https to http by .htaccess

# Redirect HTTPS to HTTP
# Canonical HTTPS/non-WWW

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} on
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

How to find a folder in Linux using the command line

You can use find and locate commands in Linux to find folders and files from the command line. This page shows how to search for folders in Linux using various command line utilities.

Command to find a folder in Linux

find command – Search for files and folder in a directory hierarchy
locate command – Find files and folders by name using prebuilt database/index

How to find folder on Linux using find command

The syntax is:
find /where/to/look/up/ criteria action
find /folder/path/to/look/up/ criteria action
find /folder/path/ -name “folder-name-here”
find /search/path/ -name “folder-name-here” -print
find /search/path/ -name “folder-name-here” -ls
find /folder/ -name “pattern”
Finding a folder named Documents

Example : find /home -name “phlox-pro”

To find a folder named “Documents” in your home directory ($HOME i.e. /home/vivek/ home directory), run:
find $HOME -type d -name “Documents”

OR
find ~ -type d -name “Documents”

OR
find /home/vivek/ -type d -name “Documents”

How to search for case incentive folder names

You can force find command interpret upper and lowercase letters as being the same. For example match Documents, DOCUMENTS, DocuMEnts and so on by passing the -iname option:
find $HOME -type d -iname “Documents”

OR
find ~ -type d -iname “Documents”

OR
find /home/vivek/ -type d -iname “Documents”

Reset SSH config from WHM?

There is, login to WHM using the non-SSL port 2086 and then change the URL to:

http://your-ip:2086/scripts2/doautofixer?autofix=safesshrestart

It makes your SSH configuration default.

How to to know SSH port on the cPanel server?

Steps to know SSH port of cPanel server –

1. Login to WHM with your login details.
2. Go to restart servicees.
3. Restart SSH server. Once service get restart you will get below information –
Waiting for “sshd” to restart ………waiting for “sshd” to initialize ………finished.
Service Status
sshd (/usr/sbin/sshd) running as root with PID 904715 (process table check method)
Startup Log
Starting sshd: [ OK ]
Log Messages
Apr 6 05:48:40 server sshd[904715]: Server listening on :: port 8872.
Apr 6 05:48:40 server sshd[904715]: Server listening on 0.0.0.0 port 8872.
Apr 6 05:48:39 server sshd[4031]: Received signal 15; terminating.
sshd restarted successfully.
That’s it!

In the above output, you can see 8872 is the SSH port.