A repo containing useful commands and scripts.
All scripts can be found inside the scripts folder.
Script | Description |
---|---|
incremental_number_renamer.sh | Rename all files in a given directory to incremental numbers, based on the amount of files present. Examples: - 10 files will be renamed from 01.xx to 10.xx - 100 files will be renamed from 001.xx to 100.xx |
suffix_renamer.sh | Given a directory, this script adds a given suffix to all file names in a given range. The range is determined on the files ordered lexicographically |
find_files_from_list.js | Given a list of file names and a directory with files find all the files matching in the directory matching the file name in the list |
image-sorter-by-aspect-ratio.sh | Sort all the images in /imgs into separate folders by their aspect ratio |
A list of useful commands
Command | Description |
---|---|
du -h /dir |
Outputs the space usage of all files in all subdirectories recursively |
du -h /dir --max-depth=1 |
Same as above, but it stops at one folder deep |
df -h |
Outputs the overall space usage in human readable format |
history |
Prints the last x commands, where x is defined by HISTSIZE in ~/.bashrc . Each command is printed on a new line with the format<line-number> <command> |
history | grep " |
As above, but it prints only the commands containing the <search> string |
!<line-number> |
Usually used after running history . It runs the command that can be found at the given <line-number> of the history output |
!<string> |
Runs the last command starting with the given <string> . Example: $: echo "123" 123 $: !e echo "123" 123 |
service nginx stop;certbot renew --quiet;service nginx restart |
Stop the server, renew certificates and restart the server |