Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Environment and Redirection Pipes and Redirection

what is the diffrence between ps aux | grep bash > filename.txt and ps aux | grep bash | sort > filename.txt

what is the diffrence between ps aux | grep bash > filename.txt and ps aux | grep bash | sort > filename.txt both doing the same file with same data

1 Answer

Ivan Dergachev
Ivan Dergachev
4,337 Points

This command will get a list of running processes, find lines containing "bash" and save them into filename.txt

ps aux | grep bash > filename.txt

This command will get a list of running processes, find lines containing "bash", sort them alphabetically and save them into filename.txt

ps aux | grep bash | sort > filename.txt

If results of both commands are the same, maybe your lines do not require sorting.