copy nano to clipboard code example

Example 1: copy cat command output to clipboard

# This can either be done with xclip or an npm package called clipboard-cli

# With xclip, you would need to sudo install xclip, then use it as so
cat file.txt | xclip

# To paste using sclip
xclip -o

# With the clipboard-cli npm package

# first install globally
npm install --global clipboard-cli

# Then it can be used as follows
cat file.txt | clipboard-cli

# To paste
clipboard

Example 2: copy content to clipboard windoesa

clip < file.txt