Solved

productivity issue - unix shell

Posted on 2000-03-15
6
262 Views
Last Modified: 2010-04-21
when typing commands in a unix shell e.g. tcsh, it is possible to go to the beginning by pressing Ctrl and 'a' at the same time.  Similarly, Ctrl and 'e' goes to the end of the line.  My question is: is it possible to go by word?  just like Ctrl and left arrow get me to the previous word.

thx in advance
0
Comment
Question by:crest
  • 3
  • 3
6 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2623433
esc-f & esc-b should move forward & backward by words.
0
 

Author Comment

by:crest
ID: 2628380
that works!!
just wondering if there is any way you can assign esc-b to Ctrl + <-?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2628612
Yep, you can. From the tcsh man page:

"Command-line  input can be edited using key sequences much
like those used in GNU Emacs  or  vi(1).   The  editor  is
active  only when the edit shell variable is set, which it is by default in interactive shells.  The bindkey  builtin
can  display  and  change  key  bindings."

If that isn't enough info, I can create an account that uses tcsh (I always use bash and have since the first version of it) and walk you through setting a binding.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:crest
ID: 2633263
that sounds a little bit complicated.
it would be very nice of you if you can show me how to do that step by step
0
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 2633835
If you execute "bindkey | more" you can see the key bindings. The binding of esc-f (forward-word) and esc-b (backward-word) are represented in the list as "^[f" and "^[b", "^[" being the ASCII representation of ctrl-[ which is the same code as the esc key generates. While you can't bind ctrl->/ctrl-< to anything as that combination doesn't generate a control code as far as tcsh is concerned, you can pick other keys to bind. For instance; "bindkey -b ^F forward-word" changes the binding of ctrl-F from forward-char to forward-word. The old binding of forward-char is lost, but it's also bound to the right arrow key so that's not a big loss. You could do a similar thing with "bindkey -b ^B backward-word"

For these bindings to persist across logins, you'll want to add the commands to your .tcshrc file.

0
 

Author Comment

by:crest
ID: 2644650
it works very well
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now