Color LS for Mac OX
alias ls='ls -G'
Showing posts with label ls. Show all posts
Showing posts with label ls. Show all posts
Thursday, June 17, 2010
Tuesday, December 16, 2008
Find Usage
"Grep" through each file in a directory:
ls xargs grep -i 'STRING'
List all directories and subdirectories in a directory
find . -type d
List all files in a directory no recursion
# workaround for "parameter list is too long".
find . \( ! -name . -prune \) -name 'STRING*' -print
find . -maxdepth 1 -name 'STRING*' -print # GNU find only
Remove all files in a directory no recursion
# workaround for "parameter list is too long".
find . \( ! -name . -prune \) -name 'STRING*' -print -exec rm {} \;
Find a file with a given inode and delete it
ls -lai # lists the inodes next to the files
find . -inum 12345 -exec rm {} \; # finds and removes by inode
http://www.faqs.org/qa/qa-1381.html
http://sial.org/howto/shell/
ls xargs grep -i 'STRING'
List all directories and subdirectories in a directory
find . -type d
List all files in a directory no recursion
# workaround for "parameter list is too long".
find . \( ! -name . -prune \) -name 'STRING*' -print
find . -maxdepth 1 -name 'STRING*' -print # GNU find only
Remove all files in a directory no recursion
# workaround for "parameter list is too long".
find . \( ! -name . -prune \) -name 'STRING*' -print -exec rm {} \;
Find a file with a given inode and delete it
ls -lai # lists the inodes next to the files
find . -inum 12345 -exec rm {} \; # finds and removes by inode
http://www.faqs.org/qa/qa-1381.html
http://sial.org/howto/shell/
Subscribe to:
Posts (Atom)
