shell-novice icon indicating copy to clipboard operation
shell-novice copied to clipboard

Unix Shell, brief mention of 'Ctrl + L'

Open JacobDorePorrett opened this issue 4 years ago • 6 comments
trafficstars

Hello,

http://swcarpentry.github.io/shell-novice/

It's good to know about clear to keep the screen clear, however in the same paragraph in the lesson it might be worth mentioning about 'Ctrl +L'. It would fit well in episode 2. http://swcarpentry.github.io/shell-novice/02-filedir/index.html

If you use and also share the keyboard shortcut 'Ctrl + L' it'll allow the screen to be clear while keeping the previous used commands. This would be helpful for going to new sections without deleting the results of the previous commands. The shortcut moves all the text up and basically clears the screen, with the main difference being you can scroll up to see what you've done previously.

JacobDorePorrett avatar Jul 19 '21 00:07 JacobDorePorrett

Thanks for the suggestion. This is a nice shortcut, but does it work on git bash and terminal in macos? We don't want to be adding anything which only works on some systems.

gcapes avatar Jul 19 '21 16:07 gcapes

On macOS, both in Terminal and iTerm2, keyboard shortcuts involving "Ctrl" such as

  • Ctrl+A: go to start of line
  • Ctrl+E: go to end of line
  • Ctrl+K: delete from here to end of line
  • Ctrl+L: clear screen

work exactly as on Linux, and they do use Ctrl.

(In other contexts, macOS uses Cmd where Linux and Windows use Ctrl; not in this case).

slel avatar Jul 19 '21 16:07 slel

All the readline shortcuts, https://github.com/chzyer/readline/blob/master/doc/shortcut.md

I think we need a windows user to check if the git bash shell can properly handle these.

gdevenyi avatar Jul 19 '21 16:07 gdevenyi

All the readline shortcuts, https://github.com/chzyer/readline/blob/master/doc/shortcut.md

I think we need a windows user to check if the git bash shell can properly handle these.

The readline shortcuts work in the git bash shell. I'm on windows and tested using the git bash shell.

JacobDorePorrett avatar Jul 19 '21 23:07 JacobDorePorrett

Since they seem to work in our supported environments, I'd support a PR to add a small call-out to describe these features.

gdevenyi avatar Sep 07 '21 14:09 gdevenyi

The Bash command line inherits by design some of the Emacs Editor commands. In MacOS you can run the command 'bindkey' and it will show all the key bindings or shortcuts built-in Bash/Zsh. This in practice helps you navigate and edit the 'history' of last typed commands.

clizarraga-UAD7 avatar Jun 06 '22 05:06 clizarraga-UAD7