Use Tab to Autocomplete Commands in the Command Line

Use Tab to Autocomplete Commands in the Command Line


  • When at the MS-DOS, Windows command line or a Linux or Unix shell, typing in long file names or directories can become a burden. Use the Tab key to autocomplete the names of directories and files while in the command line. Below are a few examples of how this can be done.

    MS-DOS and Windows command line users

  • While at the prompt, typing in one or more letters a file or directory name contains will autocomplete the name in alphabetical order. For example, when at the C:\> prompt, type the command below.

    cd p

  • After the command above has been typed, instead of pressing the Enter key, press the Tab key. When you press the Tab key, the first directory that begins with "p" will be automatically typed into the command. Continuing to press the Tab key will cycle through all available directories, including the "Program Files" directory. This shortcut can be used any time you need to type a file name or directory in a command.

    Tip

  • If you type one or more beginning letters for a file name or directory that does not exist in the current directory, the Tab key will not autocomplete.

    Most Linux and Unix users

  • Depending on your variant of Linux or Unix and if you're remotely connecting to a Linux box, how the Tab key is used for autocomplete can change. However, below is a general run down on how this is commonly used in Linux. At the prompt in your home directory, type the command below.

    cd p

  • Assuming your home directory has "public_ftp," "public_html," or another file or directory that begins with "p," you are shown all available files and directories. If you continue to type the next letter available, for example, "cd pu," the command will complete the remaining of the file name or directory up to the point there is no conflict. If you had both directories mentioned earlier in the current directory, it would autocomplete up
    to "public_" because there are two directories beginning with "public_". Pressing the Tab key again shows you the remaining available files beginning with "public_". If you wanted to type "public_html," add a "h" and press Tab to complete the directory name.


    What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts

    Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids

    Cabin Crew Jobs & Career Advice » Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions

    Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes »Scholarships in UK » Scholarships in USA Scholarships in UK »

  • Click here to post comments

    Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.