Write to file forbidden
Smoot Carl-Mitchell
smoot at tic.com
Sun Mar 15 14:17:40 UTC 2009
On Mon, 2009-03-16 at 00:47 +1100, GaryT wrote:
> To obtain a recursive listing of all files, I'll use the command
> ls -s -S -R
> from the root directory.
>
> BUT
> When attempting to capture that list by saving it to a text file, I get
> "permission denied"
> e.g. ls -s -S -R >files.txt
>
> adding sudo makes no difference
> using gksudo also makes no difference.
>
> please, how does one overcome the problem?
The redirect is opening the output file in the / directory before the
sudo command is executed. Redirects are handled by the parent shell and
not by sudo. Try it from your home directory. e.g.
sudo ls -sSR / >files.txt
--
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005
More information about the ubuntu-users
mailing list