# bash: Redirect output to virtual file

Bash has a cool feature, it allows you to redirect the output of an application to a virtual file. With this its for example possible to fast-diff two directories.

The old way would look like this:

ls dir1/ > directory_1.txt
ls dir2/ > directory_2.txt
diff directory_1.txt directory_2.txt


But with bash (and maybe some other shells) you can do the following:

diff <(ls dir1/) <(ls dir2/)