SCIENTIFIC-LINUX-USERS Archives

July 2007

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Summerfield <[log in to unmask]>
Reply To:
John Summerfield <[log in to unmask]>
Date:
Sun, 15 Jul 2007 22:01:36 +0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (88 lines)
Keith Lofstrom wrote:
> A cute trick for bash and xterm:
> 
> I work with a lot of xterms.  For years, I have been using pwd,
> cd, and mouse-cut-and-paste to copy the working directory from
> one window to another. 


Then it's time you met screen.

screen gives you lots of terminal sessions in one window (or on one 
virtual console).

yum -y install screen
screen
# then to create another session
^AC
# To list them:
^A"
# To advance to the next:
^A<space>
# To retreat to the previous
^Ap
# to split
^AS
# To switch to the next split
^A<tab>
# To unsplit
^AQ

There are more.
screen's great.

atm I have ten xterms and konsole (konsoles usually have several 
sessions), and one screen on a vc with eight sessions, an ssh session 
across my LAN with screen and five sessions; when I dial into the 
Internet I have another two sshes to remote screens with probably 
another half-dozen sessions each. I'm logged into eleven ttys (including 
those waiting to ssh to remote hosts). I run X on tty13 (and that's not 
counted in any of the others).

screen's great.


> 
> Now I have a better way, involving some aliases in .bashrc:
> 
>   alias sd='pwd > ~/.sd'
>   alias ds='cd `cat ~/.sd`'
> 
> I type 'sd' in the xterm I want to copy the working directory
> from, and 'ds' in the xterm that I want to copy the working
> directory to.
> 
> It is actually secure - the backtick'ed cat feeds directly
> to cd, so even if .sd is corrupted somehow, it cannot 
> execute arbitrary code.
> 
> I use 'sd' and 'ds' because I am left handed;  'kl' and 'lk' 
> might be easier for right handers, and I will humbly accept
> the honor of being immortalized in the initials.  ;-)

I'm not going to use it, but it _is_ cute:-)

I should add, I routinely "chattr +a .bash_history" and set these:
HISTCONTROL=ignoredups
HISTFILE=/home/summer/.bash_history
HISTFILESIZE=100000

Sometimes I want to expose my recent bash history to a second session. 
This saves it:
\ exec -l /bin/bash

Note, "\ exec" means <space>exec - the command has a leading space.




-- 

Cheers
John

-- spambait
[log in to unmask]  [log in to unmask]

Please do not reply off-list

ATOM RSS1 RSS2