In Linux, the tilde (~) is used as a shortcut to represent the home directory of the current user. Here are some common ways to use the tilde:
1. Change to Home Directory
To navigate to your home directory:
cd ~
2. Access Files in Home Directory
You can use the tilde to reference files or directories within your home directory. For example, to list files in the Documents folder:
ls ~/Documents
3. Create a Directory in Home Directory
You can create a new directory directly in your home directory:
mkdir ~/new_directory
4. Copy Files to Home Directory
To copy a file to your home directory:
cp /path/to/file ~/destination_file
5. Use with Other Users' Home Directories
You can also use the tilde followed by a username to refer to another user's home directory. For example:
cd ~username
Using the tilde simplifies navigation and file management by providing a quick way to reference the home directory.
