O'Reilly logo

CompTIA Linux+ Certification Guide by Philip Inshanally

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pipes and redirects

Often, when we are viewing output from various commands, the output is a bit fuzzy. Fear no more; we have what is known as pipes and redirects. Basically, when working with pipes (|), we take the output of a command and pass it as the input of another command. Redirects (>, <, >>2>, and 2>&1) are similar to taking output from a command, but this time, we send it to a location, such as a file or another location, to name a few.

To begin, let's use the ls command; the code is as follows:

[root@localhost philip]# ls /etcabrt               default    gdbinit.d        kernel                    networks           rc4.d      subuid-adjtime            depmod.d   gdm               krb5.conf                 nfs.conf           rc5.d      sudoersaliases            dhcp        geoclue          krb5.conf.d      nfsmount.conf      rc6.d     sudoers.dalsa DIR_COLORS glvnd ld.so.cache nsswitch.conf ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required