An interesting point to make after reading uncleozzy's excellent node is that if you mean to record your guitar or bass direct (ie. without using an amp), you'll need some kind of adapter to match up the high impedance of the instrument's pickups to the (comparably) low Z of most microphone/line inputs.
This is not to be overlooked since the aforementioned impedance mismatch will cause a noticeable degradation of the instrument's tone.
There exists something called a DI box which, amongst other functions, does exactly what's called for in this situation.
You may, however, not own one of those.
A viable alternative which most bedroom guitarists will have at hand is a stompbox.
These days, most effect units (except perhaps for reissues of vintage models) use electronic switching circuitry to allow selecting between effected and bypass modes.
The good thing about this is that the instrument's signal is buffered at the input, therefore eliminating the impedance mismatch problem; you can then run the output of the bypassed stompbox into the line input of your soundcard and enjoy the true sound of your guitar.