How to easily manipulate long paths in Linux

I found this little gem a while ago and a coworker identified it as useful too, so I’m posting it:

Let’s say you want to copy a file from a different directory to a new file in that same directory but don’t want to change to that directory, and the path is really long…

cp /my/very/long/path/to/{old_file,new_file}.cpp

This will copy /my/very/long/path/to/old_file.cpp to /my/very/long/path/to/new_file.cpp

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s