Last active
December 13, 2019 22:14
-
-
Save dpaluy/8930c8c74b52f0947e81070dbe73df1c to your computer and use it in GitHub Desktop.
Shell useful tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Total number of files in Folder | |
| ls -l FOLDER | egrep -c '^-' | |
| # Rename all files in Folder | |
| for f in *; do [[ -f "$f" ]] && mv "$f" "UNIX_$f"; done | |
| # or | |
| ls | xargs -I {} mv {} Unix_{} | |
| # output files from /dist to filenames.txt | |
| find /dist -type f -maxdepth 1 > filenames.txt | |
| # Copy a big amount of files from source to destination | |
| find source/ -type f -maxdepth 1 -exec sh -c 'mv "$@" "$0"' destination/ {} + | |
| # list files and directories | |
| ls -d "$PWD"/* > result.txt | |
| # sort directories by size | |
| sudo du -sh * | sort -hr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment