Thursday 5 April 2012

Linux/Unix Command for listing just files in the current directory

Following is the command I recently used to move all the files in the home directory to a directory named others.

$ for i in `ls -l | grep -v '^d' | grep -v '^l' | awk '{print $8}'`; do mv "$i"\* others ; done

No comments:

Post a Comment