In bash_aliases file can set alias to command or scripts for automate
proccess in the linux box administration is under home directory as a
hidden resource and runs at start of the system to reload need source it
with
aliasfind-tools='find-tools'functionfind-tools(){# URL_SOURCE https://stackoverflow.com/a/29754866/5090696
getopt--test>/dev/null
if[[$?-ne4]];thenecho"I’m sorry, `getopt --test` failed in this environment."exit1fiOPTIONS=dm:fo:v
LONGOPTIONS=delete,mimetype:,force,output:,verbose
# -temporarily store output to be able to check for errors# -activate advanced mode getopt quoting e.g. via “--options”# -pass arguments only via -- "$@" to separate them correctlyPARSED=$(getopt--options=$OPTIONS--longoptions=$LONGOPTIONS--name"$0"--"$@")if[[$?-ne0]];then# e.g. $? == 1# then getopt has complained about wrong arguments to stdoutexit2fi# use eval with "$PARSED" to properly handle the quotingevalset--"$PARSED"# now enjoy the options in order and nicely split until we see --whiletrue;docase"$1"in-d|--delete)d=y
shift;;-f|--force)f=y
shift;;-v|--verbose)v=y
shift;;-o|--output)outFile="$3"shift2;;-m|--mimetype)mime="$2"shift2;;--)shiftbreak;;*)echo"Programming error"exit3;;esacdonemimetypes=$(sed-E's/\/.*//g; /^$/d; /^#/d'/etc/mime.types|uniq)echo"arguments are $1 , $mime"ext=$(sed-E"/^${mime}/!d; s/^[^ \t]+[ \t]*//g; /^$/d; s/ /\n/g"/etc/mime.types|sed-Ez's/\n$//; s/\n/\\|/g; s/(.*)/\.*\\.\\(\1\\)\n/')# handle non-option argumentsif[[$#-ne1]];thenecho"Usage: ${0##*/} -m <mimetype> --delete <path/to/files>."# echo "Usage: ${0##*/} -m=<mimetype>"echo"Available mimetypes:"echo"$mimetypes"# exit 4fi# init the programif[[$1]];thenif[[$d]];thenfind"$1"-typef-regex"$ext"|fzf-m|xargs-d'\n'-I{}rm-v{}fielseecho"verbose: $v, force: $f, mimetype: $mime, delete: $d, in: $1, out: $outFile"fi}
how this works :
for search and delete files with mimetype=audio do
find-tools--delete-maudio./music/
Select multiple items with tab and Deselection with Shift+tab
If you want visualize music with another user like www-data for delete them
sudo-uwww-databash
# then logged as www-data usersource/home/<username>/.bash_aliases
find-tools-maudio--delete./data/