Ubuntu: How to open new doccument tab in gedit and send text flow into it from terminal?



Question:

I want to make Krusader User Action which lists selected files. I know I can do it in terminal like ls -1 > list.txt and than delete unwanted. But I'm looking something like gedit newDoc.txt < %aList("Selected")%.

I checked Gedit help and Google. Did not found how to send text in Gedit, only how to open new documents or existing documents. Is my idea possible at all?

When I try gedit newDoc newText it creates two tabs with name "newDoc" and "newText".

ps: how to list files in current dir with full paths like in TotalCommander?

UPD:
%aList("Selected")% | gedit - â€" does not work


Solution:1

Indicate that gedit is supposed to read from standard input, by specifying - as an argument:

ls | gedit -  

To list absolute paths:

printf "$PWD/%s\n" * | gedit -  

$PWD contains the absolute path of the current directory.

I don't know what krusader is, but assuming a krusader user action is like a Nautilus action, you might have to wrap the command in sh -c, and perhaps escape %:

sh -c 'printf "$PWD/\%s\n" * | gedit -'  

Replace * with appropriate placeholders (which would be %F in Nautilus Actions.)


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »