How do i move about bash cli?



  • Link to bash command line editing: https://www.gnu.org/software/bash/manual/html_node/Command-Line-Editing.html

    Working with the following command.
    $ cat /var/lib/jenkins/secrets/initialAdminPassword

    and Green letter is the starting point, where the cursor is, and red is the end point

    Move back one character. Ctrl + b

    $ cat /var/lib/jenkins/secrets/initialAdminPassword

      

    Move forward one character. Ctrl + f

    $ cat /var/lib/jenkins/secrets/initialAdminPassword

      

    Delete current character. Ctrl + d

    $ cat /var/lib/jenkins/secrets/initialAdminPassword

    ends up as

    $ cat /var/lib/jenkins/secrets/initialAdminPasswor

      

    Delete previous character. Backspace

    $ cat /var/lib/jenkins/secrets/initialAdminPassword

    2 backspaces from letter d, deletes "o" and "r"

    $ cat /var/lib/jenkins/secrets/initialAdminPasswd

      

    Move to the start of line. Ctrl + a

    cat /var/lib/jenkins/secrets/initialAdminPasswd

      

    Move to the end of line. Ctrl + e

    cat /var/lib/jenkins/secrets/initialAdminPassword

      

    Move forward a word. Meta + f

    cat /var/lib/jenkins/secrets/initialAdminPasswd

      

    Move backward a word. Meta + b

    cat /var/lib/jenkins/secrets/initialAdminPasswd

      

    Clear the screen. Ctrl + l (as is)

    cat /var/lib/jenkins/secrets/initialAdminPassword

      

    Search through bash history Ctrl + r

    (reverse-i-search)`': cat /var/lib/jenkins/secrets/initialAdminPassword

    Start tying your search...search terms in green
    (reverse-i-search)`sudo servi': sudo service network-manager restart

    Keep pressing Ctrl + r, to bring up the sudo service command you want to run and press return.


 

© Lightnetics 2018