LinuxQuestions.org
Visit Jeremy's Blog.
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 11-29-2010, 10:25 AM   #1
nitishjtm
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Rep: Reputation: 0
Post Copying file into root


Hi, how can I copy a file into the root. I am new to linux and using fedora 13. I have to install jdk on the linux.
 
Old 11-29-2010, 10:39 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,316

Rep: Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878
Quote:
Originally Posted by nitishjtm View Post
Hi, how can I copy a file into the root. I am new to linux and using fedora 13. I have to install jdk on the linux.
You copy it the same way you copy any other file. But, you have to either be root, or use SUDO, to have the right permissions.

If you're root, remember to be VERY CAREFUL when you're doing anything.
 
Old 11-29-2010, 10:44 AM   #3
nitishjtm
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
You copy it the same way you copy any other file. But, you have to either be root, or use SUDO, to have the right permissions.

If you're root, remember to be VERY CAREFUL when you're doing anything.
Please tell me the commands required for this. As I am new to linux so I am not much familiar with the commands.
 
Old 11-29-2010, 11:06 AM   #4
e3399
Member
 
Registered: Nov 2010
Location: China
Distribution: Fedora12
Posts: 54

Rep: Reputation: 0
Quote:
Originally Posted by nitishjtm View Post
Please tell me the commands required for this. As I am new to linux so I am not much familiar with the commands.
$su

then enter your root passwd.
 
Old 11-29-2010, 12:33 PM   #5
fredora
LQ Newbie
 
Registered: Nov 2010
Posts: 19

Rep: Reputation: 1
Commands

If you're new to Linux I would suggest using the "sudo" command.
Before your command precede it with "sudo <command>". This allows you to be the superuser for that single command.
 
Old 11-29-2010, 02:05 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,316

Rep: Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878
Quote:
Originally Posted by nitishjtm View Post
Please tell me the commands required for this. As I am new to linux so I am not much familiar with the commands.
The copy command is "cp". The installation instructions for installing JDK are well-documented, and have the steps you need to take to do it...did you read them?

And if you don't know the "cp" command, are you sure you should be installing files/programs as root??
 
Old 11-29-2010, 09:15 PM   #7
Rahil Parikh
LQ Newbie
 
Registered: Nov 2010
Posts: 15

Rep: Reputation: 0
Hey,

To copy the file into /root directory you need to be root or have permission as TB0ne said. Now, if you are root you can copy the file by issuing --

Code:
cp mySrcFile1 [mySrcFile2 mySrcFile3 ...] /root/
Here, the mySrcFile1, mySrcFile2, mySrcFile3 etc.. are files that you want to copy and /root/ is destination where you want to copy. '[' and ']' braces shows that mySrcFile2, mySrcFile3 etc.. are optional.

If you are not root then you may use sudo command.

Code:
sudo <cmd>
Here, you may replace the <cmd> with the command (like cp for copying file) that you want to use.

Quote:
Copying Files
Copying files under Linux is similar to copying files under DOS. Here's an example using the cp (copy) command:
$ cp goulash recipes/hungarian
$ cp stuff stuff.bak
The first example copies the goulash file from the current directory and stores it in your recipes/hungarian directory. The second example creates a file called stuff.bak in the current directory that is identical to the source file stuff.

Note: The cp command will overwrite files with the same name without warning. To be prompted before overwriting, use the -i flag, like so:

$ cp -i goulash recipes/hungarian
cp: overwrite recipes/hungarian/goulash (y/n)?

Renaming Files

Use the mv command to rename a file or move it to another directory, like so:

$ mv stuff junk
$ mv junk trashcan

The first example renames the file stuff as junk, and the second moves the file junk into a directory called trashcan.

Note: The mv command will wipe out files without warning. To be prompted before overwriting, use the -i flag, like so:

$ mv -i stuff junk
mv: overwrite junk (y/n)?

Source :: lowfatlinux.com/linux-copy-files-cp.html
 
Old 09-06-2014, 06:31 AM   #8
Sherlock_Holmes
LQ Newbie
 
Registered: Sep 2014
Posts: 2

Rep: Reputation: Disabled
Copying file into root

There is another way of getting a file into root or any other admin password protected dirrectory and that is.
Click on File system go to the dirrectory that you are wanting to copy a file into.
Right click on this and select open as administrater, enter your password when prompted.
Next go to the file that you want to copy into what was a protected dirrectory, right click the file and select copy, now go back to your dirrectory of importation and paste the file in to that dirrectory.
While there right click the file and select properties, you want to ensure that your user name has the right to acces that file so set the permisions to reflect what you want.

Hope that helps.
 
Old 09-06-2014, 11:01 AM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,022

Rep: Reputation: 203Reputation: 203Reputation: 203
It is possible to use a GUI, with care!

Some file managers (e.g. nemo, nautilus(?)) allow you to open a directory as root.
Options such as copy & paste will work.
Since you are running as root, there is no limit to the potential damage you can do.
 
  


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 a file as root through an intermediate computer. quyzbuk Linux - Newbie 6 07-28-2010 10:42 PM
KDE - copying to root folders. stf92 Linux - Newbie 6 07-19-2010 12:00 PM
scp truncate text file busy - copying file is not a running binary jetberrocal Linux - Server 3 06-24-2010 04:56 PM
copying the root filesystem Nevion Linux - General 4 09-01-2003 03:57 AM
Copying files to desktop w/out being root Lon3wolf Linux - Newbie 8 07-10-2003 01:00 PM


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