I wanted to search all the files starting with
/var directory. So I executed this
$ ls -R | grep "^chrom"
To my astonishment, It showed this. Few starting lines look like this :
amit@ElMaverick:/var$ ls -R | grep "^chromium" chromium-browser_55.0.2883.87-0ubuntu0.16.04.1263_amd64.deb chromium-browser-l10n_55.0.2883.87-0ubuntu0.16.04.1263_all.deb chromium-codecs-ffmpeg-extra_55.0.2883.87-0ubuntu0.16.04.1263_amd64.deb ls: cannot open directory './cache/apt/archives/partial': Permission denied ls: cannot open directory './cache/cups': Permission denied ls: cannot open directory './cache/ldconfig': Permission denied chromium-browser_chromium-browser.png chromium-browser_chromium-browser.png chromium-bsu_chromium-bsu.png chromium-browser_chromium-browser.png ls: cannot open directory './lib/apt/lists/partial': Permission denied ls: cannot open directory './lib/bluetooth/78:0C:B8:46:10:D5': Permission denied chromium-browser.conffiles chromium-browser-l10n.list chromium-browser-l10n.md5sums chromium-browser.list chromium-browser.md5sums chromium-browser.postinst chromium-browser.prerm chromium-codecs-ffmpeg-extra.list chromium-codecs-ffmpeg-extra.md5sums ls: cannot open directory './lib/mysql': Permission denied ls: cannot open directory './lib/mysql-files': Permission denied
I don't want to see these lines in the output.
ls: cannot open directory
So, I have 2 questions here :
- How to filter only those lines which have no error of any type ?
- Is there a way to supress the specific lines of output ?
Please provide a general approach for the problem, not just specific to this question.