MacOS – OS X Terminal: ‘ls’ with ‘grep !’

macosterminal

I would like to list all files in folder without one. I created this command ls /Users/MyName/Library/Safari | grep ! "Extensions". The problem is that the Terminal doesn't understand the not (!). How to change that it works?

Thanks!

Best Answer

You might do it like this:

ls /path/to/folder | grep -v "Extensions"

grep -v "Extensions" excludes "Extensions" from the listing.