1

Currently, I'm trying to move a file that I mistakenly saved to my home directory, and to do that I'm using a mv command. However, after I typed out the first part of my mv command:

mv lab2prog.c 111/lab/...

I forgot what directory I wanted to move the file in. Usually, I would just backspace the command and go directory exploring, but I recall a co-worker of mine browsing the directories of his system while issuing the command without having to delete the already typed command.

Is there a way to do that, or am I just imagining things...?

4 Answers4

1

Press tab twice to get a list of possible autocompletions in each step. This means you can also see a list of paths starting with, e.g., do by issuing: mv lab2prog.c 111/lab/dotabtab

Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
1

This depends on your shell, most shells will have completion when you hit the TAB key. The easiest way to determine the shell you are running is to echo $SHELL.

Typically you will be using bash (/bin/bash), this answer: How does bash tab completion work? answer gives you some more information about your options for auto-completion. It can be quite sophisticated where the command is taken into account: that is when you press TAB you get a sensible completion. Debian also have a brief introduction for bash:

An introduction to bash completion: part 1

Community
  • 1
  • 1
andygavin
  • 2,784
  • 22
  • 32
0

you can press tab , it will display all possible dirs

ahmadMarafa
  • 1,316
  • 1
  • 13
  • 15
0

I usually can just press the tab key to autocomplete with possible paths, though this may give you a very large output.

0x736a64
  • 126
  • 6