If your Linux system uses CUPS, you can change the default printer for Firefox or Mozilla with this command:
lpoptions -d printer-name
The ‘d’ option sets the default printer.
If you want to set a default printer for command-line programs, I’d set a variable in your shell start-up configuration file. If your shell is bash (which is the most common), you’d use the syntax in your ~/.bashrc file:
If you use csh or tcsh, put this in your ~/.cshrc or ~/.tcshrc files:
setenv PRINTER printer-name
If you’re a csh person, you might ask the difference between
set PRINTER=printer-name and
setenv PRINTER printer-name. The difference is that set makes a regular variable, and setenv creates an environmental variable. Regular variables are available only within csh. With an environmental variable, any program that you run from csh can also see the environmental variable.