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 ...

Get CompTIA Linux+ Certification Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.