Tilde (~) File in Macintosh Directory
Last night I discovered what looks like an unusual file named "~" (tilde) in the root of my "Macintosh HD" directory on my MacBook.
Finder reports the file is 2.2MB in size, of kind "TextEdit.app Document", and was created on 22nd January 2014 (so about a month ago). I haven't noticed any operational issues with OS X or it's applications.
I haven't yet touched the file but would obviously like to remove it. I am very conscious that '~' is a special alias to the user home directory and thus I would appreciate any recommendations in removing the file in a safe manner that isn't likely to nuke my home directory or screw up the operation of applications or OS X. I don't know whether to delete or rename and whether to use Finder or the command line.
It's entirely possible that I created the file by accident since I've recently been drafting and running various shell scripts that use the ~, user home alias.
MacBook Pro 15" (Retina, Mid 2012) Yosemite
Solution 1:
A ~ file is simply a broken attempt to access and write to your home directory.
This file should be safe to delete as it's not actually your home directory, but make sure you've got a backup in case you or another app needs it for any other purpose.
Also, for what it's worth, ~ is not an alias to your home directory, it's just a shell expansion to the path to the currently logged in user's home directory. It provides no actual path for the file system to follow to the directory.