Skip to content

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

TheSoftwareProgrammer View All

I like science and writing software.

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: