Recently, i'd copied some text from browser and i was too lazy too go and paste it in file by using file explorer. i was wandering if i can paste it directly to the file by just using terminal and some commands. any suggestions?
Recently, i'd copied some text from browser and i was too lazy too go and paste it in file by using file explorer. i was wandering if i can paste it directly to the file by just using terminal and some commands. any suggestions?
You can use
cat
, with a here document e.g.hit Enter then paste from the default buffer with a middle click or standard terminal emulator shortcut Ctrl+Shift+V, and terminate the input with Ctrl+D.
Ex.
Use
>>
in place of>
if you want to append tosomefile
instead of overwrite it.You can use
xclip
(sudo apt install xclip
) for that:-se c
– use thec
lipboardse
lection, leave out or change to-se p
to use the default buffer instead (the default buffer holds the last thing you selected, e.g. by double-clicking a word)-o
– print to stdout>out
– redirect stdout to file namedout
overwriting it, change to>>out
to append to the file's contentSee
man xclip
(How can I get help on terminal commands?) for more.