Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Unix - how to get to start of a line in a command

  • 03-11-2008 12:30pm
    #1
    Registered Users, Registered Users 2 Posts: 5,659 ✭✭✭


    Hi all,

    Cant find teh shortcut to do this anywhere on google - all i find is vi

    Is there any way to goto beginning of line when your typing a very long command without deleting or scrolling back?


Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    If you are using ksh, you may be able to use vi commands to do this - found this on the web:
    When you make a mistake typing a Unix command you usually use backspace and then retype a part of the line; if the line is quite long and you made a mistake near the beginning, then this involves a lot of retyping. There is a short cut: when you notice that you have made a mistake, hit the ESC key; ksh now allows you to edit the command using vi-style commands and will only try to carry out the command when you hit the RETURN key (no matter where the cursor is in the line). You use h and l to move the cursor left and right, x to delete characters, i to insert characters (use ESC to finish the insertion), and so on. Try it, it's wonderful! Note: the arrow keys cannot be used during command line editing.

    There's also a UNIX forum here, which may be of more use.


  • Closed Accounts Posts: 2,923 ✭✭✭Nothingcompares


    home key?


  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    Try CTRl-A .
    If you've not changed anything much, that will do it for the bash shell.
    CTRL-E will get you to the end.

    If you're using a recent ubuntu, your shell might be something crippled.
    Try typing the word 'bash' in to get a more complete shell.


  • Registered Users, Registered Users 2 Posts: 2,082 ✭✭✭Tobias Greeshman


    If CTRL+A and CTRL+E do not work try running the command: "set -o emacs".

    For a full list of emacs bindings on the command line: here


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    I use "AbsoluteTelnet" to SSH into my server, and it allows me to press the home key to get to the start of a line.


  • Advertisement
  • Moderators, Arts Moderators Posts: 35,731 Mod ✭✭✭✭pickarooney


    Home key will work on konsole, but if you have a long prompt it becomes impossible to locate where you are in the line as the characters all pile on top of one another (hard to explain, easy to reproduce.
    It can be easier to Ctrl-C then restart the line and paste the bit from the aborted command that's still relevant.


Advertisement