Refresh on Windows does a bunch of different things depending on the application. If you're talking about the file manager — reloading/refreshing is needed in some cases (and does the same thing as in Windows), but not that often.
Most modern desktop environments on *nix make use of either the inotify facility, or, for older ones, the File Alteration Monitor daemon famd
. You fire the appropriate system calls or connect to the famd
, give them a list of directories or files to watch, and you get you an asynchronous message when they change. For directories, you can get separate messages for when contents are added, deleted, changed, etc. Using this, a file manager can automatically refresh its view of a folder when the folder changes, and it's very easy to implement.
Think of it as a bot that hits F5 for you when it's needed.
You can see this in action yourself! Open your Downloads
folder in a file manager, then download a file with your web browser. The file manager will show the file automagically. If it's a big file (or a slow connection), you might even see the filename.part
temporary file appearing, then increasing in size, then getting renamed into the final filename
.
Modern file selection dialogue boxes do the same: if you go to ‘Open…’ and move a file into the directory the dialogue box is showing, that file will appear there immediately (not when you hit refresh).
Refreshing/reloading is still needed in a number of cases:
- If for some reason, you're running neither a modern kernel nor
famd
(e.g. old installation, embedded machine).
- If your files/entities are accessible over a medium
inotify
and famd
don't support because it's not a locally accessible ‘directory’, e.g. the GNOME VFS using sftp
or the KDE sftp://
IOSlave.
- If they're not files at all. For instance, web pages or documents being viewed. But: many viewers will watch their open files for changes and will automatically reload them. This is handy in development where you have a lot of edit-save-‘compile’-view cycles — the venerable
xdvi
did this for LaTeX typesetting. The KDE document reader okular
does it too.