Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I perform a command on the selected items ?

for example calling vim, or gimp for the 5 text or image files selected.

I tried to make use of the inlined command line at the bottom, but it doesn't take my selection into account

share|improve this question
up vote 7 down vote accepted

Press F2 for user menu and then choose Do something on tagged files or press @. In popup window you can provide your command.

It is important to notice that for each file command will be executed separately. It will be something like:

for file in files:
   COMMAND file


COMMAND file1 file2
share|improve this answer
this also works when the cursor is on a file but it is not selected – törzsmókus Mar 27 '15 at 16:34

For one-liners, use "%t" at the command line, which gets substituted for a list of your selected items.

for F in %t; do echo "${F} is selected"; done
cp %t /var/somewhereelse/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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