How to use terminal to copy a file to the clipboard? I got a file on desktop, file name is ded.html. To copy the file, I click the file and press cmd+c.

Now how would I do the same thing using terminal ?
If I'm understanding the question right, what you're after is pbcopy and pbpaste.
Open a terminal and run:
cat ~/Desktop/ded.html | pbcopy

The file is now in your clipboard.
To put it somewhere else (i.e. paste it) run:
pbpaste &gt; ~/Documents/ded.html

Now you should have a copy of ded.html sitting in ~/Documents.