Today I Learned
Search…
Line Discipline in Unix/Linux Machines
Line discipline handles things like backspace and also generates various signals for special characters like Ctrl + C/Z etc.
stty -a will display all these settings. To know more do man ssty.

Demo

Other than Ctrl+c and Ctrl+z which you already know about. Here are some other tricks.
Fire up your terminal. And start typing....
Keyboard Shortcut
Description
Ctrl+?
Delete the last input character, Basically Backspace (See what I am talking about, ^? can be used in terminals which may not support the backspace key
Ctrl+q
Erase line, works like carriage return /r
Ctrl+a
Moves cursor to beginning of line
Ctrl+e
Moves cursor to end of line
Ctrl+w
Delete the last input "word"
Ctrl+k
Erase line to the end, from current cursor position
Ctrl+y
Paste the last erased text
Apart from these line input specific keyboard shortcuts. We also have ...

Multiline Input

Use / for continuing the multiline input.
1
[email protected]: hello my name\
2
is\
3
bhupesh\
4
check\
5
> my boi\
6
> hoooo\
7
>
Copied!
A better version
1
#!/bin/bash
2
​
3
echo -e "Enter Commit Message (Ctrl+d to stop) : "
4
commit_message=$(</dev/stdin)
5
​
6
echo -e "\n\n$commit_message"
Copied!
Make it executable and run.
1
Enter Commit Message (Ctrl+d to stop) :
2
- fixed bug #454
3
- Increase reponse time
4
- style fixes
5
​
6
​
7
- fixed bug #454
8
- Increase reponse time
9
- style fixes
Copied!
All of this is controlled by the tty driver

Resources

Copy link
Edit on GitHub