Linux: copy folder from one user to another

  • Thread starter huntflex
  • Start date
  • Tags
    Linux
In summary, you can easily copy a folder from one user to another on Linux using the `cp` command. The syntax for copying a folder from one user to another on Linux is `cp -r /path/to/source/folder /path/to/destination/folder`, and you can use the `rsync` command to preserve permissions while copying. Hidden folders can also be copied using the `cp` command with the `-a` or `-R` flags. While GUI options are available, using the command line is often more efficient for this task.
  • #1
huntflex
27
0
Hello,

I'm having trouble copying some folders from one user to another. I've attempted something like this:

cp -r /olduser/folder ./newuser/folder

it just tells me no such file or directory
Can anybody please help ?

Thank you
 
Physics news on Phys.org
  • #2
Don't you mean /newuser/folder?
Or ~newuser/folder, if you want to put it in their homedir?
Or ~newuser, if you don't want it in ~newuser/folder/folder?
 

FAQ: Linux: copy folder from one user to another

Can I copy a folder from one user to another on Linux?

Yes, you can easily copy a folder from one user to another on Linux using the cp command. This command allows you to copy files and directories from one location to another.

What is the syntax for copying a folder from one user to another on Linux?

The syntax for copying a folder from one user to another on Linux is cp -r /path/to/source/folder /path/to/destination/folder. The -r flag indicates that the folder should be copied recursively, meaning all subdirectories and files will also be copied.

How can I copy a folder from one user to another with permissions preserved?

You can use the rsync command to copy a folder from one user to another while preserving permissions. This command is commonly used for synchronizing files and directories and has an option for preserving permissions using the -a flag.

Can I copy a hidden folder from one user to another on Linux?

Yes, you can copy hidden folders using the cp command by specifying the -a flag, which preserves all files, including hidden ones. You can also use the -R flag, which is equivalent to -a and will also copy hidden folders and their contents recursively.

Is it possible to copy a folder from one user to another on Linux using the GUI?

Yes, most Linux distributions have a built-in file manager that allows you to copy and paste folders from one user to another. You can also use third-party file managers such as Nautilus, Dolphin, or Thunar to copy folders between users. However, using the command line is often faster and more efficient for this task.

Similar threads

Replies
4
Views
1K
Replies
3
Views
1K
Replies
1
Views
2K
Replies
20
Views
2K
Replies
9
Views
1K
Replies
17
Views
5K
Back
Top