Skip to Content
Small, Sharp Software Tools
book

Small, Sharp Software Tools

by Brian P. Hogan
June 2019
Intermediate to advanced
328 pages
7h 27m
English
Pragmatic Bookshelf
Content preview from Small, Sharp Software Tools

Redirecting Streams of Text

When you used the echo command to create a file, you took the output of one command and directed it somewhere else. Let’s look at this in more detail.

Execute this command to view all of the running processes on your computer:

 $ ​​ps​​ ​​-ef

The ps command shows you the processes running on your computer, and the -ef options show you the processes for every user in all sessions. Once again, the output of the command streams by.

This problem can be solved in a couple of ways. The first approach would be to capture the output to a file by using the > operator, just like you did to create a text file with echo:

 $ ​​ps​​ ​​-ef​​ ​​>​​ ​​processes.txt

You could then open that file in your favorite text editor and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The VimL Primer

The VimL Primer

Benjamin Klein
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781680507003Errata Page