Final answer:
To print a file in vi editor, save the changes first and then use the lp or lpr command in the terminal.
Step-by-step explanation:
To print a file while you are in the vi editor, you need to save the changes to the file first. Press the Esc key to switch to command mode. Then, type :wq and press Enter to save and exit the vi editor.
Once you are out of the vi editor, you can use the lp or lpr command to print the file. For example, if the file name is myFile.txt, you can simply run lp myFile.txt or lpr myFile.txt in the terminal to print the file.