How to generate f(x)=x curve in Tikz from 0 to 10 with small straight lines at (1,0), (2,0) etc at x axis and (0,1), (0,2) etc at y axis?
The easiest solution is to use
See the manual for additional options such as titles, legend,marks etc.
You can also stay in the TikZ notation but your ammunition will be limited.
If you wish to only use tikz and not pgfplots, here are two methods to get ticks along the axes, which is what I am assuming you are trying to get. I hope the code is self-explanatory.
The code is
The result is