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 10-14-2013, 02:32 PM   #1
John Q
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Rep: Reputation: Disabled
Copying Files


I like Linux but it's more of a challenge to learn it than I anticipated. But like most things you have to crawl before you can walk. Anyhow, I need a little help on how to copy file to my home directory.

Thanks
 
Old 10-14-2013, 02:50 PM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
Hi John, it would be useful to know:
  • Which version of Linux youre using
  • Are you trying to copy it using the command line, or the desktop?
  • Where are you copying it from?
  • What have you been trying, and what results have you had?
Generally, you should be able to open the folder that the file is in using the file manager, right-click and select copy, then open your home folder and right-click-paste. On the command-line you would run a command like:

Code:
cp /path/to/file /home/john
If your file is on another drive (e.g. a memory stick), this will need to be mounted before you can copy anything from it. Most of the time this will happen automatically, when you connect the drive. In most file managers, this will probably appear in a column on the left, or you can see mounted partitions on the command line with the df -h command.
 
1 members found this post helpful.
Old 10-14-2013, 03:47 PM   #3
John Q
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Linux Newbie

Quote:
Originally Posted by Robhogg View Post
Hi John, it would be useful to know:
  • Which version of Linux youre using
  • Are you trying to copy it using the command line, or the desktop?
  • Where are you copying it from?
  • What have you been trying, and what results have you had?
Generally, you should be able to open the folder that the file is in using the file manager, right-click and select copy, then open your home folder and right-click-paste. On the command-line you would run a command like:

Code:
cp /path/to/file /home/john
If your file is on another drive (e.g. a memory stick), this will need to be mounted before you can copy anything from it. Most of the time this will happen automatically, when you connect the drive. In most file managers, this will probably appear in a column on the left, or you can see mounted partitions on the command line with the df -h command.
Hi Robhogg

Thanks for the reply!

It's CentOS6 using RedHat. It has to be done through Bash command line. I have to copy the file /etc/gconf/schemas/gnome-terminal.schemas to my home directory. I believe the command would be, cp /etc/gconf/schemas/gnome-terminal.schemas /~ . Unfortunately, in the past, when I have executed commands as I believed they should have been executed and I did not received any error responses. I assumed that I had performed the exercise correctly. However, when I would use the mechanism that RedHat has in place to check your work after the fact, it would mark my work as in correct, with no explanation on what I did wrong.

As a teaching mechanism, RedHat's system seems to like to make you try to figure things out as oppose to teaching them.

Last edited by John Q; 10-14-2013 at 03:49 PM.
 
Old 10-14-2013, 04:02 PM   #4
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
Ah... the issue is that the slash and tilde are the wrong way round in this command:

cp /etc/gconf/schemas/gnome-terminal.schemas /~

Running this command will try to copy to a file called '~' in the root directory. For the tilde-shortcut to work, it needs to come before the slash:

cp /etc/gconf/schemas/gnome-terminal.schemas ~/

If you're not receiving any error messages, I presume you're running the command as root. Otherwise you should get a "permission denied " error trying to write the the root directory (unless the standard permissions have been changed). If so, ~ will be root's home directory - you could use ~john/ (or whatever your username is on the system) to specify that directory.

There's a pretty good command line tutorial here which might help.
 
1 members found this post helpful.
Old 10-14-2013, 04:17 PM   #5
John Q
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Robhogg View Post
Ah... the issue is that the slash and tilde are the wrong way round in this command:

cp /etc/gconf/schemas/gnome-terminal.schemas /~

Running this command will try to copy to a file called '~' in the root directory. For the tilde-shortcut to work, it needs to come before the slash:

cp /etc/gconf/schemas/gnome-terminal.schemas ~/

If you're not receiving any error messages, I presume you're running the command as root. Otherwise you should get a "permission denied " error trying to write the the root directory (unless the standard permissions have been changed). If so, ~ will be root's home directory - you could use ~john/ (or whatever your username is on the system) to specify that directory.

There's a pretty good command line tutorial here which might help.
OK

Your right. That does come back to me now that "/" represents the "root". I haven't tried this exercise yet, but because of past experiences I want to try and be as precise as possible beforehand. This helps a lot and the tutorial really looks informative.

Robhogg, greatly appreciated!!
 
Old 10-19-2013, 12:06 AM   #6
zrdc28
Member
 
Registered: Dec 2007
Location: Alabama USA
Distribution: Slackware current
Posts: 299

Rep: Reputation: 53
"cd" to where the file is located.
"ls" to make sure the file is there
"cp filename /home"
or if too your user name ""cp filename /home/username"

If you have "dolphin" open it and find the file, Tap "split" at the top menu
that will open 2 windows, over to the right side open up /home, drag and drop!
 
1 members found this post helpful.
Old 10-24-2013, 10:41 AM   #7
John Q
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by zrdc28 View Post
"cd" to where the file is located.
"ls" to make sure the file is there
"cp filename /home"
or if too your user name ""cp filename /home/username"

If you have "dolphin" open it and find the file, Tap "split" at the top menu
that will open 2 windows, over to the right side open up /home, drag and drop!
zrdc28,

Thanks for all the help. You guys are the best. So glad I joined this board.
 
Old 10-24-2013, 11:26 AM   #8
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,556
Blog Entries: 2

Rep: Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054
also have a look at:
Code:
ls --help
{and\or}
man cp
e.g: 'ls -l' for more info on files
 
Old 10-24-2013, 01:59 PM   #9
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
I wouldn't bother with the cd, just a waste of time

employ the use of the tab key <tab> to quickly 'navigate' using 'bash completion'
http://www.tldp.org/LDP/abs/html/tabexpansion.html

your example
/etc/gconf/schemas/gnome-terminal.schemas

Code:
cp /e<tab>g<tab><tab>c<tab>s<tab>
and so on, until you get to the file you want

in effect that is the same as cd'n'ls ing, just a lot quicker

to complete the copy, end with ~/

if you need a subdir of home, then use the tab trick

Code:
cp /etc/gconf/schemas/gnome-terminal.schemas ~/<tab><tab>
double tabs show you all the possibilities

eventually you will get into the habit of hitting tab, even when you don't need to
once you have that habit, your command line typing will be Much faster, with greater accuracy
 
1 members found this post helpful.
  


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
Copying files paddyjoy Linux - Newbie 10 10-25-2013 11:12 AM
[SOLVED] Copying the files inside a folder, without copying the folder (hopefully easy) tibberous Linux - Software 3 12-23-2010 01:50 AM
Permissions error while copying files on NFS, but only on some files caggles Linux - Networking 1 07-30-2009 03:17 PM
copying files matthes138 Linux - Newbie 4 05-29-2009 12:37 PM
need help with copying files Earl Parker II Linux - General 8 09-12-2005 08:54 AM


All times are GMT -5. The time now is 09:01 PM.

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