Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8690465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:54:32+00:00 2026-06-12T23:54:32+00:00

I want to make clear: When does pipe | or redirection < > take

  • 0

I want to make clear: When does pipe | or redirection < > take precedence in a command?

This is my thought but I need confirmation this is how it works.

Example 1:

sort < names | head

The pipe runs first: names|head then it sorts what is returned from names|head

Example 2:

ls | sort > out.txt

This one seems straight forward by testing, ls|sort then redirects to out.txt

Example 3:

Fill in the blank? Can you have both a < and a > with a | ???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:54:33+00:00Added an answer on June 12, 2026 at 11:54 pm

    In terms of syntactic grouping, > and < have higher precedence; that is, these two commands are equivalent:

    sort < names | head
    ( sort < names ) | head
    

    as are these two:

    ls | sort > out.txt
    ls | ( sort > out.txt )
    

    But in terms of sequential ordering, | is performed first; so, this command:

    cat in.txt > out1.txt | cat > out2.txt
    

    will populate out1.txt, not out2.txt, because the > out1.txt is performed after the |, and therefore supersedes it (so no output is piped out to cat > out2.txt).

    Similarly, this command:

    cat < in1.txt | cat < in2.txt
    

    will print in2.txt, not in1.txt, because the < in2.txt is performed after the |, and therefore supersedes it (so no input is piped in from cat < in1.txt).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a menu that.. does this: http://jsfiddle.net/8U9fy/1/ ( didnt want to
i just want to make this thing clear. to get the location, we could
First of all, I want to make something clear before I get yelled at:
Before I start, I want to make it clear that my code is working
I hope I can make myself clear in English and in what I want
I want to make sure I get this right, Based on what I've read
Edit2: I just want to make sure my question is clear: Why, on each
I research the source of PPTP program, and I want to make clear that
This one is fairly complex, hopefully I can make this clear enough for somebody
I have this typical problem with select. First let me make it clear that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.