M BUZZ CRAZE NEWS
// general

How do I use a sudo command line to copy a folder into the system files?

By Sarah Rodriguez

Specifically, my "themes" folder has been corrupted (my fault), and I need to replace the entire folder with a backup that I made.

I will add a finalized answer once I can.

0

3 Answers

It would go something like this:

sudo cp -r /path-to-backup/themes /usr/share/

cp is the copying command

-r is there for recursiveness

6

Passing the command to execute to sudo without any additional arguments will execute it as root.

sudo cp ...

A very elegant form is using -a option, it will recurse as -r, but will keep all attributes of the files, particularly permissions, and symlinks underreferenced:

sudo cp -a /path-to-backup/themes /usr/share/

In another words, "When performing the copy, attempt to preserve as much of the original file structure, attributes, and associated metadata as possible." (citation source)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy