As per my comment's link (What does the ./ mean (dot slash) in linux?), and as you correctly think, slash (/
) is a directory "representation".
In your two examples, the slash represents different things though:
mv ~/Documents/newfolder ./anothernamefolder
move newfolder
from Documents
located under user home directory (~
), to current directory (./
) and name it anotherfolder
.
In the second one
touch {jan,feb,mar,apr}_{2017..2019}/file{1..100}
you touch files in number of directories.
So for every directory specified in the command: {jan,feb,mar,apr}_{2017..2019}
create files file{1..100}
.
Why there is "/" here? What does it do? Why I can't type:
As above, ./
is representation of current directory.
If you used
mv ~/Documents/newfolder . anothernamefolder
command, you'd get an error, as you'd be specifying ambiguous redirections:
$ mv ~/Documents/newfolder . anotherfolder
usage: mv [-f | -i | -n] [-v] source target
mv [-f | -i | -n] [-v] source ... directory
You could use dot .
to move, but that would simply move folder called newfolder
without changing its name.
$ mv ~/Documents/newfolder .
$ ls
newfolder
/
is but are confused with the dot (.
)