1

How is it possible to get an addressable list of files in the terminal, that can be used later on. In the terminal it would be nice having the following work flow by using a tool (like ls):

1:Population and Other Problems (China National Publications).pdf
2:Weeds in a Changing World (British Crop Protection Council).pdf
3:The Joy of Chickens (Prentice Hall)- 1.pdf
5:The Joy of Chickens (Prentice Hall)- 2.pdf
6:The Weather God ist not nice.pdf
8:The Joy of Chickensoup.pdf
9:FolderBC.png
$ 

Then I could simple do for example:

rm 5:

Instead of having to write:

rm 'The Joy of Chickens (Prentice Hall).pdf'

By using - as suggested by Pilot6 - Tab it is possible to have autocomplete, but if you have similiar names you still have to write quite much. Is there a other lazy way?

TimK
  • 163

2 Answers2

6

I do not see that any new tool is needed. There are enough tools for this.

  1. Use autocomplete in a terminal. Type rm T and press Tab. You wil get the full file name. Maybe you will need 2-3 first letters if there are other files starting with T.

  2. You can install Midnight Commander and interactively select files for deletion in a terminal.

It can be installed by sudo apt install mc. To start it run mc.

Select any number of files to delete by Insert and delete by F8.

There may be lots of other ways of doing this.

Pilot6
  • 92,041
0

The answer I marked as correct is answering my original question.

But I also found a better solution for me:

How to make terminal autocomplete when there are several files/directory?

You can use just use the Tab-Key to “tab” through the results as list. This is absolutely awesome. (You can also go back in the list)

Edit: Alternative you could switch to Fish-Shell. It has more function for autocomplete and I really like it.

TimK
  • 163