The line editor in shells and other command line programs

learn more… | top users | synonyms

0
votes
0answers
33 views

Ctrl + y on shell terminal, paste from system clipboard [duplicate]

I use emacs style bindings for my bash terminal. And i use only the system clipboard and never use any of the application specific/primary selection stuff. When i copy text from emacs window and use ...
1
vote
1answer
32 views

stty doesn't display backward-delete-word shortcut

stty -a shows, speed 38400 baud; rows 39; columns 143; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; ...
2
votes
1answer
19 views

How to cancel and keep reverse-i-search?

Often I fail to find something with reverse-i-search but want to keep what I have already written. For example, typing pdflatex fails to complete to pdflatex mydocument.tex. If I then cancel it with ...
3
votes
1answer
53 views

Pass 'typed text' from bash interactive shell to a command

The idea is to pass whatever the user has typed in a bash shell to a command when the user presses a keyboard binding|shortcut For example : Lets say Ctrl+b is our binding bind '"\C-b": ...
1
vote
1answer
47 views

bash/gnu readline multiline command: move row up/down

How to move one editing row up (back) or down (forward) in a multi-line command in bash/readline? Somethnig like gj/gk in Vim.
5
votes
3answers
170 views

Output Output of command to command line directly, NOT variable [duplicate]

I am on the bash shell and I want the output of a command to appear directly in the command prompt that appears after the command has executed ! Example of what I envision it, to illustrate my idea: ...
1
vote
1answer
79 views

Ctrl-Y, emacs styled yank text is not working when user is switched

I cut the bash command line text using Ctrl-K. The line got cut. Now, I ran sudo su to become the root user. I tried to paste the command that i cut as non-sudo user using Ctrl-Y. It is no longer ...
2
votes
5answers
126 views

Adjust gap between 2 columns to make them look straight

file1.txt: hi wonderful amazing sorry superman superhumanwith loss file2.txt : 1 2 3 4 5 6 7 When i try to combine using paste -d" " file1.txt file2.txt > actualout.txt actualout.txt : hi 1 ...
1
vote
2answers
27 views

Addition of values

foo.txt: Lillypaul_sg 204803 204803 204803 Ammy_sg 3 ramaswamy_sg 3 33 tommy_sg 3 3 137374 100 Desired Out.txt : Lillypaul_sg 614409 Ammy_sg 3 ramaswamy_sg 36 tommy_sg 137480 The output is a sum ...
3
votes
0answers
79 views

Bash command not found due to stray garbage characters

What is the cause of this behavior? $ cd ../ $ bash: $'\210\210cd': command not found This happens sometimes (rarely) when I enter a command, there is no visible character preceding the cd, still ...
0
votes
1answer
47 views

Read a line with default input in zsh

This function can be used to help user input a modification of some text. function change { bash -c "read -ei \"$1\" temp && echo \$temp" } What is idiomatic zsh way to do something ...
1
vote
1answer
86 views

Enable cursor keys in python shell over ssh

I run OpenElec on a Pi. I can ssh to the Pi and open a python shell. How do I enable the cursor keys to work like up getting to last command in the python shell, like it does on my Ubuntu box. Now ...
0
votes
1answer
36 views

How to switch from input mode into command mode in ed ?

As far as I know, ed starts in command mode. Once I input i,a or c ed changes into input mode. So far it worked. Now I read that in order to switch from input mode into command mode one has to input ...
2
votes
2answers
111 views

How do I swap the two last command line arguments?

$ ln -s ./dir/target.txt /path/to/source.txt{cursor here} How do swap file typed filenames in command line? Alt+T swaps words, not filenames, resulting in ln -s ./dir/target.txt /path/to/txt.source. ...
2
votes
0answers
49 views

Why does select-word-style stop me from using backward-kill-word for leading whitespace?

If I have just some whitespace at be beginning of my zsh prompt, I can usually ^W (backward-kill-word) it away. However, as soon as I load select-word-style - even if I don't select any special style ...
2
votes
2answers
92 views

Command to output to current prompt

Is there any command that will output text to the (next) command prompt? I would like to write a function, which upon execution, will perform some commands and then "suggest" the next command to be ...
5
votes
1answer
83 views

Keep the space after completion for some characters in zsh

Zsh has a bit of completion-related automation that's nice most of the time: after pressing Tab, a space is inserted automatically (or some other appropriate character such as , inside braces). I ...
2
votes
2answers
65 views

clipboard in bash

We can cut and paste current line in bash with ctl+u and ctl+y But I have read here that bash doesn't have clipboard concept, so how those shortkeys working? (or in another way: what they doing?)
1
vote
2answers
122 views

How to delete a word next of last slash

I have the following path : $ vim /path/to/some/where If I press Ctrl + w, It removes entire text to first space. The result would be : $ vim How do I delete just the word next of last slash ...
1
vote
2answers
81 views

Map Return with no other input to an alias

I would like to use Return with no other input to run an aliased command in the shell. Is this possible in Bash or Zsh? In other words, when I enter an empty command line, I want to run one specific ...
1
vote
1answer
51 views

Key to comment out the current line and keep editing it in zsh

On Bash I was using ESC # after Ctrl+R to prefix a # to the found line and keep it in the terminal, something similar for zsh?
1
vote
3answers
135 views

How to transpose command line arguments with emacs keybindings?

Using Bash, with emacs keybindings set, the transpose-words keybinding (M-t) doesn't transpose arguments, but "words" (by its own definition of words). So if I have this: vimdiff ...
6
votes
1answer
150 views

How to stop bash editing the history when I reuse and modify an entry?

Some instances of bash change the command history when you re-use and edit a previous command, others apparently don't. I've been searching and searching but can't find anything that says how to ...
1
vote
3answers
912 views

How to handle backspace while reading?

How do I handle the backspaces entered, it shows ^? if tried & how read counts the characters, as in 12^?3 already 5 characters were complete(though all of them were not actual input), but after ...
2
votes
1answer
101 views

Why does tmux fail to “scroll” when entering a command that exceeds one line? (OSX Terminal.app)

When I use tmux and enter a command that exceeds the line, it fails to redraw the previous line. It simply clears the current line and I can't see what I just wrote. It does only redraw the first ...
4
votes
5answers
6k views

How to add text to end of line when pattern is matched?

inputs: line1 with the PATTERN that contains ( ) line2 with the PATTERN that contains ( ) lineN with the PATTERN that contains ( ) outputs: line1 with the PATTERN that contains ( ) ; line2 with ...
2
votes
5answers
885 views

How can I delete input in the terminal?

Xubuntu 13.10 Say I paste a command, something like sudo apt-get install abc yxz 123 DEF MMM KKK into the terminal. Then I suddenly had a change in mind and thus I would like to delete the last ...
8
votes
3answers
237 views

Clear / erase a mistyped password in a terminal

One thing that annoys me using Linux's terminal is when I have to type a invisble password, like when you run ssh the terminal I was wondering if there's a way to clear/erase the invisible password ...
1
vote
1answer
152 views

Simulating READLINE_LINE in Bash < 4.0

I am trying to make some of my code bash 3.X compatible and I have a key-binding that utilizes READLINE_LINE inside its callback function. 3.0 versions of Bash don't supply the READLINE_LINE, so I ...
3
votes
3answers
1k views

rlwrap: mysql autocompletion not working

Normally, autocompletion works fine in mysql command-line client (mysql-client-5.5). I have a table called booking. When I type the letter b and pres TAB the name of my table gets autocompleted: ...
9
votes
1answer
2k views

First characters of the command repeated in the display when completing

The first two chars were repeated while I use Tab to do completion. In the screenshot below, cd is repeated. I have tried rxvt-unicdoe, xterm, terminator. All these terminal emulators have this ...
0
votes
1answer
425 views

In tcsh shell how I find a particular word in the command prompt?

Suppose I have the following line in my command prompt and the cursor is at the and of the line or the beginning of the line by using (CTRL+A) [subhrcho@slc04lyo pcbpel]$ abc def ghi jkl How can I ...
3
votes
1answer
166 views

Where is the bash feature to open a command in $EDITOR documented?

I have recently discovered that if we press Ctrl+X Ctrl+E, bash opens the current command in an editor (set in $VISUAL or $EDITOR) and executes it when the editor is closed. But it doesen't seem to be ...
1
vote
1answer
714 views

How can I move between words in the command prompt in tcsh in linux?

I want a feature like vim's going forward or backwards command (w,e,ge,b) etc in the shell prompt. I am using tcsh shell in Linux. I would like to go 'n' number of words backs or forward etc and do ...
6
votes
1answer
277 views

can you make zsh autocorrect smarter?

I like zsh autocorrect, but it keeps asking me about things that don't need correcting. dzil build zsh: correct 'build' to '.build' [nyae]? % .build is a directory created by the build (or any ...
2
votes
1answer
359 views

How can I clear portion of what is typed into the prompt while working on Linux and using C-shell?

I am working in Linux and C-shell. Often times I would require to change some portion of what is there already in the prompt that I obtain from reverse searching through the history command by use of ...
7
votes
1answer
157 views

The shell's “delete word” shortcut deletes too many characters

Under Bash some behavior of Alt+d has been driving me crazy since years and I figured out that maybe it could be fixed with a setting. If I'm at a terminal and issue a command like this: ...$ cat ...
6
votes
1answer
6k views

How to input / start a new line in bash terminal?

I notice some sample bash for loops are spread out over multiple lines in examples for VARIABLE in file1 file2 file3 do command1 on $VARIABLE command2 commandN done (eg here ...
3
votes
4answers
795 views

Shell: How do I get the last argument the previous command when it was detached?

Within the shell, typing ALT+. or using !$ recalls the last passed argument of the previous command. I use this all the time, but how do you do that when you detached the previous command? $ ...
2
votes
3answers
1k views

tcsh shortcut to move the cursor back to previous space

I'm looking for a keyboard shortcut in tcsh to move the cursor back to the previous blank: not ESC+B which takes me back one word (for instance, in a path argument, to the previous path component) - I ...
4
votes
1answer
273 views

Is there a command for switch to vicmd mode in zsh?

I have mapped alt-k and alt-j for browsing history, but I would like to switch vicmd automatically whenever I call up a history entry, because most of the time I need to move the cursor to a certain ...
2
votes
1answer
519 views

Is there a way of color-highlighting paired brackets in shell (bash)?

Does anyone know if there is a way reproducing the same behaviour many text editors provide for colour-highlighting the syntax operators such as brackets or curly brackets. It would be very useful for ...
2
votes
0answers
312 views

Tcsh: Searching history using Ctrl-P and Ctrl-N

What are the equivalent functions in tcsh for the following zsh functions? up-line-or-history history-beginning-search-backward down-line-or-history history-beginning-search-forward I have the ...
10
votes
6answers
1k views

How to repeat currently typed in parameter on bash console?

I was just typing something along the lines of: mv foo/bar/poit/zoid/narf.txt and suddenly realized, damn, I have to type large parts of that parameter again mv foo/bar/poit/zoid/narf.txt ...
4
votes
4answers
1k views

Replace whole line in a file from command-line

I have a text file which has some contents similar to this: # General information about the project. project = u'Py6S' copyright = u'2012, Robin Wilson' # The version info for the project you're ...
12
votes
2answers
2k views

zsh wants to correct vim to .vim

I'm using zsh on Gentoo x64, and when I type sudo vim /path/to/file from my home folder, zsh asks: zsh: correct 'vim' to '.vim' [nyae]? I want to run vim not my .vim folder. How do I fix this? ...
1
vote
2answers
435 views

Is there a convenient way to wrap a bash command list into rlwrap?

Thanks to a question on superuser.com, I found out about this utterly convenient rlwrap tool. It satisfies my needs (i.e. add command history to another cmdline tool), but I was wondering how I can ...
2
votes
1answer
129 views

History-search in zsh working only for commands?

Say I have the following entries in my command history: less documents/doc1.txt less documents/doc2.txt less files/file1.txt less files/file2.txt ls pwd and that I have the following keyboard ...
21
votes
4answers
4k views

Change cursor shape (or color) to indicate vi mode in bash

To clarify: I am not asking how to change the cursor when using vim within a terminal. I want the cursor to change when switching between input and command mode within Bash's vi-mode: set -o vi ...
4
votes
1answer
355 views

Adding more Emacs-like bindings to ZSH's line editor (ZLE)

I have a couple of questions regarding the emacs-like keyboard bindings in Zsh. As background to all the questions: I have Emacs-like keybinding activated with bindkey -e (activated by default) ...