Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

as title, I made in VIFM a simple command to backup the content of a directory - from the Desktop to an external SSD drive

command! backupOnSSD  rsync -av --delete /home/bob/Desktop/personal_data/ /media/bob/SanDisk/personal_data/

The command works fine.

For long backups, can I detach the command so that it runs in a new terminal?

This would allow me to do two things:

1) continue to use VIFM during the backup

2) see the backup result in the new terminal

Does anyone have any ideas?

thanks

1 Answer

0 votes
by
selected by
 
Best answer

Several options

Start a terminal explicitly

Example:

command! backupOnSSD  xterm -e rsync -av --delete /home/bob/Desktop/personal_data/ /media/bob/SanDisk/personal_data/ %i

Run the command in background

command! backupOnSSD  rsync -av --delete /home/bob/Desktop/personal_data/ /media/bob/SanDisk/personal_data/ 2>&1 %i

Then use e in :jobs menu to check on it

Terminal multiplexer

If you use GNU Screen or tmux, you can enable integration via :screen command (covers tmux as well) in which case the external command will be started in a new window by default.

by

@xaizek

Thanks to you I have just discovered XTERM which I have just adopted !

The solution you suggested works well, it helped me a lot :

command! backupOnSSD  xterm -e rsync -av --delete /home/bob/Desktop/personal_data/ /media/bob/SanDisk/personal_data/ %i

I've customised it a little so that the XTERM window stays open at the end of operations :

command! backupOnSSD  nohup xterm -hold -e rsync -av --delete /home/bob/Desktop/personal_data/ /media/bob/SanDisk/personal_data/ %i

I added this command to : /home/bob/.config/vifm/vifmrc

by
edited by

Hi everybody,

after making

command! exiftoolterminal nohup xterm -hold -e exiftool %f %i

the external terminal XTERM stays open, without shell prompt.

Is there a way to have the data and the prompt at the end like:

...
...

   Modify Date                     : 2026:04:09 21:01:17.558659
Thumbnail Image                 : (Binary data 20064 bytes, use -b option to extract)
Circle Of Confusion             : 0.027 mm
Field Of View                   : 154.9 deg
Focal Length                    : 3.6 mm (35 mm equivalent: 4.0 mm)
Hyperfocal Distance             : 0.24 m
Light Value                     : -0.1



    bob@alice:~$
by

Hi,

try this:

command! exiftoolterminal nohup xterm -e bash -c "exiftool $(printf %%q %f); exec $SHELL" %i
by

@xaizek thanks for the answer. it helps a lot.

working for one file

command! exiftoolterminal nohup xterm -e bash -c "exiftool $(printf %%q %f); exec $SHELL" %i

Improved version with array to work with multiple previously selected files

command! exiftoolterminal nohup xterm -e bash -c 'files=(%f); for f in "${files[@]}"; do echo "========================================"; echo "File: $f"; echo "========================================"; exiftool "$f"; echo; done; exec $SHELL' %i
by

Oh, I forgot the space when invoking printf. No need for a loop to handle multiple files:

command! exiftoolterminal nohup xterm -e bash -c "exiftool $(printf '%%q ' %f); exec $SHEL
by

yes, this is it !

command! exiftoolterminal nohup xterm -e bash -c "exiftool $(printf '%%q ' %f); exec $SHELL" %i

don't know if it's possible to search back for a certain word in XTERM terminal, so here's the same command that shows up in the menu, which allows you to search the output with /

command! exiftoolmenu exiftool %f %m
by

don't know if it's possible to search back for a certain word in XTERM terminal

It's not possible with builtin functionality, needs some terminal multiplexer. You could pipe output of exiftool to less, possibly with --quit-if-one-screen parameter.

...