LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-16-2005, 09:13 AM   #1
howarddevore
Member
 
Registered: Apr 2005
Distribution: not sure yet
Posts: 115

Rep: Reputation: 15
sudo mv question


hi there,
I've got a command line question..
I was about to go: sudo mv file destinationdir
when i realised that i could just as well move all of the files from dir a to dir b.
Is there a command or arguement that lets me do this in one?

I'm using kubuntu, so i need the sudo, cos the destination dir is /var/www

thanks for any help offered!

Last edited by howarddevore; 08-16-2005 at 10:47 AM.
 
Old 08-16-2005, 09:23 AM   #2
mherring02
Member
 
Registered: May 2005
Location: Pasadena, CA
Distribution: Ubuntu, Fedora
Posts: 50

Rep: Reputation: 15
got some issues mixed up here.

First "sudo" is for any operation that requires root access. If you su to root--or just log in as root, then your won't need sudo.

More generally, you only need root access to move files if you do not have write privileges on the target directory.

Assuming you are in your home directory and you have read-write access to all the subdirectories, then you can move **anything** **anywhere** with "mv" or "cp". Same answer if you are in your GUI window manager.

If you are root, you can do the above in ALL directories.
 
Old 08-16-2005, 10:26 AM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by mherring02
First "sudo" is for any operation that requires root access. If you su to root--or just log in as root, then your won't need sudo.
What? You got that backwards, I think but you don't make any sense or you got your terminology all wrong with sudo.

sudo is a way or means to allow or provide a non-root user with special privileges, either perform tasks that only root or simply another user can or has access to without providing such users password.

sudo does not require root access, in simple terms, if I was provided full access given by sudo, I can then run any command root can without using root's password directly. So it's safe to say that using sudo instead of directly logging in as root is a more safe and secure way of handling tasks that need to be done with root's permissions.

I would recommend telling users to setup or use sudo before telling them to simply login as root directly.

How I operate on my own servers, I setup sudo, create some random password for root that I make myself forget and then never logging in as root again, as it's not totally necessary, unless some catastrophic event occurs on the machine.
 
Old 08-16-2005, 10:54 AM   #4
howarddevore
Member
 
Registered: Apr 2005
Distribution: not sure yet
Posts: 115

Original Poster
Rep: Reputation: 15
i think using sudo is the norm on ubuntu/kubuntu, unless you use synaptic. When i installed it there was only one password required, which felt weird, at the time.

what i meant is i need a way to copy files using the command line, and not have to type them all out. Something like this:
sudo mv dir1contents(all) to dir2

I need the sudo because i think the read/write permission for the destination folder are root only. I can't drag files in there with konqueror.

thanks for posting

Last edited by howarddevore; 08-16-2005 at 10:55 AM.
 
Old 08-16-2005, 10:58 AM   #5
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
I think what your after is `sudo mv /path/to/dirA/* /var/www/`
 
Old 08-16-2005, 11:59 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
If I move a whole directory and it's contents (files and subdirectories) to a new location, I simply use this along with sudo if root only has permissions in the destination directory:

cd /into/directory/where/folder/resides
sudo mv folder /new/location/or/path/to/move/to

Notice you don't need the slash at the end of the source folder so it moves all of it without having to specify * for the move, etc.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
SUDO question sajjad02 Linux - Newbie 1 03-07-2005 10:21 PM
Sudo question satimis Fedora 6 11-24-2004 08:58 PM
Sudo question. wbdune Linux - Newbie 2 10-14-2003 12:40 AM
sudo question darthtux Linux - General 1 06-07-2002 02:27 AM


All times are GMT -5. The time now is 10:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration