Have a file named ~ (tilde) in my home-directory
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle4
--
Chapters
00:00 Have A File Named ~ (Tilde) In My Home-Directory
00:17 Answer 1 Score 20
00:44 Answer 2 Score 52
00:57 Accepted Answer Score 58
01:18 Answer 4 Score 1
01:34 Thank you
--
Full question
https://superuser.com/questions/609362/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #bash #filesystems
#avk47
ACCEPTED ANSWER
Score 58
The pretty much ultimate solution when it comes to files that can't be deleted by normal means:
ls -il
The first column will show the inode number of the files.
find . -inum [inode-number] -exec rm -i {} \;
This will delete the file with the specified inode-number after verification.
ANSWER 2
Score 52
You should be able to refer to that file as ~/~
(without quotes) because tilde-expansion only applies the the tilde (~
) at the very beginning of the word.
ANSWER 3
Score 20
Quote it (rm '~'
) or escape it (rm \~
).
It's always either of those (also for e.g. $
), or add --
to prevent the file name from being interpreted as argument: rm -- -i
removes the file named -i
; also useful for rm -- *
when you want to delete all files in the current directory: No accidental rm -f *
just because a file is named like that.
ANSWER 4
Score 1
Just to be safe I tried this in mac catalina:
mv '~' '~_bkp'
you can change directory to check the contents
cd '~_bkp' ls
If its empty simply 'remove'
rm -rf '~_bkp'
'rmdir' can be used too to remove the empty directory