Skip to main content
2 of 5
added 15 characters in body

I know this is an old question but you can use string operators for that purpose:

$ pwd
/home/kali/Documents
$ echo ${PWD/$HOME/'~'}
~/Documents

Now, you specifically asked about sed, I don't think it's the best tool or even necessary but you'd do:

$ pwd | sed "s|$HOME|~|"
~/Documents