Hands-on Lab – Pipes, Redirectors, and find
For this assignment, you’ll be working with pipes and redirectors. To see the full effect of this exercise, you’ll need to be logged in as a normal user, and not as root.
- Enter the following, noting that you’re deliberately typing the name of a non-existent directory in order to generate an error message.
find /far -iname '*' - Note the output, and then enter:
find /far -iname '*' 2> error.txt cat error.txt - Create a listing of files and see how many there are, by entering:
find / -iname '*.txt' > filelist.txt 2> error_2.txt find / -iname '*.txt' 2> /dev/null | wc -l less filelist.txt less error_2.txt
If you’re logged on as a normal user instead of as root, this should generate some error messages about the fact that you don’t have permission to look in certain directories...