How to open terminal output with a texteditor without the creation of a new file?
Many programs conventionally use -
to mean standard input or standard output. Thus, you can open the screen output of a command in nano using -
as the file name, as in:
ls | nano -
This will only work if your program does support that convention. This includes nano
and vi
on the terminal. Even the graphical text editor gedit
supports it. However, pluma
or mousepad
do not support it, and instead will be instructed to create a regular file named -
. In other cases, you cannot get around creating a regular intermediate file first.
If viewing with tilde is really needed, you may script your idea
Create a function in your .bashrc
function tildeIt () {
tmpfile=$(mktemp)
"$@" > $tmpfile
tilde $tmpfile
rm $tmpfile
}
# $@ is all words typed after tildeIt
# mktemp creates a temp file and returns his fullname
Reload .bashrc
source ~/.bashrc
Usage
tildeIt command -option