Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Whenever I was to store something to show someone here, I run

command-with-output | pastebinit.

That returns the link to the paste online. For example:

echo sometext | pastebinit

gave me the link

Which I can share. How can I do this with a file - for example a log file. Surely I don't have to open - > copy all - > open -> paste it?

share|improve this question

marked as duplicate by Rinzwind, Pandya, Oli Aug 22 '14 at 9:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Is it a dupe? Different question, same answer. – Tim Aug 22 '14 at 9:22
yeah it is :D Yay 5 ahead of Oli >:D That one might be better changed to a more generic question. – Rinzwind Aug 22 '14 at 9:24
up vote 7 down vote accepted

cat is the command to do that:

cat filename | pastebinit

From man cat:

cat - concatenate files and print on the standard output

    -A, --show-all
          equivalent to -vET
   -b, --number-nonblank
          number nonempty output lines
   -e     equivalent to -vE
   -E, --show-ends
          display $ at end of each line
   -n, --number
          number all output lines
   -s, --squeeze-blank
          suppress repeated empty output lines
   -t     equivalent to -vT
   -T, --show-tabs
          display TAB characters as ^I
   -v, --show-nonprinting
          use ^ and M- notation, except for LFD and TAB

   With no FILE, or when FILE is -, read standard input.
share|improve this answer

I'd personally use cat (per Rinzwind's answer) but there's also an -i flag:

pastebinit -i [filename]

From man pastebinit:

       -i [filename] Use filename for input
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.