Saturday, 7 May 2016

Bash Shell features

BASH Features


BASH: Bourne again shell

 when you login to the Server using any CLI based tool OR login to the CLI mode you can see as like below screen. 

$ sign = local user/non-privilege user
# sign = Administrator/Privileged user
 

 [root@sankar ~]#


Shells can be changed based the user compatibility and requirements, most of default shell is 'BASH' 


[root@sankar ~]# cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/dash
You have new mail in /var/spool/mail/root
[root@sankar ~]#



Command Line Completion:
Single Tab – it will provide the best option
Double Tab – it will provide all the possible options (Autocompletes)
Command Line Editing:
Ctrl+a            -           It moves cursor to the Home line position
Ctrl+b            -           Moves the cursor back one character
Ctrl+c            -           Sends the signal SIGINT to the current task, which aborts and close it.
Ctrl+d            -           Close current shell prompt
Ctrl+e            -           It will move a cursor to end of the bash
Ctrl+f             -           Moves cursor forward one character
Ctrl+g            -           Abort the research and restore the original file
Ctrl+h            -           Deletes the previous character (Same as backspace)
Ctrl+k            -           It is used to delete the command from the courser to line home position
Ctrl+l             -           Clear the screen
Ctrl+u            -           Clears the line content before the cursor and copies it into the clipboard
Ctrl+y            -           Yank the content from the cursor position
Ctrl+z            -           Sends the signal SIGTSTP to the current task, which suspend it
Ctrl+Shift+c -           Copy selected text
Ctrl+Shift+v            -           Paste the copied content
Ctrl+Shift+t             -           Tab
Ctrl+Shift+n            -           New Terminal
Ctrl+Shift+w            -           Close Tab
Ctrl+Shfift+q           -           Close a Terminal
Alt+b              -           Moves the cursor backward one word
Alt+c              -           Capitalizes the character under the cursor and moves to the end of word
Alt+d              -           Cut the word after the cursor
Alt+f               -           Moves the cursor forward one word
Alt+l               -           Lowers the case of every character from the cursor’s position to the end
Alt+.               -           Insert the last argument to the previous command
Command Line History: Command line history will be saved, when you execute any command in terminal.
 
$ history        -           this command will display all the previous executed commands
$ history –c   -           Clear the command history
$ !<number> -          it executes mentioned number command
Note: Default history size is 1000 commands

[root@sankar ~]# history





$ !<charectar>         -           it will display/execute matching character command
$ !!                              -           it will execute last executed command
Sophisticated prompt control:
?          -           It will replace a single character
Example:       rm –rf a?        -           it will delete the files with two characters
                        Rm –rf a??     -           it will delete the three characters files after “a”
*          -           replace multiple number of characters

Example:       rm –f  a*        - it will remove all the files which are starting with “a”

Piping and Redirecting:
Redirecting input and output from standard stream to user defined place
1.    Input RD       -0                                 <         
2.    Output RD -1              Values        >          Symbols
3.    Error RD       -2                                 >

Example:       $ sort < <file name>
                        $ wc < <file name>
                        $ history > f2
                        $mkdir d1 2> e1




Piping sending output or one command as a input to the another command

| pipe
pipe Symbol





Page related command:
            Less: is used to see the command output page by page in up and down way
            More: we can’t go upward downward, just see the output fit to the screen
 

No comments:

Post a Comment