bash features

by

Bash Features

(1) Expansions:-

we may use Expansions like:

*

and this matches any string, including the NULL string (zero or more character)

?

this matches any single character (single one character)

[ …. ]

matches any one of the enclosed characters

also this can be used to match any character from a range-of-characters by using a hyphen ()

(2) Auto Complete:-

the auto complete feature is used for completing commands and file names

you can use this feature by simply press “tab” button in your keyboard while writing the command

suppose we want to run “ifconfig” command

just type “ifco” and press “tab” button, you’ll find it’s completed automatically to “ifconfig”

the same thing is with file names

notice if you press “tab” twice, you’ll get a list of all possible commands/files that starts with the letters you wrote

for example: type “ifc” and press “tab” twice, you’ll find “ifcfg” and “ifconfig” commands

the next letter will determine if you want “ifconfig” or “ifcfg” command

(3) History:-

you can get the previous command you wrote again by one of these ways:

a) #history

history command prints the last 1000 command you’ve already typed

b) #!!

this is used for executing the last command again

c) #!r

and this is used for executing the last command that begins with “r” letter again

d) you may also press “ctrl+r”

and there you can type the command you want to search for it in the history (note that it’s a reverse search, so it’ll get the last command you’ve typed that begins with the letters you’re searching for)

(4)

$

used to define variables (example: $x)

$()

known as: Command Substitution

and this is mostly in scripts

you’ll understand more when you type:

#echo the date is $(date)

$(())

$[]

these are used in arithmetic operations

try to type

#echo $[4+5]

and

#echo $((4+5))

they’re quite the same!

Keyboard Shortcuts

ctrl+l —-> clear page

ctrl+d —-> log  off

ctrl+s —-> lock account

ctrl+q —-> unlock account

ctrl+u —-> clear line (from end to start)

ctrl+k —-> delete line (from start to end)

ctrl+c —-> Terminate (end process)

ctrl+z —-> Stop (but still not terminated)

ctrl+r —-> reverse search (from bottom to top)

Advertisements

One Response to “bash features”

  1. bash features Says:

    […] Original post by BooDy […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: