Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




10.4.5 Details of Tilde Expansion

It's a standard part of shell syntax that you can use `~' at the beginning of a file name to stand for your own home directory. You can use `~user' to stand for user's home directory.

Tilde expansion is the process of converting these abbreviations to the directory names that they stand for.

Tilde expansion applies to the `~' plus all following characters up to whitespace or a slash. It takes place only at the beginning of a word, and only if none of the characters to be transformed is quoted in any way.

Plain `~' uses the value of the environment variable HOME as the proper home directory name. `~' followed by a user name uses getpwname to look up that user in the user database, and uses whatever directory is recorded there. Thus, `~' followed by your own name can give different results from plain `~', if the value of HOME is not really your home directory.

  Published under the terms of the GNU General Public License Design by Interspire