How to use tilde in commands?

QuestionsQuestions8 SkillsProBasic Files OperationsDec, 02 2025
066

The tilde (~) can be used in various commands to represent your home directory. Here are some common examples:

  1. Change Directory:
    To navigate to your home directory:

    cd ~
  2. List Files:
    To list files in your home directory:

    ls ~
  3. Access a File:
    To open a file located in your home directory:

    cat ~/filename.txt
  4. Copy a File:
    To copy a file from your home directory to another location:

    cp ~/sourcefile.txt /path/to/destination/

Using the tilde helps you quickly reference your home directory without needing to type the full path. If you have more questions, just let me know!

0 Comments

no data
Be the first to share your comment!