How to use bash Tab complement well for file/folder names such as Date_Content

Asked 2 years ago, Updated 2 years ago, 361 views


If the current directory has a subdirectory similar to the following: cd20220123_EEE to move.
In this case, tab completion does not work well (you must enter 20220123_E).

20220120_AAA
20220121_BBB
20220122_CCC
20220123_DDD
20220123_EEE
20220125_FFF


I wish I could go to a directory that contains EEE
Is there a good way?Or do I have to change the directory naming convention?

bash

2022-09-30 22:03

2 Answers

$cd*EEE_

(_ indicates where the cursor should exist, not the actual input.)
If you enter ESC* (or Ctrl+[**), the *EEE part just before the cursor will be expanded into a global web.

$cd20220123_EEE

It will be rewritten to .This is insert-complets.


2022-09-30 22:03

The Tab completion of bash usually complements up to the confirmable string, so if you have more than one candidate, the Tab key will list the remaining candidates.
While checking the list, enter the following characters and press the Tab key to continue complementing to a certain extent.


2022-09-30 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.