Search⌘ K

Renaming Files

Explore how files are renamed using the atomic rename system call in operating systems. Understand how this call ensures reliable file updates by preventing inconsistent states during crashes, and see its application in editors that perform atomic file modifications.

We'll cover the following...

Once we have a file, it is sometimes useful to be able to give a file a different name. When typing at the command line, this is accomplished with mv command; in this example, the file foo is renamed bar:

Shell
prompt> mv foo bar

Using strace, we can see that mv uses the system call rename(char *old, char *new) ...