0

I'm trying to list all files and folder in my external HDD, connected to laptop by using command ls -R > abc.txt and I get a message as `bash: abc.txt: Read-only file system . kindly help.

1
  • 2
    If your file-system has flipped to RO (ie. changed from RW ot RO) then a serious error has been detected, and that is a safety measure to avoid data corruption. You should look for the cause & correct it (it's usually fixed by a fsck or file system check). If it was mounted RO, you need to umount (unmount) then mount (re-mount) it RW (read-write), but a RO file-system is a serious warning sign of problems (unless you mounted it RO). You can't save data to a RO file-system (what the READ ONLY means). You can only save data to a file-system mounted as RW or READ WRITE.
    – guiverc
    Nov 21, 2020 at 8:03

1 Answer 1

0

You can execute ls -R on a readonly filesystem, however the file that you are redirecting the output of the command to must be on a writeable filesystem. So in general

ls -R > path/to/writeable/dir/abc.txt

The simplest option is to write to a file in your home directory

ls -R > ~/abc.txt
1
  • Thank you so much for your guidance.
    – Ubundu12IN
    Nov 30, 2020 at 6:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .