Saturday, October 17, 2020

getting filenames/pathnames

Here's a tip on how to quickly copy and paste the full path of a file from GNOME's Files (aka nautilus) onto the command line in Terminal (aka gnome-terminal): Drag And Drop Files And Folders In Terminal To Print Their Absolute Path

Not all terminal emulators will support this, but it also works with KDE Plasma's Konsole.

I found that this trick also works for copying the absolute pathname of a file from my preferred file manager, Double Commander, into gnome-terminal.

Double Commander offers a few other options for copying filenames. In this shot I've got the ~/scripts directory selected, and I can copy the filename to the clipboard via a menu entry (Mark > Copy Filename(s) with Full Path or Mark > Copy Filename(s) to Clipboard):


 

Even nicer, buttons for those actions can be placed on Double Commander's toolbar:


Very handy. From the clipboard, the filenames can be copied to the terminal emulator with the Ctrl+Shift+V keystroke.

The menu entries in Double Commander show keystroke hints for yet another way of doing this:

Ctrl+Shift+X - copy filename to clipboard
Ctrl+Shift+C - copy absolute pathname to clipboard

I've found it worth my time to practice those keystrokes a few times to get my fingers used to 'em. And, again, after copying:

Ctrl+Shift+V - paste from clipboard to terminal emulator


No comments: