How To Run A Command In Ubuntu?

The equivalent of copy prn in ubuntu

  • I currently use an xp computer with the command window (run--> command) to send a file over the parallel port with the "copy prn" command.I haven't been able to figure out how to do this under ubuntu, but need to switch over to using an ubuntu laptop that I have here. Seems like it should be a straightforward task? I am not too clear on what the copy command is doing, really, though, even.

  • Answer:

    In Unix, everything is a file. Your parallel printer port should be available as a "file" under /dev. So if you know the name of the printer device, you should be able to do something like: cp file2copy /dev/lp0 Where lp0 is the name of the printer device (example, your printer may have a different name). The trick may be setting up the device driver (kernel module) to enable this and then knowing what the name of the device is. It might help to have a little more context. Are you just trying to print something?

Nish ton at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

jclarkin has already given you an excellent answer, but to clarify.. Do you really want to do something as low level as "dump this file to the parallel port?" Or are you really asking "how do I print on Ubuntu?" Those are different questions. Honestly, the low level parallel port access is pretty old and retro. The good news is Linux is great at old and retro! You may just need to do a bit of poking to figure it out. On my Ubuntu box the parallel port device is named /dev/parport0. It's configured by the drivers ppdev and parport. So cat file > /dev/parport0 is the straightforward equivalent to the DOS command. If you do want to pursue this option more, it'd be helpful to know a few things. What version of Ubuntu? What does dmesg | grep -i parallel say? And what does lsmod say? If you're just trying to set up sane printing in Ubuntu, https://help.ubuntu.com/community/Printers and the specific guide https://help.ubuntu.com/lts/serverguide/cups.html are good places to start. Fair warning, printing in Unix has traditionally been awkward and complicated. It involves creating print services, and queues, and setting up drivers, and also (usually) filters that convert inputs to the language your printer needs. Ubuntu is pretty good at holding a user's hand through this stuff though.

Nelson

Regarding jclarkin's answer (if indeed you want low level access to the parallel port), the right command would be cat, not cp: cat file2copy >/dev/lp0 But I never use the parallel port like this so maybe I'm introducing confusion.

pantufla_milagrosa

I'm guessing Nish ton is using this for something like an old eprom programmer or other piece of moderately old, specialized tech. It was a pretty common way of getting bits out of a computer back in the day when serial ports were too slow and USB wasn't yet a thing. Nish ton, what is this device you're sending data to?

ryanrs

Are you passing the "/b" switch to the "copy" command on your XP system? If so, then p_m's suggestion is on the money: the Linux equivalent of copy /b file.prn \\HOSTNAME\PRTRNAME would be something like cat file.prn > /dev/lpr where the name "lpr" depends on your system and how it's configured. I'm not much of a Linux jock, if p_m says it's "lp0" that's what I'd go with. If you're not using "/b", then Windows may be translating line endings for you; if that behavior is important, you can get the same effect on Linux via other means.

Rat Spatula

As has been requested above, more details would help a lot. If you're trying to print a file, and you have the printer on the parallel port set up (System Settings → Printers), the command is:lp fileThere's a very good chance that https://cups.org/, the Linux printer system, has nabbed the parallel port for its own use. If this is not a printer, but is some random parallel device that you can feed files to, you'll probably have to stop the printer system before you can write to the device. So, more deets, or we can't help.

scruss

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.