Questions tagged [line-editor]

The line editor in shells and other command line programs

Filter by
Sorted by
Tagged with
20
votes
4answers
11k 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 ...
2
votes
1answer
164 views

Non-anchored history substring search in bash

There are 2 existing ways to get something like this easily: zsh's history-substring-search plugin bash's ctrl+r mode The problem with zsh is that it's not on many systems. The problem with bash's ...
1
vote
0answers
22 views

edit-and-execute-command interrupted by SIGTSTP

I've been using bash's edit-and-execute-command function: edit-and-execute-command (C-x C-e) Invoke an editor on the current command line, and execute the result as shell commands. Bash ...
23
votes
9answers
5k 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 foo/bar/...
1
vote
2answers
31 views

How to insert Line break regex

I have a file which contains one line like this test1.CSV test2.CSV test3.CSV test4.CSV... I want to put a line break after each .CSV file name like so test1.CSV test2.CSV test3.CSV test4.CSV ...
3
votes
3answers
2k 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: ...
1
vote
4answers
526 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 project-number-One/...
4
votes
3answers
3k 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 ...
2
votes
2answers
228 views

Alt + . (dot) shows &, instead of a previous argument

I (ab)use Alt + . to recover the last argument in a previous command (I'm using ZSH): for example, $ convert img.png img.pdf $ llpp (alt + .) # which produces llpp img.pdf but sometimes I review a ...
3
votes
4answers
206 views

Zsh refer to last element of current argument list and expand it

Suppose I do something like: ln a_file_with_a_long_filename.pdf ~/path/to/a/new/hardlink/a_file_with_a_long_filename_slightly_modified.pdf Is there a way to refer to and expand ...
8
votes
5answers
20k 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 ...
8
votes
3answers
5k views

zsh kill Ctrl + Backspace, Ctrl + Delete

How to configure zsh such that Ctrl+Backspace kills the word before point? How to achieve that Ctrl+Delete kills the word after point? I use urxvt as terminal emulator.
6
votes
1answer
5k views

SQLite3 command line: how do you cancel a command?

I made a mistake writing a command at the SQLite command prompt, which I now want to abort, this is how my command line looks sqlite> select * from todos' ...> ' ...> ;^C In this case,...
1
vote
2answers
64 views

CLI: Editing binary strings

There's a nice CLI binutils utility for interpreting binary files, and outputting legible strings, in a cat-like fashion. It's called strings. If you try to cat a binary file, you'll see a bunch of ...
10
votes
3answers
8k views

Ctrl-Backspace and Ctrl-Delete in bash

Putting on Debian 8.3 stty werase '^H' or on Arch Linux 2/2016 stty werase '^?' in .bashrc (for example) makes Ctrl-Backspace delete the last word in the terminal. Still it's not the same behavior ...
2
votes
1answer
78 views

Is it possible to do live text-replace in shell?

I run zsh on my machine. I was wondering if I can do text-replace in shell. For example fn[SPACE/TAB]should be replaced with function. On OSX there is the option of keyboard-shortcuts but they don't ...
1
vote
1answer
57 views

Changing to ancestor directory without typing all the dots and slashes

In zsh, how do I refer to the grandparent directory with ... rather than ../.., and so forth? I used to have this in oh-my-zsh and prezto. PS. Ideally, M-3 . should yield ../../...
3
votes
1answer
324 views

zsh line editor: Can I navigate and edit by argument?

I have a common situation in the shell when a command is attempted command "/some/complex/and terrible/path" -vf --various --flags --and -- things --config-file="/some other/annoyingly/large/path/to/...
30
votes
6answers
9k 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 <...
3
votes
1answer
284 views

Bash 4.4 bracketed-paste-mode stays on while running commands - corrupts paste

I've been using bracketed paste in VIM which is excellent for ensuring pasted content gets into the editor un-modified without triggering actions (such as auto formatting, and auto closing parenthesis)...
0
votes
1answer
60 views

zsh command line editing problems when reverse-searching the history fixed by ctrl-l [closed]

In zsh, using oh-my-zsh and the robby-russell theme, under Fedora Core 23, I noticed that when I reverse-searched for commands in the command history and tried to edit the results, the display would ...
1
vote
1answer
52 views

Bash and/or Zsh: Is it possible to customize the Vi insert mode to create a bind that moves a specific number of characters?

I have a Vim configuration that is somewhat unconventional. I bind Shift+H and Shift+L to move left by 7 characters and move right by 7 characters, respectively. This makes it easier for my brain to ...
6
votes
2answers
2k 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 with ...
1
vote
1answer
93 views

Line editing (readline?) with virtual keys

I want to bind terminal behavior to hotkeys without having to define escape sequences. I understand readline binds to characters instead of actual key presses. Can it also bind to the lower level ...
3
votes
2answers
203 views

How to specify command arguments for bind -x based on history?

Let's say I have a command called synopsis that takes the name of a command as an argument and prints out its syntax. Now I want to bind the synopsis to a key sequence. How can I pass the name of the ...
1
vote
0answers
37 views

Made a mess at end of limits.conf file, will it still work? [closed]

I made a mess at end of limits.conf file in Linux, was supposed to just write: * - nofile 1000000 But I added Will everything still work as it should? If not, how can ...
10
votes
1answer
37k 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 http://www....
6
votes
5answers
9k 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 3 ...
4
votes
1answer
774 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 ...
9
votes
1answer
230 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 &...
22
votes
1answer
1k views

Using zsh's line editor to wrap around subprocesses

Is it possible to use zsh's built-in line editor (zle) to feed input to a subprocess? That is, I would like to run zlewrap mycommand where zlewrap is a zsh function and mycommand is any program that ...
12
votes
2answers
3k views

Can I navigate zsh's tab-completion menu with vi-like hjkl keys?

I use zsh's menu-based tab completion. I press Tab once, and a list of possible completions appears. If I press Tab again, I can navigate this list with the arrow keys. However, is it possible to ...
1
vote
2answers
67 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 ...
24
votes
5answers
2k views

Bash command to copy before cursor and paste after?

I am not sure how to word this, but I often I find myself typing commands like this: cp /etc/prog/dir1/myconfig.yml /etc/prog/dir1/myconfig.yml.bak I usually just type out the path twice (with tab ...
0
votes
1answer
129 views

Extend vi mode to irb, postgres etc in zsh

I am using oh-my-zsh's vi-mode plugin. Its working awesomely for regular terminal usage. How to extend this vi-mode to psql, irb etc? In bash I used to do this by adding commands in .inputrc I am ...
20
votes
6answers
952 views

How do I input n repetitions of a digit in bash, interactively

I'd like to run the command foo --bar=baz <16 zeroes> How do I type the 16 zeroes efficiently*? If I hold Alt and press 1 6 0 it will repeat the next thing 160 times, which is not what I want....
5
votes
2answers
544 views

Echo text as suggested prompt in bash

Is it possible to change text that appears after $PS1. It is what user inputs. I want to suggest some command hereafter my_function is run. Of Course I should be able to modify/delete it using ...
1
vote
1answer
212 views

MIT Scheme prompt: indent and up/down arrows

I run Scheme either as: rlwrap scheme, option which let's me use up/down left/right arrows, but that disables tab. Or as scheme option that let's me indent commands with tab, but disables the arrows. ...
3
votes
3answers
3k views

Why can't Korn Shell do ctrl-r?

If I use PC-BSD with the default shell (Korn) then Ctrl+r doesn't work. Why won't it work? Ctrl-r was introduced to search your history in the late 1970s or early 80s and my BSD still can't do it (...
20
votes
2answers
1k 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
1answer
485 views

How to get second to last parameter of previous command in bash?

I can use Esc+. to get the last parameter of the previous command, but is there an equally convenient short-cut to get the second to last parameter?
1
vote
1answer
126 views

Up arrow at an empty prompt in ksh93

This is a request for explanation or pointer to documentation. I'm a KornShell93 (ksh on Mac OS X or ksh93 elsewhere) user. I like the shell for its relative simplicity as an interactive shell and ...
22
votes
4answers
10k views

ZSH: search history on up and down keys?

Currently, I have the following in my .zshrc: bindkey '^[[A' up-line-or-search bindkey '^[[B' down-line-or-search However, this only seems to match the content of my current input before a space ...
0
votes
2answers
2k views

Insert/overwrite mode in fish

I'm using Linux Mint on a MacBook and on its keyboard the equivalent for the INSERT key is the combination Fn + RETURN. At the moment I can only see the intended behavior of this combination in GNU-...
3
votes
1answer
328 views

zsh tcsh-like history navigation

In tcsh, the \eP and \eN commands take into account the whitespace-normalized prefix of the current line, not just the first word. For instance if my history contains git pull upstream feature-...
3
votes
2answers
465 views

rlwrap: tclsh multi-word autocompletion

How do I get multi-word autocompletion with rlwrap for tclsh? Example: I type file <space> then pressing <tab> <tab> I only want to see the sub-commands to file, such as exists ...
6
votes
2answers
1k 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 line....
2
votes
1answer
240 views

Find out if ctrl+backspace equals ctrl-H or ctrl-?

This question was about how to delete the last word in bash with ctrl-backspace. As already mentioned there, different Linux distros (or different Unices in general) behave differently: Some produce ^...
25
votes
2answers
1k views

Opening Your Command Prompt In A Text Editor - What Is This Called?

One of my favorite tricks in Bash is when I open my command prompt in a text editor. I do this (in vi mode) by pressing ESC v. When I do this, whatever is in my command prompt is now displayed in my $...
7
votes
4answers
1k views

Is it possible to name a part of a command to reuse it in the same command later on?

If I want to move a file called longfile from /longpath/ to /longpath/morepath/ can I do something like mv (/longpath)/(longfile) $1/morepath/$2 i.e. can I let the bash know that it should remember ...