[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

productivity issue - unix shell

Posted on 2000-03-15
6
Medium Priority
?
302 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

873 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