LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I do a directory listing on a usb drive? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-do-a-directory-listing-on-a-usb-drive-858367/)

cajunchief 01-24-2011 10:18 AM

How can I do a directory listing on a usb drive?
 
I have a usb drive which I will call it "mydrive" for this discussion.
I am trying to get to it so I can do a ls -al on the usb device itself.

But I'm not sure how to get to the dir entry for the device. HELP! :)

juicer 01-24-2011 10:22 AM

I suppose the USB is mounted already.

if you exec the 'mount' command, you can see the mounted devices and where they are.

Then you only have to 'cding' into the root device directory to do the listing.

reed9 01-24-2011 10:32 AM

Right. The key is where is it mounted? If you're using a DE like GNOME or KDE, generally you're going to have mountpoint automatically created for you in /media, based on the label of the partition. So if it was labeled mydrive, it ought to appear as /media/mydrive. Then just do
Code:

ls -al /media/mydrive

cajunchief 01-26-2011 11:33 AM

PROBLEM RUNNING ls -al command?
 
I ran the mount command and this is what i got:

[ryan@cajunchief ~]$ mount
/dev/mapper/vg_cajunchief-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg_cajunchief-lv_home on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemon on /home/ryan/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ryan)
/dev/sdb1 on[COLOR="Red"] /media/mydrive type vfat (rw,nosuid,nodev,uhelper=udisks,uid=500,gid=500,shortname=mixed,dmask=0077,utf8=1,flush)

then I ran the command 'ls -al /media/mydrive' and the error i got was:
ls: cannot access /media/mydrive No such file or directory

Why am I getting this? and what do I do?

petebow4 01-26-2011 11:51 AM

Can you try mounting the drive yourself?

Code:

sudo umount /media/mydrive

sudo mount -t vfat /dev/sdb1 /media/mydrive

then try
Code:

ls -lta /media/


All times are GMT -5. The time now is 07:49 PM.