1

Edit: Using bash.

I am in a directory that has several files in it. As a quicker method than typing it out, I would like to get one of those file names to "type itself" on the command line.

So far, my command is

mv

I would now like to "select" a file name to "populate" onto the command line.

7
  • 1
    Hit Tab twice. and your shell ( to find out echo $SHELL or getent passwd $USER | cut -d: -f7) will show you your choices.
    – waltinator
    Feb 21, 2019 at 16:24
  • 1
    It now lists each file on a separate line below the line where I typed the command. But, how do I get one to populate on the command line (besides highlight and copy). Feb 21, 2019 at 16:30
  • 3
    You should type the first few characters of the filename, and hit Tab again. If what you typed uniquely specifies 1 file, that filename will be filled in, if not, you'll see another list.
    – waltinator
    Feb 21, 2019 at 16:33
  • I don't know of a shell that does that by default, you can do it with dialog (eg this). Or perhaps use something like mc, select file with cursors and then F6 to move/rename.
    – pbhj
    Feb 21, 2019 at 16:42
  • 1

1 Answer 1

0

Hit Tab twice. and your shell ( to find out echo $SHELL or getent passwd $USER | cut -d: -f7) will show you your choices.

Then, type the first few characters of the filename, and hit Tab again. If what you typed uniquely specifies 1 file, that filename will be filled in, if not, you'll see another list.

1
  • I am finding that you don't need to press tab twice as the first step. Do you want to edit that part out? Feb 21, 2019 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.