pwd gives me/data/users/me/some/random/folderIs there an easy way of obtaining~/some/random/folderfrom pwd?
Make pwd result in terms of ~?
filenames;home;pwd
If your're using bash, then the dirs builtin has the desired behavior:dirs +0~/some/random/folder(Note +0, not -0.)With zsh:dirs~/some/random/folderTo be exactly, we first need to clear the directory stack, else dirs would print all contents:dirs -c; dirsOr with zsh's print builtin:print -rD $PWDorprint -P %~(that one turns prompt expansion on. %~ in $PS1 expands to the current directory with $HOME replaced with ~ but also handles other named directories like the home directory of other users or named directories that you define yourself).