Two questions, but only stuck on one. Feel that I need the first one so someone can help me make sense of it.
4) Use cat and /dev/null to create an empty file.
5) Start a background process that continuously prints the last line of the file created in #4..
So what i did for number 4 was:
cat /dev/null > emptyfile
This created an empty file. Okay so I am happy with that. The next question however confuses me. How can I read the last line of an empty file? Better yet how do I continuously do this? Running it in the background isn't a problem. Anyone have any ideas? We haven't covered scripting yet so I don't think that plays a role. As always, thanks for the help.
tail [OPTION]... [ Tail is a command which prints the last few number of lines (10 lines by default) of a certain file, then terminates. Example 1: By default “tail” prints the last 10 lines of a file, then exits.
Use the tail command to write the file specified by the File parameter to standard output beginning at a specified point. This displays the last 10 lines of the accounts file. The tail command continues to display lines as they are added to the accounts file.
Use the UNIX command "tail" with the -f option. That will continuously print out contents from the file to the terminal as it is added to the file.
Example:
tail -f emptyfile
You can terminate the tail process by typing Ctrl + C.
doesn't tail -f FILE_NAME
help?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With