LinuxQuestions.org
Help answer threads with 0 replies.
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 03-27-2007, 09:18 AM   #1
conrad13
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
Smile newbie at redhat linux


Can anybody give me samples codes on how to use shell prompt.I do not know how to copy files from cd-rom and move it to another folder. Tnx hpoe that you can help me.
 
Old 03-27-2007, 09:28 AM   #2
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: My HDD...
Distribution: WinXP for designing, Linux for life.
Posts: 2,329
Blog Entries: 1

Rep: Reputation: 47
Its bash. Just go to google and type in "BASH commands". The first result has a nice long document on different commands.
 
Old 03-27-2007, 09:41 AM   #3
camorri
LQ Guru
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,090

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
You did not say what type of files you want to move, or copy. CDRom's are a little different than other devices. They can contain data files, and these are copied using the 'cp' ( copy copmmand ).

Copy will make a new file and leave the old file in its original location. Here is an example on how to use copy as a regular user.

Code:
cp /path/to/the/file/file1 /target/path/file1
You do not need to be in the directory if you supply the path information to the file. The target path is a path to where you have write permission.

Since this is a CDRom, you need to know where the cdrom is mounted. This is determined when the 'mount' command is run. You can run it manually, or it can be run by the system based on what is in the file /etc/fstab. Here is the entry for my CDRom in my fstab.

Code:
/dev/cdrom /mnt/cdrom auto umask=0,users,iocharset=iso8859-15,sync,codepage=850,noauto,ro,exec 0 0
The mount point in the file system is the second field, /mnt/cdrom. So in the cp command above I would really use cp /mnt/cdrom/path/on/cdrom/file1 /target/path/file1 to copy the file.

I could also navigate to the directory where the file is I want to copy using the 'cd' command. CD is the change directory command. So, id I did a cd /mnt/cdrom/path/on/ and pressed enter, I would be in that directory. Then I could do the copy with 'cp file1 /target/path/file1' ( all commands without the quotes. I use the quotes to clarify what I type .

So, what if it is a music file. Copy doesn't work because you can not mount a music CD. You can still get a copy of the file on your hard drive. I would then use a program like Grip. Grip can rip music files, and you can compress them directly to your favorite file format. mp3, ogg etc...

The only other thing you need to do is oprn a BASH shell. You didn't say what desktop you are running. Look through your menu system, there will be an icon to launch a shell.

There is also a move command. It is used in a similar way to cp, the difference is the file is moved to the target location, and removed from the source location. Unless your CDRom media is erasable, some are, you will not need this command on the CDRom.

You can get help with these commands by typing 'man command' on the command prompt. A real example would be 'man cp' for help with the copy command. The 'Q' key quits the man page help.

Hope this helps.
 
Old 03-27-2007, 10:25 AM   #4
w_r_cromwell
Member
 
Registered: Feb 2006
Location: Michigan
Distribution: RedHat9, Core6, Ubuntu5.1
Posts: 42

Rep: Reputation: 18
Camorri did an excellent job explaining this. I would like to re-emphasize the difference between the cp (copy) and mv (move) commands. Cp always leaves the original where it is. Mv removes the original. You need to be aware of that when you are using those commands.

Additionally, the mv command is used to rename a file. The file is "moved" to the same file with a new name whether or not it is also moved to a new directory. So if you wish to rename a file use the mv command for that as well. For example, you wish to rename a picture from your digital camera form the cryptic format tha camer software supplies you would use "mv oldname.jpg newname.jpg" You woud also use the full path to newname to also put the picture in a different location - "mv oldname.jpg /newfolder/newname.jpg".

Once you get accustomed to the shell you'll find yourself preferring it a lot of the time. These examples are probably faster and easier using your GUI in X but they do serve as good examples.

Cp can also be used to make a new copy of a file with a different name. You would use this to make a backup copy of a file for instance. When you are ready to start changing your system configuration files you will want copies of the original so that you can put the original files back if you accidentally break your system. Before you edit some.conf you would issue "cp some.conf some.conf.old". Then you would make your changes to some.conf. If that breaks your system you use you just delete some.conf and "cp some.conf.old some.conf". This leaves you with the backup copy so you can try again and still have your backup copy.

I hope the additional information helps.

Bill

Last edited by w_r_cromwell; 03-27-2007 at 10:37 AM.
 
Old 03-27-2007, 01:36 PM   #5
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
Quote:
Originally Posted by w_r_cromwell
Mv removes the original.
Obviously it won't remove the original if it is on a CD-ROM (Compact Disc Read Only Memory). In this case "cp" and "mv" will do exactly the same thing.

Moving files is a lot easier to do using a graphical file manager (such as Konqueror or Nautilus) than from the command line anyway. These commands are only really any use if you're running a text-only server.

Last edited by hand of fate; 03-27-2007 at 01:41 PM.
 
  


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
networking redhat linux (newbie stuff) govtlinux Red Hat 1 09-14-2004 10:13 PM
linux redhat newbie needing advice shemjaza Red Hat 11 12-08-2003 06:16 AM
(linux newbie) Win2k and Redhat 7.1 tomaz Linux - Software 7 08-23-2001 09:10 PM


All times are GMT -5. The time now is 10:38 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