I’m used to running the cp command in Linux often. But, this time a client had an emergency and I needed to use the cp command to overwrite a directory in their Red Hat Linux box.

I needed to login with root for this one. I needed to restore a directory to it’s original location using the cp command to overwrite the old corrupted one. In the terminal I ran:

cp -rf /data/restore/restored-dir/var/www/cms/ubi /var/www

And got prompted to confirm the overwrite for each file:

cp: overwrite ‘./ubi/index.html’?

It sucks to have to confirm thousands of files even when you’re logged in as root! Why? I ran to the kitchen and brew myself a nice cup of coffee from Guatemala.

Then, I found out that root in Red Hat Linux has an alias for the cp command:

which cp

and got:

which cp comamnd

In order to escape this alias in Linux I had to run the same command previously, but with an added ‘ / ‘ in front of the cp command:

/cp -rf /data/restore/restored-dir/var/www/cms/ubi /var/www

Now, all works. I was able to copy the restored files.

You can always contact me if you have any questions. Also, make sure to visit my coffee mugs and T-Shirts shop for inspiration.

Leave a comment

Your email address will not be published.