Skip to content

Instantly share code, notes, and snippets.

@myfavouritekk
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save myfavouritekk/d5b2fa93c952aea7cbd7 to your computer and use it in GitHub Desktop.

Select an option

Save myfavouritekk/d5b2fa93c952aea7cbd7 to your computer and use it in GitHub Desktop.
Dealing with large number of files
# Quickly count, -f disable sorting, adding . and ..
ls -f directory | wc -l
# Quickly remove files
rsync -a --delete empty_directory/ directory/
find directory -delete
# Quickly copy files
rsync -a source/ target/
# Copy list of files
rsync -a --files-from=/path/to/file-list source target
# Replace scp
rsync -av --progress source remote:target/
rsync -av -e 'ssh -p port_number' source remote:target/
# Grep large files in parallel
parallel --pipe grep 'pattern' < bigfile.txt
parallel --pipe grep -f patterns.txt < bigfile.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment