I am working on the Linux shell, and I usually have to deal with files that have complicated names. For example, I list the files of the current directory using ls
:
MOD11A1.A2012193.h12v03.005.2012196013543.hdf
MOD11A1.A2012193.h12v04.005.2012196013541.hdf
MOD11A1.A2012193.h12v05.005.2012196013541.hdf
And then, if I need to open one of them, I would write:
vim MOD11A1.A2012193.h12v03.005.2012196013543.hdf
The way I do it, is by first selecting the file name from the list provided by ls
, right click, copy it, right click, paste it after vim
.
Is there a shorter way to do this?
Use wildcard expansion, i.e. for the second file:
vim *v04*41*
or, if your shell supports it, tab-completion:
type vim M
; press [Tab], that completes all up to next difference, i.e. OD11A1.A2012193.h12v0
; type 4
; press [Tab], and so on.