Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 01-09-2005, 06:13 AM   #1
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Rep: Reputation: 18
Permanent Command Aliases - Slackware 9.1

Hi all,

I'd like to set up a couple of permanent command aliases on a laptop running Slackware 9.1. As I understand it, global command aliases should be added to the /etc/profile file in order to make them permanent and have them available to all users. So, I added these lines:

alias dtp="lpr -o page-left=72 page-right=72 page-top=72 page-bottom=72 cpi=12"
alias wallpaper="display -geometry 800x600+0+0 -window root"

The first command is to dump a plain text file to my printer with one inch margins and 12 characters per inch ( I use CUPS as my print spooler). The second is to set a desktop wallpaper - I use fluxbox and the default wallpaper utility, fbsetbg, keeps generating errors.

So... having added these lines to the /etc/profile file, I logged out and logged back in again. Testing the dtp command results in an error message stating that the directory page-left=72 couldn't be found.

As for the wallpaper command - I tested it first in a plain text console and got an error message saying that the X Server wasn't running. This is fine - it implies that the alias was at least recognised. However, once I started X and tried the command from an xterm, it wasn't recognised.

Can anyone provide any hints as to where I'm going wrong?
Old 01-09-2005, 06:33 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
For xterm, try to start it with :
xterm +ls

(ls = login shell, so /etc/profile is loaded)

for the dtp alias, you may have to quote the option

lpr_opts="-o 'page-left=72 page-right=72 page-top=72 page-bottom=72 cpi=12'"
alias dtp="lpr $lpr_opts"

Did you test your lpr command with these options to see if it works before ?

Just checked the xterm option, it works with :
xterm -ls

Last edited by Cedrik; 01-09-2005 at 06:39 AM.
Old 01-09-2005, 09:41 AM   #3
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Original Poster
Rep: Reputation: 18
Hi Cedrik,

Yes, I have tried the lpr command with all of the options and it worked fine before. I had to enclose the options in quote marks, but it worked. If I understand correctly, your suggestion is to store the options in a global variable, then invoke the command using the variable? I'll give it a bash anyway* and see what happens. I'll also try the xterm suggestion. Thanks!

* Ouch! No pun intended.
Old 01-09-2005, 03:08 PM   #4
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Original Poster
Rep: Reputation: 18
Update: I have amended my /etc/profile file as suggested, and both aliases work perfectly.

Caution! For anyone else reading this, please note the single quotes inside the double quotes in Cedrik's suggestion for lpr, on the line beginning lpr_opts. It won't work without them. See, my laser printer is a cheap ol' Samsung and has a tendency to leave flecks of toner on the printout... and I thought the single quotes were toner flecks at first, and ... mumble mumble mumble...

Anyway! All is right with the world now...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Permanent Alias In Slackware dmcbeing Linux - Software 2 11-10-2005 11:18 AM
Permanent aliases Acetylcholine Slackware 6 01-06-2005 03:29 PM
making aliases via command line MACSRULE *BSD 1 04-07-2004 03:14 PM
Making Changes Permanent T-u-N-i-X Linux - General 1 09-01-2003 05:47 AM
getting permanent color for ls? JapKraut Linux - Newbie 7 09-13-2001 09:43 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration