LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-07-2008, 09:26 AM   #1
elthox
Member
 
Registered: Oct 2006
Posts: 41

Rep: Reputation: 15
how to list the contents of CD?


Hi guys,

I want to browse the contents of CD throught command line. What have to be done? Some kind of mounting first?

Please help me
 
Old 05-07-2008, 09:44 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Yup, mounting. Something like this (assuming the cdrom device is /dev/cdrom - it could be /dev/hdc or something instead; also let's assume you'll be mounting it to /media/cdrom which exists already)
Code:
mount /dev/cdrom /media/cdrom
If that gave no output, it succeeded. Then just
Code:
ls /media/cdrom
to see what's inside.
To unmount the cd, make sure your current working directory is not the mount directory (so you're not in the cd's directory - run 'cd' to make sure, if you want) and
Code:
umount /media/cdrom
 
Old 05-07-2008, 09:45 AM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
First mount it:

Code:
mount -t iso9660 -o ro /dev/cdrom /home/folder-where-you-want-to-mount-it
then you can just 'cd' into it.
 
Old 05-07-2008, 09:46 AM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Put the CD in the drive, then type:
Code:
$ sudo mount -t iso9660 /dev/[device node] /mnt
Once it's mounted:
Code:
$ ls /mnt | more
EDIT: Everyone can type faster than I can.
 
Old 05-07-2008, 09:52 AM   #5
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Rep: Reputation: 16
yes, you have to mount it first. mounting means to attach a filesystem from a removeable disk or so to the filesystem tree of your root partition. the system needs to know three things in order to mount something succesfully:

1. what kind of filesystem do you intend to mount?
2. where is that filesystem located?
3. where to attach the foreign filesystem/file tree to your native one?

thus the mount command needs three arguments. the syntax is like this: mount -t TYPE FROM WHERE. the WHERE is usually the /mnt directory. modern distros though have a /media directory where they mount stuff. it doesn't really matter. pick one. but beware once you mounted something in a directory the former content of it is not accesible as long as the cd/dvd is mounted. follow these steps ('#' is the root prompt and '$' the user prompt):

1. insert cd/dvd
2. make sure you know which device your cd/dvd is (usually /dev/hdc or /dev/hdd)
3. pick a mount directory (here: /mnt)
4. do:
Code:
# mount -t iso9660 /dev/hdc /mnt
the option -t specifies the filesystem type. for cd/dvd this is iso9660. /dev/hdc is the your cd/dvd device...

5. now the content of your cd/dvd is displayed in /mnt (or whereever you mounted it). do for example:
Code:
$ cd /mnt
$ ls
NOTE: you can't simply hit the open button on your cd/dvd drive to remove the cd/dvd. you must unmount the cd/dvd first. to unmount a filesystem your linux needs to know only one thing. WHERE the file tree is. so it's sufficient to do:
Code:
# umount /mnt
note that the command is NOT unmount BUT umount. now you should be able to remove the cd/dvd

EDIT: i wasn't faster! damn

Last edited by vadkutya; 05-07-2008 at 09:54 AM.
 
Old 05-07-2008, 10:07 AM   #6
elthox
Member
 
Registered: Oct 2006
Posts: 41

Original Poster
Rep: Reputation: 15
THank you all for your detailed answers
 
  


Reply


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
Tried but in vain to list contents of a directory rs_vijay Programming 3 01-17-2007 04:59 PM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 05:02 AM
Cannot List Contents of USB Filesystem eljefe7000 Linux - Hardware 4 05-23-2006 02:53 PM
cannot list directory contents kpachopoulos Linux - General 2 11-29-2005 06:24 PM
won't list contents of cdrom gillmb Linux - Newbie 2 10-19-2004 03:09 PM


All times are GMT -5. The time now is 03:15 AM.

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