Saw this on reddit and it’s a god send.
switch to root followed by:
echo 'a4' >> /etc/papersize
Source here:
Saw this on reddit and it’s a god send.
switch to root followed by:
echo 'a4' >> /etc/papersize
Source here:
A question that never got asked I guess. The file already exists, with no size specified in my builds, and more importantly, the information you need is available by entering in a terminal:
man papersize - which details what should be recognized, and warns of further requirements possible in some apps. Good to point it out, though!
I would have never known that there would be a man page for papersize.
though I have to admit I’m more likely to google than try the man pages.
Personal printer have been around a long time - so there have been attempts to make it work right! BTW - Thanks Apple, for cups - it beats the heck out of hand editing printer driver config files! (doublestrike ON, doublestrike OFF, superscript ON…)
I had a slight detour:
/etc/papersize
… “Letter”At least, that worked for me:
http://localhost:631/admin/
Why why do you lot make things hard for yourselves, it should be all set when you install the OS
A bit off topic, but remotely relevant. You don’t have to be root in order to redirect to a root owned file. You can do it with sudo tee
.
So, instead of:
$ su
Password:
# echo TEXT >> FILENAME
# exit
$ _
You should do this:
echo TEXT | sudo tee -a FILENAME
The option -a
means “append” and is equivalent to >>
. Without it, the file will be overwritten, same as using >
.
For example, when I’m refreshing my mirrorlist with reflector, I do this:
reflector --score 20 -f 20 -a 2 | sudo tee /etc/pacman.d/mirrorlist
(note, I want the file to be overwritten, so I don’t use -a
), followed by the obligatory sudo pacman -Syyu
, of course.
way over my head
It’s simple, really.
If you have the permission to write to a file file
, you can do this:
command > file
This redirects the output of command
from stdout (i.e. printing on the screen) to a file. However, if the file is owned by root, you can’t do this:
sudo command > file # WRONG!
Because this elevates the privileges of command
but not of the redirection itself, which is performed by the shell, which you run as your user account. So the solution proposed in the op is to run a shell session as root (presumably using su
). This is typically not advised.
However, you can do this:
command | sudo tee file
This pipes the output of command
into the stdin of the tee
command, and the tee
command is run with root privileges, so it can write to a root-owned file.
What tee
does is really simple, but genius (true to UNIX philosophy): it takes whatever it receives on its stdin (standard input, output of some other command piped to it) and writes it to two places: to a file provided as an argument and to stdout (standard output, typically the screen). Hence the name tee
, as in T-junction of pipes: