Linux

Printers

Adding a Printer / queue

Setup for Linux

Ensure you are root or sudo’ed

 

Adding Your First Printer from the Command-Line

Run the lpadmin command with the -p option to add a printer to CUPS:

/usr/sbin/lpadmin -p printer -E -v device -m ppd

or

/usr/sbin/lpadmin -p printer -E -v device -P <directory to ppd file>

For a HP DeskJet printer connected to the parallel port this would look like:

/usr/sbin/lpadmin -p DeskJet -E -v parallel:/dev/lp1 -m deskjet.ppd

Similarly, a HP LaserJet printer using a JetDirect network interface at IP address 11.22.33.44 would be added with the command:

/usr/sbin/lpadmin -p LaserJet -E -v socket://11.22.33.44 -m laserjet.ppd

 

Managing Printer Classes from the Web Interface

The Web interface is located at:

http://localhost:631/admin

 

You may need to check CUPS (Common Unix Printer Services) is installed and running

By default cups installs the following directories:

/etc/cups: Configuration directory.

/var/spool/cups/: The spooler directory where print jobs are held for printing.

/var/spool/cups-pdf: The spooler directory where CUPS-generated PDF files are held for printing.

 

CUPS also installs an executable binary in /etc/init.d/ (or /etc/rc.d/init.d) called cups. This binary is started with the command:

/etc/init.d/cups start/stop/restart

 

Create a printer on linux the hard way.

1. To create a printer called mylp for the /dev/lp1 device, open the /etc/printcap file with your preferred text editor. The sd option tells the Linux printing daemon, lpd, where to temporarily place printed (spooled) files. The mx command, used with a value of 0, places no limit on the size of spooled files. Type an entry such as this:

 

mylp:\
:sd=/var/spool/lpd/mylp:\
:mx#0:\
:lp=/dev/lp1:

2. Save the entry, and then create the printer’s spool directory by using the mkdir command:

mkdir /var/spool/lpd/mylp

3. Make sure the directory lp has the correct group ownership and permissions by using the chgrp and chmod commands, as follows:

chgrp lp /var/spool/lpd/mylp
chmod 755 /var/spool/lpd/mylp

4. Test the printer entry with the lpr (line printer command) using the -P option to specify your newly created printer:

lpr -Pmylp test.txt

5. Your printer should activate and print the test document.

 

Setup for IBM AIX

For this operation you need to be logged in as root or sudo’ed

 

run smit.

-> Print Spooling

-> Aix Print Spooling

-> Add a Print Queue

Select options

*     hpJetDirect

*     Other (Select this if your printer type is not listed above)

*     generic      Generic Printer

*     2 Do NOT make this system a BOOTP/TFTP server

Enter name of queue in ONE of the Names of NEW print queues to add – select PostScript if not sure (e.g. HP4050_QUEUE)

Enter HOSTNAME of JetDirect Card (e.g. HP4050_PRN)

Leave port 9100 as that is nearly always right.

 

Create a printer on Aix the hard way.

 

1. Add the printer to /etc/hosts

10.0.0.111 HP4050

2. Add the print queue

Option a) Generic ASCII

     /usr/lib/lpd/pio/etc/piomkjetd mkpq_jetdirect -p 'generic' -D asc -q 'HP4050asc' -h 'HP4050' –x '9100'

where ‘HP4050asc’ is the queue name and ‘HP4050’ is the host name as specified in /etc/hosts

Option b) Generic Postscript

     /usr/lib/lpd/pio/etc/piomkjetd mkpq_jetdirect -p 'generic' -D ps -q 'HP4050ps' -h 'HP4050' –x '9100'

where ‘HP4050ps’ is the queue name and ‘HP4050’ is the host name as specified in /etc/hosts

 

Photoworld on Ubuntu Linux

One of the constant complaints about running Linux at home is how difficult it is to install applications.

I was impressed to see that Photoworld did a linux version of there software. Installation was not too painful. Download a perl script and EULA in a compressed tar.

Extract it with archive manager.
Execute it from the command line with
perl install.txt

Confirm the EULA and exit it.
But once it had been install it immediately did not work.
Running it from command line told me that it could not find libgomp.so
“error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory”

I checked my machine (a 64 bit installation of Linux Ubuntu 11.04) and found the file. I tried adding it to the path, copying and linking the file but all I got from my efforts were
./PHOTOWORLD: error while loading shared libraries: libgomp.so.1: wrong ELF class: ELFCLASS64

Eventually I discovered there is a 386 version of the libgomp library I needed for this application and quickly managed to solve my problems and install it with a

sudo apt-get install libgomp1:i386

Combine to avi files together

On Linux, simply use mencoder

This command says copy using existing audio codec (-oac) and copy using existing video codec (-ovc).

mencoder -oac copy -ovc copy  <file1>  <file2>  -o  <output_file>

Buffers in Vim

45732

I have been a long time user of Vim but started to get into some of the more advanced commands and one of my favourite with vim is the use of buffers and splitting the screen. Please note buffers and screen splitting functionality are only available in later versions of vim – version 5 onwards.

Buffers

You can edit multiple files simulatenously.

:e <filename> – To edit a secondary file

:ls – To list all files you are currently editting

:b<1> – To jump to a specific edited file.

:bn – To jump to the next file in the buffer

:bp – To jump to the previous file in the buffer

These last two commands are nice to place into you vim resource file to map a ctrl sequence onto the commands to quickly move between them.

Screen Splitting

Screen splitting is a step beyond and complimentary to buffers. Screen splitting allows to see the window split across the center of the current file (either horizontally or vertically) and allows you to see the currently editted file. This is extremely useful if you want to see your declarations or definition of a piece of code (especially in the same file). This is much prefered to opening a secondary file as you do not get warnings about swap files nor do you need to keep in mind where you can edit as all edits are to the same file.

<ctrl-w>  s – Split screen (horizontally)

<ctrl-w>  v – Split screen (vertically)

<ctrl-w>  c – Close current screen split

<ctrl-w>  k – Move up a screen split

<ctrl-w> j – Move down a screen split

<ctrl-w> l – Move right a screen split

<ctrl-w> h – Move left a screen split

<ctrl-w> r – Reverse screen splits

 

Screen virtual terminal emulation.

Finally as a tip – If you are working with Linux up can use the screen virtual terminal emulator. This will allow you to swap sessions on a virtual terminal

Use the command screen from a terminal session to start the virtual terminal emulator

Once running you can

<ctrl-a> c – To create a new session (no need to log in another session

<ctrl-a> k – To kill the session

<ctrl-a> ” – To list all your running screen sessions

<ctrl-a> A – Will allow you to name (title) each session

<ctrl-a> 1..9 – Will swap you to a given session

<ctrl-a> d – To detach from the session

If you detach, the screen session will continue to run, you can see what is still running with

screen -ls

then re-attach again if you are running just a single one with no session name, or just enough to make unique if more than on is running.

screen -r [session name]

 

Another use of screen permits you to run a session and let multiple users attach and work in it simulateously. This is done by running against a special resource file

screen -c .my_resource

Create .my_resource containing (for example)

sessionname <The session name>
shelltitle <The session name>

multiuser on

 

 

 

 

 

Automatically Mount Network Drives under ubuntu

6087

Lots of information on the internet about mounting network drives and all the mechanisms of adding to fstab etc.

I prefer to use the gigolo helper which will check every 60 seconds when a drive is available (configurable) and mount it.

sudo apt-get install gigolo

Nautalis (the file manager) will mount drives using its gvfs-mount command.

e.g.

gvfs-mount smb://<server>/<share name>

This mounts the file system in the ~/.gvfs/ sub directory. Took me ages to find that one.

Auto run a program on log in

21345

Specify a program to start on log in to ubuntu add it to the script

/etc/rc.local

Increase size of a linux file system

4646

Sometimes yast will not permit resizing of the file system so use the command line version (as root)

lvresize — Resize the logical volume
resize_reiserfs – Resize the file system
E.g: To add 2.5 gig to the filesystem fred
lvresize -L +2.5G /dev/dai/fred
resize_reiserfs /dev/dai/fred

Ubuntu 10.04 Lucid Lynx creating VPN tunnel to Windows server

917

Creating a VPN server on Ubuntu 10.04 Lucid Lynx is relatively easy but unless the correct advanced settings are properly configured you will probably get connection failed every time.

  • To create a VPN, click on the network icon (top right near volume controls and mail).
  • VPN Connections option
  • Configure VPN
  • Add
    • Enter the VPN details as normal and check you password is correct
  • Using the advanced menu
    • Select (on) Use Point-to-Point encryption (MPPE)
    • Uncheck EAP (will be automatically unchecked when you tick the Use point-to-point.

Ok and save all of that and just select the VPN just created and hopefully that will connect successfully.

To check the version of linux you are using

459

To check the version of linux you are using
uname -r

To check the release of the version of linux you are using

llsb_release -a

Installing Fedora 12 on virtual box

402

Ensure you have enough memory to run the install fedora 12 to hard disk. 384mb was not enough to run the graphical installer.
Run the install as root su -
To install the VirtualBox Additions ensure you have the development build stuff. yum install patch binutils make automake autoconf gcc kernel-devel dkms
Set the KERN_DIR which is the error repported in the //var//log//vboxadd-install.log log file
export KERN_DIR=//usr//src/kernels//2.6.32.10-90.fc12.i686
The run the vbox additions appropriate for your environment.
cd /media/VBOXADDITIONS_3.1.2_56127
./VBoxLinuxAdditions-x86.run

However I kept experiencing this not actually working despite following all instructions. I eventually found that the symbolic link to the fedora release was incorrect in /lib/build/????
a problem with modprobe failing to build. This turned out that //lib//modules/2.6.31.5-127.fc12.i686//build is a symbolic link that was incorrectly linked to //usr//src/kernels//2.6.32.10-90.fc12.i686
and correcting that link allowed the kernel to build.
Finally ensure you are up to date with all security patches and fixes by running yum update
I then needed to reboot reboot

Go to Top