I have a file in a very long path, for example:
I want to copy the file in this directory:
cp /opt/very/long/path/file1 /opt/very/long/path/file2
I don't want repeat this long path. I can go to the destination folder and copy:
cd /opt/very/long/path/ cp file1 file2
But I don't want change directory. One of the reason is: if I had many long paths I would have to go to directories every time.
cd /opt/very/long/path/ cp file1 file2 cd /opt/other/very/very/long/path/ cp fileA fileB
Another reasons are: I want to keep context and clear history (every command says what and where was copied).
Therefore, better is not change directory:
cp /opt/very/long/path/file1 /opt/very/long/path/file2 cp /opt/other/very/very/long/path/fileA /opt/other/very/very/long/path/fileB
But I have to repeat paths.
There is a shortcut like this?
cp /opt/very/long/path/file1 ./file2 cp /opt/other/very/very/long/path/fileA ./fileB
But a dot
. means "current directory". There is any character that means "destination directory" or "source directory"?
cp /opt/very/long/path/file1 <destination>/file2 cp /opt/other/very/very/long/path/fileA <destination>/fileB