LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-09-2014, 01:36 AM   #1
stetas
LQ Newbie
 
Registered: Dec 2013
Posts: 16

Rep: Reputation: Disabled
Pipes and Redirection


Hello
I have a Questions
How I can achieve these:
1) Redirect the listing of the /usr/bin directory to a file called listing.log

2) Append the listing of the /etc directory to listing.log
 
Old 01-09-2014, 01:39 AM   #2
sachin.davra
Member
 
Registered: Jul 2013
Posts: 213

Rep: Reputation: Disabled
Quote:
Originally Posted by stetas View Post
Hello
I have a Questions
How I can achieve these:
1) Redirect the listing of the /usr/bin directory to a file called listing.log

2) Append the listing of the /etc directory to listing.log
1)ls /usr/bin > listing.log
2)ls /etc/* >> listing.log

">>" this sign appends the text in the file.
 
Old 01-09-2014, 01:39 AM   #3
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,426

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Smells like homework ...
 
Old 01-09-2014, 01:40 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Quote:
Originally Posted by stetas View Post
Hello
I have a Questions
How I can achieve these:
1) Redirect the listing of the /usr/bin directory to a file called listing.log

2) Append the listing of the /etc directory to listing.log
These look like homework questions, which we will not do for you.

What have you tried and what are you stuck with?

Hint: search for bash redirection and/or bash pipes
 
Old 01-09-2014, 01:41 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

looks like homework, so I'll not give you the answer. Instead I'll point you in the right direction.
For 1) you need to learn about ">", and for 2) you need to learn about ">>".

Cheers,

Evo2.
 
Old 01-09-2014, 11:37 PM   #6
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,144

Rep: Reputation: 192Reputation: 192
if you are still learning don't take the shortcut, learn the basic and have a solid foundation.

it will help you a lot.

check and read this link below:

http://www.tldp.org/LDP/intro-linux/...#sect_05_01_02
 
  


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
what is the difference between redirection operators and pipes in linux ? stetas Linux - Newbie 2 12-05-2013 02:37 PM
[SOLVED] shellscripting: pipes and output redirection bluebox Programming 3 08-21-2010 06:47 PM
pipes leedude Programming 4 05-20-2008 06:52 PM
pipes smart girl Programming 6 04-30-2006 10:20 AM
about pipes kpachopoulos Programming 1 10-15-2005 12:37 PM


All times are GMT -5. The time now is 02:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration