How to copy/paste text in the UNIX terminal
From NMR Wiki
(Difference between revisions)
Line 16: | Line 16: | ||
cat | sort | uniq >> file | cat | sort | uniq >> file | ||
+ | |||
+ | The pipeline can be built to your specific needs. | ||
[[Category:Unix]] | [[Category:Unix]] | ||
[[Category:User guides]] | [[Category:User guides]] |
Revision as of 19:12, 19 March 2010
To copy - select range of text with the mouse (on some systems you may have to hit Ctrl-C or Apple-C to copy; on Linux selected text is automatically placed onto the system clipboard).
To paste into a file in the Unix command line there are three steps:
- type either "cat > file_name" or "cat >> file_name". In the first case file will be overwritten, in the second case pasted text will be appended to the file.
- actually paste - the action depends on the type of your terminal. In most cases clicking middle mouse button over the terminal screen will work. In Windows-based PUTTY ssh terminal it's right-click
- type in "end of file" command - usually Ctrl-D
Using Unix pipes gives extra flexibility.
For example you can append sorted copied contents to the file this way:
cat | sort >> file
or even just unique lines from the copied content:
cat | sort | uniq >> file
The pipeline can be built to your specific needs.