Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

Once a program has open the file, it keeps accessing that same file, even if the file is moved or even deleted. (Removing an open file only removes its name; the file — the inode — is actually deleted once no process has it open.)

Some programs watch if something happens to the file they have open. For example, the classic program tail -f keeps printing lines appended to the same file; some modern implementations (GNU, FreeBSD, NetBSD, OSX) have tail -F, which detects if a new file with the same name is moved into place and starts reading from the new file. Multitail can do that as well (run it as multitail --retry).

You can use the Inotify interface on Linux, or its equivalent on other unices, to detect if a file has changed. On Linux, use the inotifywait commanduse the inotifywait command.

Once a program has open the file, it keeps accessing that same file, even if the file is moved or even deleted. (Removing an open file only removes its name; the file — the inode — is actually deleted once no process has it open.)

Some programs watch if something happens to the file they have open. For example, the classic program tail -f keeps printing lines appended to the same file; some modern implementations (GNU, FreeBSD, NetBSD, OSX) have tail -F, which detects if a new file with the same name is moved into place and starts reading from the new file. Multitail can do that as well (run it as multitail --retry).

You can use the Inotify interface on Linux, or its equivalent on other unices, to detect if a file has changed. On Linux, use the inotifywait command.

Once a program has open the file, it keeps accessing that same file, even if the file is moved or even deleted. (Removing an open file only removes its name; the file — the inode — is actually deleted once no process has it open.)

Some programs watch if something happens to the file they have open. For example, the classic program tail -f keeps printing lines appended to the same file; some modern implementations (GNU, FreeBSD, NetBSD, OSX) have tail -F, which detects if a new file with the same name is moved into place and starts reading from the new file. Multitail can do that as well (run it as multitail --retry).

You can use the Inotify interface on Linux, or its equivalent on other unices, to detect if a file has changed. On Linux, use the inotifywait command.

Source Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k

Once a program has open the file, it keeps accessing that same file, even if the file is moved or even deleted. (Removing an open file only removes its name; the file — the inode — is actually deleted once no process has it open.)

Some programs watch if something happens to the file they have open. For example, the classic program tail -f keeps printing lines appended to the same file; some modern implementations (GNU, FreeBSD, NetBSD, OSX) have tail -F, which detects if a new file with the same name is moved into place and starts reading from the new file. Multitail can do that as well (run it as multitail --retry).

You can use the Inotify interface on Linux, or its equivalent on other unices, to detect if a file has changed. On Linux, use the inotifywait command.