Sunday, May 12, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 1460  / 3 Years ago, fri, august 13, 2021, 7:54:59

Suppose I'm browsing a directory from command line with lots of files with long names.
Is there a easy/fast way to open the first file from the directory, or simply any of these files? In my case they are pictures, so if I'm able to open one of them, I can browse the pictures from the application (eog, for instance). Completion doesn't help in this case, as the pictures are named with a similar prefix and the suffix is a date -- so completing one filen name ends up taking some time. I know, it's just some seconds.. but the idea of using command line is to be fast, right?



Thanks!


More From » command-line

 Answers
1

This should work:



vi `ls | head -1`


Opens vi with the first file (or folder) in the current working directory as parameter.


[#26140] Friday, August 13, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alliulet

Total Points: 46
Total Questions: 109
Total Answers: 97

Location: Svalbard and Jan Mayen
Member since Sat, Oct 10, 2020
4 Years ago
;