Home » Learning Curve
3662262—2Some things change; some stay the same. - C Hynde
Three years ago to the day on Thursday the first article in this series was published. There are some new twists today but overall the situation is still rather - twisted.
If you haven't read the first article in this series yet then do it now before proceeding.
Preliminaries
The first experiment is much as before but with a few new twists.
- Make a screen dump with ⇧⌘4. This creates 'Picture 1.png' in your 'Desktop' directory.
- Double-click 'Picture 1.png' to open it in Preview.
- Open Terminal, go to your desktop ('cd ~/Desktop') and type in the following.
ln 'Picture 1.png' 'Picture 2.png'
- Go back to Preview, rotate the image, and then hit ⌘S (Save).
- Now you know for a fact you haven't renamed the file - you've just added a link to it. So what's this gibberish from Apple's file system?
- So go ahead - click on 'Save'. Take a chance.
- What happens now? You're sorta stuck, aren't you?
- OK, back to your Terminal, and presuming you have Rixedit do the following. Otherwise jump to #10.
mv 'Picture 1.png' 'Picture 1.rtx'
- Now double-click 'Picture 1.rtx' to open it, select all, type in a single character (any key is fine) and try to save.
- Now back to your Terminal again, rename 'Picture 1.rtx' to 'Picture 1.txt', double-click to open in TextEdit, select all, replace with a single character, and save.
And now just to make sure you're still all right: reboot into single user mode and use fsck to check your file system. And when you're back up and online come back to this page again.
Followups
This next experiment involves only Terminal. So open Terminal and get ready.
- Go to your desktop.
cd ~/Desktop
- Create a new folder 'Test' and move into it.
mkdir Test; cd Test
- Type in the following.
echo 'This is a text file.' >1.txt
- Check what you have. Note especially the number in the leftmost column. Check the file contents too.
$ ls -il total 8
3046457 -rw-r--r-- 1 rixstep staff 21 Jun 18 21:06 1.txt $ cat 1.txt This is a text file.
- Hard link '1.txt' to '2.txt' and check again.
$ ln 1.txt 2.txt $ ls -il total 16 3046457 -rw-r--r-- 2 rixstep staff 21 Jun 18 21:06 1.txt 3046457 -rw-r--r-- 2 rixstep staff 21 Jun 18 21:06 2.txt
And note in the above that it's not only the inodes that are identical - all the file information is identical.
$ ls -ilT total 16 3046457 -rw-r--r-- 2 rixstep staff 21 Jun 18 21:06:09 2007 1.txt 3046457 -rw-r--r-- 2 rixstep staff 21 Jun 18 21:06:09 2007 2.txt
- Check the contents of 'both files' again.
$ cat 1.txt This is a text file. $ cat 2.txt This is a text file.
- Change the contents of '1.txt'; then check the contents not of '1.txt' but of '2.txt'.
$ echo 'This is not the file it used to be.' >1.txt $ cat 2.txt This is not the file it used to be. $ ls -ilT total 16 3046457 -rw-r--r-- 2 rixstep staff 36 Jun 18 21:19:20 2007 1.txt 3046457 -rw-r--r-- 2 rixstep staff 36 Jun 18 21:19:20 2007 2.txt
See Also Learning Curve: 3662262 — Back to HFS
|