List Directory Only in Bash

To list directory only in Bash using ls use:

ls -d */

from bash help:

-d, –directory will list directories themselves, not their contents

and */ means match all files and sub directories.

so to list all sub directories under /dir/subdir/, you can use:

ls -d /dir/subdir/*/

Similarly, to list all directories including hidden one use:

ls -d .*/ */

Redirect Using htaccess

To redirect using .htaccess file use the following code

Redirect 301 /

Or use this to redirect only specific page

Redirect 301 /old-url

Change 301 (permanent) with 302 (temporary) to suit your need.

Fix ”Google Play Authentication is Required” Error

If you have this problem, you can try to clear data and cache for google play store. Follow the following steps if you don’t know how.

  1. Go to Settings -> Application or Application manager on some
  2. From there select on google play store
  3. Tap the clear cache and clear data button
  4. Close and reopen google play store

The error should be gone by now.

Exporting large database on phpMyAdmin

Exporting large database from most web hosting company can be quite problematic due to their server timeout limit setting.

To get around this problem one alternative solution is to check which table has the most size and export it individually, then you can export the rest of the table by excluding the one you already exported it before.

MySQL Basic Command Cheat Sheet

# Create user
CREATE USER 'username'@'hostname' IDENTIFIED BY 'mypassword';

# Show user
SELECT username FROM mysql.user;

# Grant privilege
GRANT ALL PRIVILEGES ON *.* TO 'username'@'hostname';
GRANT SELECT, INSERT, UPDATE, DELETE ON database.table TO 'username'@'hostname'

# Revoke / remove privilege

# Dump data
mysqldump -h hostname -u root -p databasename > filename.txt

# Import data
mysql -u username -p databasename < sqlfile.sql

# Alter to fulltext
ALTER TABLE tablename ADD FULLTEXT(fieldname);

# Alter character set and collation, CONVERT change all columns
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

# Show character set of a table

# Show table option when creating that table

# Show all table status

Android Phone Navigation Key Not Working

Recently my Android phone navigation key stopped working, and factory reset didn’t do any good at all.

If you have this problem, and in need of a quick fix you can try this temporary solution.

  1. Access Playstore
  2. Search for “button savior”
  3. choose one and install

After installation, a list of navigation button would be available on the side of the screen. Depending on which app you install it can be on the right / left / bottom of the screen. You can use this button as a temporary replacement for the original android navigation button (until you can fix the real problem that is).