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 11-18-2009, 12:39 PM   #1
mnzahra
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
Need advice on output redirection


Just getting confused doing a lab for my linux class. Need help for the following;


Run the command 'mkdir old' and redirect any error messages into the file 'errors'.

I've tried a bunch of different combination and none of them work for some reason. Thanks a lot in advance.
 
Old 11-18-2009, 12:40 PM   #2
kdelover
Member
 
Registered: Aug 2009
Posts: 311

Rep: Reputation: 36
hi,

please use proper title for your message,and secondly this is your classwork,search for it and do it yourself :-) All i can tell you is look for redirectors in unix/linux.The answer to your question was in your Question .Mention what all options you tried
 
Old 11-18-2009, 12:43 PM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and welcome to LinuxQuestions,

First of all you'll have to change the title of your thread since this isn't drawing attention to it, on the contrary. Second, post what you've tried and what errors you got. And last but not least, read the man page for mkdir
Code:
man mkdir
and do some Googling on output redirection in Linux (turns up this)

Kind regards,

Eric
 
Old 11-18-2009, 12:49 PM   #4
mnzahra
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I've tried
mkdir old | 2>errors
mkdir old | cat 2>errors

I'm not even sure if I'm supposed to be piping it. Assuming that's right since it says run the command mkdir old and then redirect error messages into a file named errors.
And yeah, I know it's my classwork. I said that in my first post.

I'm not too sure how to change the name of the thread. I'll be more descriptive next time. Thanks.
 
Old 11-18-2009, 12:55 PM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Have a look at the link I posted about redirection. Compare the example(s) in that document to your structure. I'm sure you'll see the error. Since it is your homework, I'm not going to do it for you but this should get you in the right direction.

Tip: Read about the difference between piping and redirecting output.

Kind regards,

Eric
 
Old 11-18-2009, 01:01 PM   #6
mnzahra
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks a lot. Appreciate the help.


Didn't need to pipe. The command mkdir old 2>errors worked just fine.

Last edited by mnzahra; 11-18-2009 at 01:03 PM.
 
Old 11-18-2009, 01:11 PM   #7
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 50
Quote:
mnzahra

Thanks a lot. Appreciate the help.

Didn't need to pipe. The command mkdir old 2>errors worked just fine.
In case you don't know, when you use only one > to redirect the output, each time you run the command a single > will overwrite the existing file. If you want to append to the file use two >>
 
Old 11-18-2009, 01:14 PM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Quote:
Originally Posted by mnzahra View Post
Thanks a lot. Appreciate the help.


Didn't need to pipe. The command mkdir old 2>errors worked just fine.
Good for you, you figured it out. First point won, on to the next one. Just think logically and read a lot (Google even more )

Kind regards,

Eric
 
Old 11-18-2009, 01:46 PM   #9
mnzahra
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Yeah I did. I should have read the question more clearly. My prof has a really bad accent and I can't understand anything he says. Thanks
 
Old 11-18-2009, 01:53 PM   #10
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
That's going to be pretty difficult when you have to take exam.
 
Old 11-18-2009, 01:59 PM   #11
mnzahra
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Well I've used the operating system before. This class is just introduction to Linux using the shell in Windows. So I should be fine as long as I do my work. The class average right now is 53% and I'm getting a 70 . I wouldn't be surprised if that is the highest mark in the class too.
 
Old 11-18-2009, 02:03 PM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Looks like your taking the lead in the classroom! Great! Keep it up!
 
Old 11-18-2009, 06:08 PM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,259

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
I can recommend the following links for anyone in that kind of class
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
  


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
Output / Redirection VauxhallVXR Programming 2 06-06-2009 06:10 PM
Output Redirection - Trying to output to screen and file? helptonewbie Linux - Newbie 7 03-19-2009 08:05 AM
output redirection lons Linux - General 4 03-13-2007 01:31 AM
Output redirection??? ed_po Linux - Newbie 3 06-13-2006 01:17 PM
what is output redirection? LinuxPadawan General 5 05-18-2005 01:53 PM


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