I’m more of a casual/newbie Linux user and I want to know if a specific Brother model is compatible with it. For reference, it’s the HL-L2465DW monochrome laser printer.
I’m more of a casual/newbie Linux user and I want to know if a specific Brother model is compatible with it. For reference, it’s the HL-L2465DW monochrome laser printer.
As a Linux noob I like your oneliner but I agree with @[email protected]
A more approachable way to do that would be to use
wgetand then manually runapt installwith the downloaded file. That’s what I’ve been doing. :) Yours is “magic” ;)Fair enough. Let me quickly go through the one-liner, command-by command
# Joined by `&&`, bash runs these commands in sequence (as if run individually in shell), but exits/stops execution early if any command fails (return nonzero) TMP_DEB=$(mktemp --suffix=.deb) && curl -sSL "https://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hll2465dw_us&os=128&dlid=dlf106036_000&flang=4&type3=10283" -o "$TMP_DEB" && sudo apt install -y "$TMP_DEB" && rm -f "$TMP_DEB" # Going command by command: # First, we create a local variable in the shell, named `TMP_DEB` # We assign the value to `$(...)`. This stores the string output (to stdout) of running the command `mktemp ...` to `TMP_DEB` # `mktemp` creates a temporary file and prints its name, which uses the name template `tmp.XXXXXXXXXX` # `--suffix=.deb` flag appends `.deb` to the name template TMP_DEB=$(mktemp --suffix=.deb) # At this point, we've created a temporary file, and saved the name to a variable in bash # Next, we download the file using curl. `-s` makes output silent, `-S` shows errors in output, and `-L` follows redirects # note the url doesn't end in `.deb`, implying that we will be redirected by the web server to the file path. without -`L` curl will download a page that stores the redirection response from the web server, not the .deb package # `-o "$TMP_FILE"` forces curl to store the downloaded file to the tmp file we created # note the quotes around the variable expansion. `$TMP_FILE` would also resolve the string stored in the variable, but we use quotes to avoid string globbing (google this) curl -sSL "https://support.brother.com/..." # Next, we install the package with apt # note: we use the string stored in the variable `TMP_DEB`, the filepath to the temp file we created, and downloaded the deb package # `-y` flag skips the confirmation question "install package [y/n]: ` sudo apt install -y "$TMP_DEB" # Finally, to clean up we delete the tmp file rm -f "$TMP_DEB"