SHARE
Facebook X Pinterest WhatsApp

Linux.com: Shell Skills, Part 2: I/O, Redirection, and Pipes

Written By
thumbnail
Web Webster
Web Webster
Jul 4, 2000

In this installment of the “Shell Skills” series, you’ll
receive the background you need before you can start stringing
commands together like a pro. Specifically, we’re going to talk
about terms such as “standard input”, “standard output”,
“redirection”, and “piping”. Don’t be intimidated – we’ll give you
some examples, and soon you’ll be one step closer to mastering the
shell.

“Often, a command needs someplace to send information, often in
the form of text. This place is called “standard output”. So,
“where” exactly is that? Is it a text file, or the terminal screen,
or a printer? Well, it can be any of those places. The key is
something called “redirection.”

“By default, the shell “redirects” any output from a command to
a special file that represents your terminal. (In Linux, all
devices are represented by special files under the “/dev”
directory.) Your terminal is represented by “/dev/ttyn”, where n is
a unique identifier for that particular terminal. So, by default,
all information from a command will be sent to the terminal window.
For example, in the case of the “ls” command, this would be a
directory listing. There is also a second type of output, known as
“standard error”. It can be used by programs to separate regular
output from error messages, so that they don’t get mixed up. For
example, you might want to save a log of only the error messages
generated by a program. Later in this article, we’ll show you how
you can redirect standard output and/or standard error to someplace
other than the terminal.”


Complete Story

thumbnail
Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Recommended for you...

Red Hat reveals major enhancements to Red Hat Enterprise Linux AI
sjvn
Oct 22, 2024
How to Find AWS EC2 Instance Type Over SSH (6 Methods)
Benny Lanco
Sep 23, 2024
Crond: Daemon to Execute Scheduled Commands
Rose Hosting Blog
Sep 20, 2024
A Detailed Introduction to Oracle VirtualBox
Senthil Kumar
Sep 19, 2024
Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.