Saturday, September 10, 2011

To give a listing of hidden directories


ls -al | grep "^d" | grep "\." | tr -s " " | cut -d" " -f8

The "ls" lists all files. The first grep chooses the directories only and not files. Remove this to select hidden files too. The second grep selects hidden files - files tarting with a “dot”. It has to be escaped with \ otherwise it matches all characters. tr compresses extra spaces in the listing. “cut” selects the last column which is the hidden directory names. Without the tr compressing the delimiting spaces “cut” will mistake extra spaces to be new columns so the penultimate step is crucial.

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...