35 votes
Accepted

What is the practical purpose of "./" in front of relative file paths?

This behaviour comes from find, and is specified by POSIX: Each path operand shall be evaluated unaltered as it was provided, including all trailing <slash> characters; all pathnames for other ...
user avatar
11 votes

What is the practical purpose of "./" in front of relative file paths?

There is no practical use when we talk about ordinary files. But when we talk about executable files it make sense. When you execute (and file1 is located in current directory): file1 shell search ...
user avatar
  • 13.9k
5 votes

What is the practical purpose of "./" in front of relative file paths?

Many commands in Linux receive - as a special file denoting stdin, therefore to indicate a file whose name is really - you must use ./-. See Usage of dash (-) in place of a filename What does dash &...
user avatar
  • 1,816
4 votes
Accepted

How can I batch rename all files that match a pattern in Linux?

This will work with perl-rename (called rename or prename or perl-rename depending on your distribution): $ rename -n 's/\[.+?\]//g; s/_//g' *mkv [XVC]_Control_-_10_-_Doctors_[SCB055Y].mkv -> ...
user avatar
  • 219k
1 vote
Accepted

Randomize GIF JPEG and WEBP Filenames

Just needs another for loop to cycle through the extensions. for ext in jpg gif webp; do for img in *.${ext}; do newname="$(head /dev/urandom | tr -dc a-z0-9 | head -c 8).${ext}" ...
user avatar
  • 3,755
1 vote

grep -v [string] for whole folder

You can do: (cd /path && grep -vFe 'string' -- /dev/null *.filetype) > result.filetype Adding /dev/null makes sure the matching lines are prefixed with the file path even if there's only ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible