Title: Exchange contents in two files without copying
Tags: operating-system;filesystems;archlinux;virtual-memory;virtualfilesystem
Question: I want to exchange the contents in two files A and B. However, I do not want to use copy operation such as C <- A; A <- B; B <- C;
In fact, I want to exchange contents of a hard disk page p1 in file A with contents of a hard disk page p2 ini file B. Theoretically, in this case, I only need to exchange two "pointers" that point two these two page.
I'm no deep in operating system. I want to know how to do this or can anyone give some suggestions about which content I need to refer to ?
The operating system is Linux.


Here is another answer: You do it at the shell:
mv a c
mv b a
mv c b
Comment for this answer: On eunuch's variants, you're screwed.
Comment for this answer: I only want to exchange parts of the files, but not the whole file.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:08/03/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<operating-system><filesystems><archlinux><virtual-memory><virtualfilesystem>', 'Title': 'Exchange contents in two files without copying', 'ViewCount': 35, 'id': 51673385, 'user_AboutMe': None, 'user_AccountId': 14086776.0, 'user_DisplayName': 'wenbing yao', 'user_Reputation': 1.0, 'user_Views': 3.0, 'user_id': 10176328.0}}