Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-24-2011, 11:18 AM   #1
Registered: Sep 2010
Posts: 220

Rep: Reputation: 0
Wink 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!
Old 01-24-2011, 11:22 AM   #2
LQ Newbie
Registered: Dec 2005
Location: Spain
Distribution: suse
Posts: 4

Rep: Reputation: 0
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.
Old 01-24-2011, 11:32 AM   #3
Registered: Jan 2009
Location: Boston, MA
Distribution: Arch Linux
Posts: 653

Rep: Reputation: 142Reputation: 142
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
ls -al /media/mydrive
Old 01-26-2011, 12:33 PM   #4
Registered: Sep 2010
Posts: 220

Original Poster
Rep: Reputation: 0
Cool 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_ubject_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?
Old 01-26-2011, 12:51 PM   #5
LQ Newbie
Registered: Sep 2005
Location: West Hartford, CT
Distribution: Ubuntu
Posts: 19

Rep: Reputation: 2
Can you try mounting the drive yourself?

sudo umount /media/mydrive

sudo mount -t vfat /dev/sdb1 /media/mydrive
then try
 ls -lta /media/


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Device Notifier not listing 2nd external usb drive geb Slackware 8 08-22-2010 03:17 PM
Usb drive, how to locate it, how to move folder from Usb drive to usr directory eeguy02 Linux - Newbie 5 03-01-2010 12:23 AM
[SOLVED] RHEL5 Apache Directory Listing for a directory thorinn Red Hat 8 02-02-2010 10:01 AM
Help me use a external USB drive for my /home directory spydyee Linux - Hardware 13 01-20-2010 07:17 AM
Apache Directory Listing Of NFS Mount, cannot view directory list via apache luqmana Linux - Networking 2 12-19-2005 07:03 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration