2

This could be quite a simple one, but I can't find any answer for it.

If I am in a terminal and use the cp command, is there a way of instantly cding to the target directory? For example, is there some equivalent to cp foo/file.ext ../bar/subdir/; cd ../bar/subdir/ that doesn't require retyping the path to the target folder?

1 Answer 1

5

You can do:

cp foo/file.ext ../bar/subdir/

followed by:

cd !$

But this won't work in one line, like cp foo/file.ext ../bar/subdir/; cd !$.

1
  • Perfect, this is exactly what I was looking for (it being on one line wasn't really a factor, just wrote it like that to keep the question neat). Ta very much!
    – Jez W
    Jun 12, 2013 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .