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

Notices


Reply
  Search this Thread
Old 08-22-2010, 09:15 AM   #1
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Rep: Reputation: 242Reputation: 242Reputation: 242
Alias: Use uxrvt for rxvt


Hi there,

as I am in a non-English environment, and because rxvt doesn't support Unicode (UTF-8 in my case), I'd like to use urxvt (rxvt-unicode) instead. I installed it using the SlackBuild script from SlackBuilds.org.
As it is not needed for all users, on the one hand, and because I would like to avoid assumptions about which shell the user prefers, I thought I'd put this into a ~/.profile:

Code:
alias rxvt='/usr/bin/urxvt'
EDIT: Corrected the typo mentioned in post #4. Thanks to Bruce Hill.

Unfortunately, the alias command is just ignored, although ~/.profile is read. I know this, because there are some variables defined and exported in this file, too, and they are evaluated.
Now I wonder: Why doesn't have the alias any effect?

In fact, after I do

Code:
# source ~/.profile
it works: Issuing rxvt on the command prompt opens a window running urxvt. The window title bar displays "uxrvt".

Can anyone give me a hint, why ~/.profile is obviously read on logon (the environment variable definitions are evaluated and exported), but the alias command is ignored?


As the alias is not working, as expected, I use a symbolic link for the moment:

Code:
# ln -s /usr/bin/urxvt=/usr/local/bin/rxvt
Because /usr/local precedes /usr/bin in $PATH, and because the evaluation of the search PATH stops on the first hit, this works: Whenever I issue rxvt on the command line, urxvt is started. There's even a little advantage compared to the alias approach: The window title is "rxvt", although uxrvt is, what's actually being executed.

Although this is all I need for the moment, I'd like to learn, what's wrong with my first attempt using alias.

Thanks for sharing your *nix knowledge!

gargamel

Last edited by gargamel; 08-24-2010 at 03:10 PM. Reason: Corrected typo.
 
Old 08-22-2010, 09:25 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Maybe you typed something wrong, or the SlackBuild you used is
installing something wrong. I built my own rxvt-unicode for the
same reason ... UTF-8. In fact, just did that on a new install
and there are two separate binaries:
Code:
mingdao@silas:~$ ls -l /usr/bin/rxvt                                                                                                                        
-rwxr-xr-x 1 root root 138936 2009-06-10 06:13 /usr/bin/rxvt
mingdao@silas:~$ ls -l /usr/bin/urxvt
-rwxr-xr-x 1 root root 2462428 2010-08-22 22:03 /usr/bin/urxvt
Why don't you put the alias in ~/.bashrc ?
 
Old 08-22-2010, 09:37 AM   #3
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Original Poster
Rep: Reputation: 242Reputation: 242Reputation: 242
Quote:
Originally Posted by Bruce Hill View Post
Maybe you typed something wrong, or the SlackBuild you used is
installing something wrong. I built my own rxvt-unicode for the
same reason ... UTF-8. In fact, just did that on a new install
and there are two separate binaries:
Code:
mingdao@silas:~$ ls -l /usr/bin/rxvt                                                                                                                        
-rwxr-xr-x 1 root root 138936 2009-06-10 06:13 /usr/bin/rxvt
mingdao@silas:~$ ls -l /usr/bin/urxvt
-rwxr-xr-x 1 root root 2462428 2010-08-22 22:03 /usr/bin/urxvt
Why don't you put the alias in ~/.bashrc ?
uxrvt is working just fine, when it is called. So I don't assume, that something is wrong with the SlackBuild script or my installation. Of course there are two separate binaries. That's and the alias works, when I issue it explicitly on the CLI. It has just no effect, when I logon. If I issue either

Code:
$ alias rxvt='/usr/bin/urxvt'
or
Code:
$ source ~/.profile
on the CLI, followed by

Code:
$ rxvt
uxrvt is executed in a new terminal window, which is what I want. It's just not working right after logon.

gargamel
 
Old 08-22-2010, 09:48 AM   #4
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
In the first post you have:
Quote:
Originally Posted by gargamel View Post
As it is not needed for all users, on the one hand, and because I would like to avoid assumptions about which shell the user prefers, I thought I'd put this into a ~/.profile:

Code:
alias rxvt='/usr/bin/rxvt'
If I understand what you're saying should it not be:
Code:
alias rxvt='/usr/bin/urxvt'
I put aliases in ~/.bashrc which is read on login
and ~/.bash_profile has "source ~/.bashrc"

Maybe I'm doing it wrong.
 
Old 08-22-2010, 10:39 AM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
You should probably also do this:
export TERM=urxvt
 
Old 08-22-2010, 10:51 AM   #6
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
There is no urvxt TERM. It's rxvt-unicode, but Slackware
needs to have it added to /etc/termcap iirc
 
Old 08-22-2010, 12:50 PM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
The urxvt package should add the termcap entry when it's installed afaik.
 
Old 08-23-2010, 10:46 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Presuming that your experiments have been done using a graphical terminal emulator (as opposed to at a virtual terminal), the reason the alias from your ~/.profile file is not available is because ~/.profile is used for login shells, you are running a non-login shell and aliases are not exported.

When you do a graphical login, you start a login bash shell which starts the desktop. When you start a terminal emulator such as rxvt from the desktop you are already logged in. The new shell, running in the terminal emulator, is thus a non-login interactive shell so bash runs ~/.bashrc rather than ~/.profile. Full explanation of bash startup files here.

The solution is to move the alias definition from ~/.profile to ~/.bashrc as already suggested.

The same bash startup process will happen again when you initiate urxvt from a command prompt within a rxvt terminal. For the same reason, if you want to set the urxvt window title in the usual way, you will need to copy the case $TERM in section from /etc/profile to ~/.bashrc and modify the mrxvt | rxvt | xterm ) line to mrxvt | rxvt | rxvt-unicode | xterm )

Regards termcap, installing urxvt does install a termcap definition for urxvt but does not put it in /etc/termcap. You can generate a termcap entry for urxvt using infocmp -C rxvt-unicode and manually merge it into /etc/termcap.

To get the End key working correctly at the bash command prompt you ned to add "\e[8~": end-of-line in either /etc/inputrc or ~/.inputrc. If you choose the latter and it does not already exist, create it by copying /etc/inputrc.

There is no out-of-the-box method in urxvt for copy and paste except by the X primary selection -- a decreasingly common method. If you want to copy from urxvt to windows where you paste using Ctrl+V or from them after Ctrl+C into urxvt then ask again or search LQ.

Last edited by catkin; 08-23-2010 at 10:49 AM. Reason: comprehensibilility
 
1 members found this post helpful.
Old 08-23-2010, 08:11 PM   #9
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
catkin,

Thanks for the explanations.

To answer Dive's question, if you build rxvt-unicode it does install
a rxvt-unicode entry to /usr/share/terminfo/r/

But Ctrl+L does not clear, nor do the Home and End keys work properly,
presumably because there is no rxvt-unicode entry in /etc/termcap --
they just output a ~ (tilde).

So my system now gets this entry in /etc/termcap for rxvt-unicode:
Code:
rxvt-unicode|rxvt-unicode terminal emulator (X Window System):\
        :am:eo:km:ms:ut:xn:xo:\
        :co#80:it#8:li#24:Co#8:pa#64:\
        :AB=\E[4%dm:AF=\E[3%dm:AL=\E[%dL:\
        :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
        :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\
        :RI=\E[%dC:UP=\E[%dA:\
        :ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\
        :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\
        :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\
        :ho=\E[H:i1=\E[?47l\E=\E[?1l:ic=\E[@:\
        :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\
        :k0=\E[21~:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:\
        :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\
        :kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:ke=\E>:\
        :kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:\
        :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:op=\E[m:rc=\E8:sc=\E7:\
        :se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
        :te=\E[?47l\E8:ti=\E7\E[?47h:ue=\E[24m:up=\E[A:us=\E[4m:\
        :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h:\
        :@7=\E[8~:kh=\E[7~:
# When compiled with LINUX_KEYS the last line becomes
#       :@7=\E[4~:kh=\E[1~:
It's a bit different than catkin's suggestion, but gets the job done.

In addition this is my ~/.Xdefaults:
Code:
URxvt*loginShell: True
URxvt.perl-ext-common: default,tabbed,matcher
URxvt.urlLauncher: firefox
URxvt.matcher.button: 1
URxvt*font: xft:Monospace:size=12,xft:WenQuanYi Zen Hei:pixelsize=14
The font family and size are specified so that Hanzi (Chinese characters) will
display with a better looking font and larger size than Slackware's default. I
also like to launch a URI, especially from Mutt, by clicking it with the rodent.

Also as mentioned by catkin, all aliases go into .bashrc to be read with the
login shell.

It's nice to have a tabbed terminal with UTF-8 character display properly working.
 
Old 08-24-2010, 03:24 PM   #10
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Original Poster
Rep: Reputation: 242Reputation: 242Reputation: 242
Thanks a lot to all of you, and many thanks to you, catkin. Almost a tutorial, I think, and extremely helpful!

Only one question for the moment: If I copy the alias definition from ~/.profile to ~/.bashrc, it will work for accounts with Bash as login shell, but what about users who have Bourne, Korn, Z or whatever as their login shell? Is there a more general, shell independent solution?

Regarding the 'deficiencies' of urxvt mentioned: Is there a Unicode enabled alternative with similarly low dependencies, neither of KDE nor Gnome or anything else, that you could recommend?

Thanks again,

gargamel
 
Old 08-24-2010, 05:41 PM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
An alternative is to define and export a function in /etc/profile. Many shells process /etc/profile (maybe less support exported functions) but presumably not the csh family.

Another alternative would be to configure a shortcut, launcher or menu item to start urxvt from the desktop rather than starting rxvt and then starting urxvt from within it.
 
1 members found this post helpful.
Old 08-25-2010, 07:48 PM   #12
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Original Poster
Rep: Reputation: 242Reputation: 242Reputation: 242
Quote:
Originally Posted by catkin View Post
An alternative is to define and export a function in /etc/profile. Many shells process /etc/profile (maybe less support exported functions) but presumably not the csh family.
But then it is for all users, not just selected ones, right...?

Quote:
Originally Posted by catkin View Post
Another alternative would be to configure a shortcut, launcher or menu item to start urxvt from the desktop rather than starting rxvt and then starting urxvt from within it.
Actually I don't start urxvt from within rxvt. I start it directly, as I have defined a symlink from /usr/local/bin/rxvt to /usr/bin/urxvt. Does this mean, that by starting uxrvt directly, it shows none of the problems mentioned by some people here?

I'll try, as soon as I have a little time for further experiments...

gargamel
 
Old 08-25-2010, 11:11 PM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by gargamel View Post
But then it is for all users, not just selected ones, right...?

Actually I don't start urxvt from within rxvt. I start it directly, as I have defined a symlink from /usr/local/bin/rxvt to /usr/bin/urxvt. Does this mean, that by starting uxrvt directly, it shows none of the problems mentioned by some people here?
Right. When you wrote "users who have Bourne, Korn, Z or whatever as their login shell" I assumed (tsk, tsk!) you were using it for several users. Each of those shells probably look for startup files in the user's home directory, similar to ~/.bashrc so you can use those for per-user shell configuration.

It should not make any difference how urxvt is started, directly or from a command prompt in an rxvt terminal.
 
Old 08-25-2010, 11:57 PM   #14
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by gargamel View Post
But then it is for all users, not just selected ones, right...?
Yes, /etc/profile is for all users.

Each user also has files such as .bashrc and .profile in their respective
/home/<username>/ directory -- ~/.bashrc means the file .bashrc for the
user who logged into Linux. That could be different users, and each one
can have different files in their ~/ directory. Each one can also be using
a different shell, as well as different terminal.

The man pages for each shell will tell you what files are read -- when, why,
and in what order for the particular shell.

Quote:
Originally Posted by gargamel View Post
Actually I don't start urxvt from within rxvt. I start it directly, as I have defined a symlink from /usr/local/bin/rxvt to /usr/bin/urxvt. Does this mean, that by starting uxrvt directly, it shows none of the problems mentioned by some people here?

I'll try, as soon as I have a little time for further experiments...

gargamel
Be careful what you type into your posts:
Code:
ls: cannot access /usr/local/bin/rxvt: No such file or directory
Unless you have changed something else, Slackware installs:
Code:
mingdao@silas:~$ which rxvt
/usr/bin/rxvt
by default. We can only work with what you post for us to read.

I'm still confused why you symlink the binaries?

That just means that every user on the system can NOT use rxvt;
but every user on the system MUST use rxvt-unicode.

That is my purpose and reason for symlinking vi to vim:
Code:
lrwxrwxrwx 1 root root 12 2010-08-23 21:32 /usr/bin/vi -> /usr/bin/vim
By removing the elvis package, and changing vi's symlink to vim,
I have assured that no one on my system will use elvis, but that
everyone will use vim.

If you want to guarantee that NO USER on your system uses rxvt,
then you accomplished that with your symlink. You could also
just "removepkg rxvt" without making the symlink. And even with
both apps installed, you can use rxvt-unicode by issuing "urxvt"
and it will start just fine.
 
1 members found this post helpful.
Old 08-26-2010, 01:38 PM   #15
gargamel
Senior Member
 
Registered: May 2003
Distribution: Slackware, OpenSuSE
Posts: 1,839

Original Poster
Rep: Reputation: 242Reputation: 242Reputation: 242
Thanks again. Regarding the symlink:

Code:
# ln -sf /usr/local/bin/rxvt /usr/bin/urxvt
There's no need to de-install rxvt, because of this:

Code:
bash-4.1$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/java/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin:.
So /usr/local/bin comes before /usr/bin, and once the smylink /usr/local/bin/rxvt is found, the search stops. Therefore, /usr/bin/uxrvt is used, as this is what the symlink points at.

I avoid de-installing stock Slackware programs for two reasons. (1) Users who want the old program can still invoke it by issuing /usr/bin/rxvt. And (2): In the case of rxvt it wouldn't do any harm, probably, but there might be other programs relying on a specific tool or utility and invoking it by issuing the full path. These programs would fail, then, as they bypass the symlink, and there's no file behind the path they are calling.

To summarise: For the moment the symlink does what I want. But I also want to understand more and more of this machinery, and you guys helped a me getting a big step forward by sharing your knowledge, once again. Thanks for your patience!

gargamel
 
  


Reply


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
[SOLVED] TERM=rxvt / rxvt-unicode and ctrl-L irb Slackware 10 06-09-2010 05:09 AM
Wildcard email alias in /etc/alias file custangro Linux - Enterprise 1 10-02-2009 12:17 PM
IP alias? Machine name alias? JohnLocke Linux - Newbie 4 01-16-2008 12:21 PM
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 12:40 AM
Can't see enough in rxvt NomDeGuerre Linux - Newbie 2 03-11-2004 03:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:36 AM.

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