You need to escape '
, since, as you have also mentioned, single quotes ('
) are special characters in Bash (which is most likely the shell your terminal uses). To escape a character you can use the escape character \
right in front of it. So, for example, to rename grandpa's_pen.mp4
to grandpas_pen.mp4
you should run:
mv grandpa\'s_pen.mp4 grandpas_pen.mp4
Alternatively, you can use double quotes ("
) around the files that have single quotes. The above example would be in that case:
mv "grandpa's_pen.mp4" grandpas_pen.mp4
Note:
You said:
For example, when I try to rename grandpa's_pen.mp4
to grandpas_pen.mp4
, the action takes too much time.
In this case that action does not take too much time. Simply, the command has not even run!
That's because when single quotes and double quotes are used as special characters, that is when they are used without being escaped, they are expected by the shell to be in pairs.
In your case, grandpa's_pen.mp4
has one unescaped single quote, so when you press Enter to run your command, the shell gives you a new prompt, in which you could type more text, and waits until you enter a closing single quote. Only if you enter that closing single quote and press Enter will the command run, which is almost certain to return an error.