Useful Linux Commands

List files not containing “string”. I know this one is simple, but I always end up using grep -c|grep “:0″|sed
grep -L string filelist

Linux list files only (or directories only)
So I had solved this problem multiple different ways, and always seemed to be foiled by different versions of ls, awk, grep, or whatever else I was using to solve what I think is a pretty simple problem. This is the simplest solution I’ve come up with, it’s great for piping output to whatever else you want.

#ldir list directories
alias ldir=’ls -p | egrep “/”‘
#lfo list files only
alias lfo=’ls -p | egrep -v “/”‘


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: