When I want to quickly write something to a file that either get's pasted or manually input from the terminal, a quick cat > something.txt
and Ctrl+D to close, is a nice shortcut.
However of course this does not allow you to move the cursor around in case there is a glaring error, so your stuck opening a text editor such as vim or nano. However these take up your screen unless you use a terminal muxer and it's slightly inconvenient/overkill for my use case.
Is there an alternative to cat that allows you to move the cursor? Some kind of micro editor that doesn't grab your screen and is literally just a text buffer until you Ctrl+D it?
My greater use case is I made a little helper script so I can type hel SomeScript
in a terminal and it will automatically make a script with that name in my ~/bin
which is in my path, add the shebang to the top, and chmod+x
when I'm done. I used cat > ~/bin/$1
to start and decided I would make too many mistakes and switched to nano, but since it grabs the screen I can't see what I've been doing in the terminal prior to that without scrolling back and also I keep trying to use vim keys since I'm in an editor lol.
man ed
(orman sed
).