3

I am operating as sudo in a system where I mv a great amount of files and dirs to and fro. Is there a command for the combo?

$ sudo -i; # mv hello /home/other; # chown -R other:other /home/other/hello
hhh
  • 50,788
  • 62
  • 179
  • 282

3 Answers3

9

Try the install command (options -o, -g and -m).

Philipp
  • 48,066
  • 12
  • 84
  • 109
0

Something like this ?

david@pcdavid:~$ cat zz
whoami
david@pcdavid:~$ sudo -i "cd /home/david; mv zz yy; chown root yy; sh yy"
root
David V.
  • 5,708
  • 3
  • 27
  • 27
0

Put those commands in a shell script and run the script with sudo.

phantom-99w
  • 928
  • 1
  • 11
  • 22