How do I perform commands in another folder, without repeating the folder path?

Posted by Valter Henrique on Super User See other posts from Super User or by Valter Henrique
Published on 2013-05-17T12:22:17Z Indexed on 2013/11/02 9:59 UTC
Read the original article Hit count: 223

Filed under:
|
|
|
|

Is there a clever way to do copy and move operations or a command to duplicate a file, without having to do a cd, then mv after, at the same folder?

For example, I have to run the following:

mv /folder1/folder2/folder3/file.txt /folder1/folder2/folder3/file-2013.txt

Note that the directory to where I'm moving the file is the same, but I have to put the whole path again and sometimes it gets annoying. I'm curious to know if there's another way to do that without having to put the whole path again, because the operation would be done in the same path.

© Super User or respective owner

Related posts about linux

Related posts about command-line