Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 13807
Next
In Process

askthedev.com Latest Questions

Asked: September 26, 20242024-09-26T23:58:33+05:30 2024-09-26T23:58:33+05:30In: Ubuntu

How can I send a print job from the terminal in Ubuntu? What commands or utilities can I use to achieve this?

anonymous user

I’ve been experimenting with printing from my terminal in Ubuntu, and I could really use some help. I’ve seen a few different ways to do it, but nothing feels quite right yet. I mean, it seems like there should be a simple command or utility to help with this, but I’m not sure which one to use.

For instance, I know you can send files to printers via the command line, but I’m a little lost about the specifics. Can I just use a direct command to send a PDF or a document file straight to the printer, or do I need to do some setup first? I’ve read about the `lp` and `lpr` commands, but I’m not exactly sure how they work or which one I should choose. Are there any particular flags or options I need to keep in mind when using these commands?

Also, I’ve come across the CUPS (Common UNIX Printing System) interface, which sounds pretty powerful, but is it necessary to go through the GUI to set things up? Honestly, the terminal feels more natural to me, so I’m hoping there’s a straightforward way to do this without having to click around too much. I mean, I love the efficiency of the command line, but it can be a bit intimidating sometimes when I don’t know what I’m doing!

If you’ve ever had to print from the terminal, how did you go about it? Are there any shortcuts or tips you’d recommend? Or maybe you’ve run into a few snags along the way and found some workarounds. I’d love to hear about any experiences you have! Sharing your commands or any scripts that work for you would be super helpful too. I’m just trying to get a grasp on all of this, and I think your insights could really steer me in the right direction. Plus, it might be useful for anyone else who finds themselves in the same boat! Thanks!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2024-09-26T23:58:34+05:30Added an answer on September 26, 2024 at 11:58 pm



      Printing from Terminal in Ubuntu

      Printing from Terminal in Ubuntu

      Printing from the terminal can be a bit tricky at first, but once you get the hang of it, it’s actually pretty straightforward!

      Basics: lp vs lpr

      So, lp and lpr are the two main commands you’ll likely use. Both can send files to your printer, but here are some quick tips:

      • lp: This is probably the more modern command. You can use it like this:
      • lp filename.pdf
      • lpr: This is the older command, and it works pretty similarly:
      • lpr filename.pdf

      Sending Files

      You can just send a PDF or another document straight to the printer with either of those commands. Just make sure your printer is set up and recognized by Ubuntu!

      Flags and Options

      Some useful options you might want to use:

      • -P printer_name: Use this if you have multiple printers. Example: lp -P MyPrinter filename.pdf
      • -n number: If you want to print multiple copies, you can specify how many. Example: lp -n 3 filename.pdf
      • For a full list of options for lp, check it out using man lp in the terminal, or man lpr for lpr.

      CUPS and GUI

      CUPS is great, and it usually runs in the background on Ubuntu, making your life easier. But no need for the GUI if you prefer terminal commands!

      You can usually set up your printer with just a few commands. Run this to check printer status:

      lpstat -p

      Final Tips

      Here are a few tips based on my experience:

      • Always check if your printer is connected and recognized with lpstat -p.
      • If something goes wrong, sometimes restarting the CUPS service can help: sudo systemctl restart cups.
      • Feel free to use lpq to check the print queue, and lprm to remove jobs if needed.

      Experimenting is key! Don’t be afraid to try different commands and check the man pages when you’re unsure. Happy printing!


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2024-09-26T23:58:35+05:30Added an answer on September 26, 2024 at 11:58 pm


      Printing from the terminal in Ubuntu can indeed be done using commands like `lp` or `lpr`, and both are part of the Common UNIX Printing System (CUPS). To print a document or a PDF directly, you don’t need extensive setup if your printer is already configured in CUPS. You can use a command like `lp filename.pdf` or `lpr filename.pdf` to send the document to the printer. The basic syntax of both commands is quite straightforward: just specify the file you want to print. However, you might want to explore additional flags that can modify print settings. For instance, with `lp`, you can use `-d printer_name` to specify a particular printer or `-o fit-to-page` to scale content to fit on the printed page. The `lpr` command also has options like `-P printer_name` for specifying a printer and `-#, ##` for specifying the number of copies.

      As for using CUPS, while it does have a web-based GUI for configuration, you can manage everything through the terminal. You can view available printers using `lpstat -p` and configure printer settings with `lpadmin`. Many users prefer the terminal for efficiency, and once you become familiar with these commands, printing becomes a breeze. If you’re looking for shortcuts or tips, consider creating shell scripts for frequent print jobs, allowing you to streamline the process even further. For example, you could write a simple bash script that accepts a filename and automatically sends it to your preferred printer with your desired settings, thus avoiding repetitive command typing. The more you use it, the more intuitive it will become, and the command line will feel like a second nature.


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this issue?
    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?
    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. Has anyone experienced this issue ...
    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?
    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else encountered this problem, and what ...

    Sidebar

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this ...

    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?

    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. ...

    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?

    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else ...

    • How can I configure a server running Ubuntu to bind specific IP addresses to two different network interfaces? I'm looking for guidance on how to ...

    • Is it possible to configure automatic login on Ubuntu MATE 24.04?

    • After upgrading from Ubuntu Studio 22.04 to 24.04.1, I lost all audio functionality. What steps can I take to diagnose and resolve this issue?

    • I am experiencing issues booting Ubuntu 22.04 LTS from a live USB. Despite following the usual procedures, the system fails to start. What steps can ...

    • I'm encountering a problem with my Expandrive key while trying to update my Ubuntu system. Has anyone else faced similar issues, and if so, what ...

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.