CR and LF
The American Standard Code for Information Interchange (ASCII) defined control-characters including CARRIAGE-RETURN (CR) and LINE-FEED (LF) that were (and still are) used to control the print-position on printers in a way analogous to the mechanical typewriters that preceded early computer printers.
In Windows the traditional line-separator in text files is CR followed by LF
In old (pre OSX) Apple Macintosh systems the traditional line separator in text files was CR
In Unix and Linux, the traditional line-separator in text files is LF.
\n and \r
In many programming and scripting languages
\n means "new line". Sometimes (but not always) this means the ASCII LINE-FEED character (LF), which, as you say, moves the cursor (or print position) down one line. In a printer or typewriter, this would actually move the paper up one line.
\r means the ASCII CARRIAGE-RETURN character (CR) whose name actually comes from mechanical typewriters where there was a carriage-return key that caused the roller ("carriage") that carried the paper to move to the right, powered by a spring, as far as it would go. Thus setting the current typing position to the left margin.
In some programming languages
\n can mean a platform-dependent sequence of characters that end or separate lines in a text file. For example in Perl,
print "\n" produces a different sequence of characters on Linux than on Windows.
In Java, best practise, if you want to use the native line endings for the runtime platform, is not to use
\r at all. You should use
System.getProperty("line.separator"). You should use
\r where you want LF and CR regardless of platform (e.g. as used in HTTP, FTP and other Internet communications protocols).
In a Unix shell, the
stty command can be used to cause the shell to translate between these various conventions. For example
stty -onlcr will cause the shell to subsequently translate all outgoing LFs to CR LF.
Linux and OSX follow Unix conventions
Text files are still enormously important and widely used. For example, HTML and XML are examples of text file. Most of the important Internet protocols, such as HTTP, follow text-file conventions and include specifications for line-endings.
Most printers other than the very cheapest, still respect CR and LF. In fact they are fundamental to the most widely used page description languages - PCL and Postscript.