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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-18-2012, 04:59 AM
|
#1
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Rep:
|
copy file and change permission
I would like to copy a file to another path , can advise how can the file owner is not changed but change the permission to 666 ( the file is 644 originally ) , is there a single command can do that ?
thx
|
|
|
06-18-2012, 05:05 AM
|
#2
|
Member
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 649
Rep:
|
You can change what attributes to preserve or not using the cp options --preserve and --no-preserve, but I don't think you can set arbitrary permissions on the fly.
For that you'd need chmod.
|
|
|
06-18-2012, 05:30 AM
|
#3
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Original Poster
Rep:
|
Quote:
Originally Posted by 414N
You can change what attributes to preserve or not using the cp options --preserve and --no-preserve, but I don't think you can set arbitrary permissions on the fly.
For that you'd need chmod.
|
thx reply ,
that mean I must run two command to do that ?
ps. as I will run cron job to do it so I prefer one single command .
thx
|
|
|
06-18-2012, 05:48 AM
|
#4
|
Member
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 649
Rep:
|
Quote:
Originally Posted by ust
ps. as I will run cron job to do it so I prefer one single command .
thx
|
You can put all the commands required inside a single script and then launch it via a cron job...
|
|
|
06-18-2012, 08:43 AM
|
#5
|
Member
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111
Rep:
|
Quote:
Originally Posted by ust
ps. as I will run cron job to do it so I prefer one single command
|
what about the syntax
Code:
command_1 && command_2
!?
in that way if command_1 fails, command_2 won't be executed.
|
|
|
06-18-2012, 09:01 AM
|
#6
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
and of course you can just string the commands together on one line:
command1; command2; command3
|
|
|
All times are GMT -5. The time now is 05:22 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|