Final answer:
Commands for various file operations and searching in Unix can be achieved using 'cp', 'cat', 'find', 'echo', and by combining commands using semicolons. Overwriting and appending files are done with '>' and '>>', while redirecting errors uses '2>'. Searching a file from the root and ignoring error messages involves 'find' and redirecting to '/dev/null'.
Step-by-step explanation:
To perform the tasks specified, the following commands can be used on a Unix-based system or in a Unix-like command-line environment:
- Redirect file1 to file2:
cp file1 file2 or cat file1 > file2 - Redirect file1 and append file2 to itself: This is a trick question because you cannot redirect a file to itself without overwriting it. The command will replace the contents of file2 with file1 if you try cat file1 > file2. The original contents of file2 will be lost.
- Append file1 to the end of file2:
cat file1 >> file2 - Search a file named 'file1' from the root and redirect the error message to /dev/null:
find / -name file1 2>/dev/null - Run the commands ls, and echo "hello" in one line:
ls; echo "hello"
If you perform the second task, file2 will contain only the contents of file1 after the command because the greater than symbol (>) is used for overwriting, not appending.