How to Reverse Line and Character Order in a File in Linux

There are some tasks that are very commonly required when it comes to text manipulation. One such task is reversing lines in a file. When we say reversing the lines, it can mean two things: reversing the order of lines in a file or reversing each line in the file character-wise.