LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 08-08-2010, 07:20 PM   #1
zigtozag
LQ Newbie
 
Registered: Aug 2010
Posts: 8

Rep: Reputation: 0
Question Help - What happens when you give the following commands if the file named done alrea


What happens when you give the following commands if the file named done already exists in linux
 
Old 08-08-2010, 07:24 PM   #2
zigtozag
LQ Newbie
 
Registered: Aug 2010
Posts: 8

Original Poster
Rep: Reputation: 0
What happens when you give the following commands if the file named done already exists?
o $ cp to_do done
o $ mv to_do don
 
Old 08-08-2010, 07:26 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi, welcome to LQ!

Those two commands (executed in a temporary directory, with a copy of a file) are
perfectly harmless. I recommend you TRY them - and then report your findings
back; both here and to your teacher, maybe?



Cheers,
Tink

Last edited by Tinkster; 10-07-2010 at 05:04 PM.
 
0 members found this post helpful.
Old 08-08-2010, 07:36 PM   #4
zigtozag
LQ Newbie
 
Registered: Aug 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Thumbs down

I would if I had Linux, I do not have it just trying to learn about it
 
0 members found this post helpful.
Old 08-08-2010, 07:39 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
In that case ... download and install Cygwin; behaves like the real thing
in most aspects, works a treat under windwoes.


Cheers,
Tink
 
Old 08-08-2010, 07:40 PM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
A great idea for learning about Linux, would be to download & burn a LiveCD that you can boot and play with and learn with; you would not even need to install it if you don't want to - just boot it up and use it, and when you're done, you can shut down, remove the CD, and your computer is exactly as it was before you used the CD.

Nice LiveCD distros for beginners to Linux are Ubuntu and Mint, just as 2 examples.

Best of success!
 
Old 08-08-2010, 07:50 PM   #7
zigtozag
LQ Newbie
 
Registered: Aug 2010
Posts: 8

Original Poster
Rep: Reputation: 0
I tried using the Fedora and Red Hat CD - I messed up and installed it and wiped out everything off my computer and I am afraid to use it again

Why is it so hard just to answer a question on this site, I was reading other post and it is truly unreal with some of the responses I am reading

Last edited by zigtozag; 08-08-2010 at 07:52 PM.
 
0 members found this post helpful.
Old 08-08-2010, 07:54 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Why is it so hard just to answer a question on this site, I was reading other post and it is truly unreal with some of the responses I am reading
Because your question, viewed in isolation, smacks of homework. And answering
this is against our expressed rules.



Cheers,
Tink

Last edited by Tinkster; 08-08-2010 at 07:55 PM.
 
Old 08-08-2010, 08:12 PM   #9
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Plus you could have answered your own question. If you have a computer (how'd you get here if you don't?). And have a blank optical media or thumb drive. And probably in less time that it took to post the question.

But to answer your question, IT DEPENDS.

There are flags to NOT overwrite existing files. Whether or not they are enabled via an alias on your system DEPENDS. If that's a test question, then your teacher is an idiot. As BOTH answers are, from a certain POV, correct. Or it's an easy A as you can do no wrong.

In the meantime go out into the wilderness and learn.

http://distrowatch.com/
 
Old 08-08-2010, 08:32 PM   #10
zigtozag
LQ Newbie
 
Registered: Aug 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Thumbs up

I thank you guys for being so nice about it, as I have just found out I have triple negative cancer, and I am just trying to get a little help, I really did not feel up to spending much time on this project, as I have to start my first chemo in the morning, so I guess right now I am feeling like an idiot and dont really care.
 
Old 08-25-2010, 06:33 AM   #11
zigtozag
LQ Newbie
 
Registered: Aug 2010
Posts: 8

Original Poster
Rep: Reputation: 0
I am still battling the cancer, and taking the chemo makes you sick.. all prayers are welcome.
 
Old 10-07-2010, 05:47 PM   #12
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Quote:
Originally Posted by zigtozag View Post
What happens when you give the following commands if the file named done already exists?
o $ cp to_do done
o $ mv to_do don
If the two commands are not setup with aliases, the file(s) would be overwritten. I assumed you meant to spell done instead of don.

Some distros will have commands setup with an aliases to warn you that it will overwrite or delete files before doing so. And some distros will not. In the bash shell the alias would look like this.

alias cp='cp -i'
alias mv='cp -i'

The -i is interactive mode, which means it will ask permission before doing the action.

If you don't want to be asked and still prevent overwriting add
the -n, --no-clobber option. Do not overwrite an existing file.

Tip

Have you ever hosed important files by using > when you meant to use >>

Add set -o noclobber to your /etc/bashrc or your hidden .bashrc in your home directory.

To disable noclobber so you can overwrite or append data to the file, use set +o noclobber

Hope this short tutorial helps.

Hope you get better too.

Last edited by dv502; 10-07-2010 at 06:34 PM.
 
  


Reply

Tags
already, commands, done, file, following, if, linux, named



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
(bind) named: couldn't open pid file '/var/run/named/named.pid' - any help? samengr Linux - Server 6 04-01-2009 06:22 AM
file /var/lib/named/var/named/reverse/named.zero failed: file not found Toadman Linux - Software 15 03-18-2009 07:01 PM
service named cant start error in named.conf file gayanasa Linux - Server 2 07-02-2008 09:58 AM
how to give commands inside program sarathius Programming 2 04-28-2008 12:17 PM
c++ uses system to give commands to bash darkRoom Programming 2 03-10-2005 04:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:49 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
Open Source Consulting | Domain Registration