Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [line-editor]

The line editor in shells and other command line programs

2
votes
2answers
130 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
146 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 ...
1
vote
2answers
53 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 ...
1
vote
1answer
54 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
268 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/...
0
votes
1answer
55 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 ...
2
votes
1answer
73 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 ...
2
votes
0answers
126 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
1answer
51 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 ...
1
vote
1answer
82 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 ...
1
vote
0answers
25 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 ...
3
votes
2answers
152 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 ...
3
votes
1answer
255 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)...
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
126 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
937 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....
10
votes
2answers
2k 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
1answer
186 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. ...
1
vote
1answer
440 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
122 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 ...
6
votes
2answers
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,...
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
317 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-...
2
votes
1answer
206 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 ^...
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 (...
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 ...
3
votes
2answers
399 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 ...
11
votes
3answers
7k 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 ...
32
votes
1answer
2k views

ESC + { : What is it and where I can know more about it?

I was play around at the bash prompt, and pressed ESC followed by { , after which , the shell showed all the files for completion, in a fileglob string. Eg : If I had typed bash C followed by ESC+{ , ...
4
votes
2answers
504 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 ...
4
votes
2answers
595 views

How can I undo an accidental newline in bash?

If I unintentionally add a newline in a command, as far as I can tell, the only way to undo it is to press Ctrl+c and type the command again. For example: $ cat 'John's File' > ^C $ cat "John's ...
1
vote
0answers
279 views

paste clipboard text plus string with .inputrc

I've got in my .inputrc something like "\C-v": "script.sh " I use a link from my clipboard as a parameter for the script, so I type ctrl-v and then paste the link, and then hit enter. So I've seen ...
1
vote
1answer
55 views

Some characters are filtered in bash

I'm currently running a Xubuntu image using VirtualBox and a strange issue just started occurring: I cannot enter a or c in a terminal or terminal emulator. A and C (that is, a/c + left/right Shift or ...
0
votes
0answers
37 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
131 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; rprnt ...
6
votes
1answer
2k 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
134 views

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

I would like 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": "myCommand....
2
votes
1answer
598 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
209 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
398 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 was cut as expected. Next, I ran sudo su to become the root user. I tried to paste the command that I cut as the non-sudo user using Ctrl+Y. ...
3
votes
5answers
2k 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
57 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 ...
4
votes
0answers
281 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 it ...
1
vote
1answer
2k 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 ...
2
votes
1answer
691 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
588 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 ",...
5
votes
2answers
1k 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
285 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 -...
3
votes
2answers
680 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 ...