$ echo $SHELL /bin/bash
$ grep mtitek /etc/passwd mtitek:x:1000:1000:MTI TEK,,,:/home/mtitek:/bin/bash
$ cat /etc/shells /bin/bash (Bourne Again shell) /bin/sh (Bourne shell) /bin/dash (Debian Almquist shell)) /bin/csh (C shell) /bin/tcsh (~ C shell) /bin/ksh (Korn shell) /bin/zsh (Z shell)
$ bash -r
$ sh -r
$ ksh -r
/etc/profile
:
This file is executed when the user log in.
It executes the shell script /etc/bash.bashrc
and any other shell scripts *.sh
that can be found under the directory /etc/profile.d/
.${user.home}/.bashrc
:
This file is specific to each user and set the shell environment when the user log in or open a bash shell.
It defines the user environment variables and aliases.
It might also execute the shell script ${user.home}/.bash_aliases
where the user can define its own custom aliases.env
:$ env
USER=mtitek PWD=/home/mtitek HOME=/home/mtitek MAIL=/var/mail/mtitek SHELL=/bin/bash PATH=$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin OLDPWD=/var ...
$
#
$ echo $PATH $HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
type
command.$ type ll ll is aliased to `ls -alF'
$ type echo echo is a shell builtin
$ type date date is /bin/date
which
command to find the pathnames of a command.locate
command to search for files that the name match the provided command name.$ ls
$ ls -aOr double hyphen (--) if it's referenced by a word.
$ ls --all
$ ls -al
$ ls -a -lIn case where the option is referenced by a word, then each option should be specified separately using double hyphen.
$ ls --all --human-readable
$ ls -l --all --human-readable
$ ls -l -I "D*"If the option is referenced by a word, then the argument should be separated form the option by the equal sign (=).
$ ls -l --ignore="D*"
$ ls -l "/var"
Backspace
: delete the previous character.Ctrl+D
: delete the current character.Alt+C
: change to uppercase the first character and to lowercase the remaining characters of the current word.Alt+U
: convert the current word to uppercase.Alt+L
: convert the current word to lowercase.Ctrl+K
: cut the text on the right of the cursor (to the end of the line).Ctrl+u
: cut the text on the left of the cursor (to the beginning of the line).Ctrl+w
: cut the word on the left of the cursor.Alt+d
: cut the word on the right of the cursor.Ctrl+y
: paste the last cut text.Right Arrow
, Ctrl+f
: move the text cursor forward one character.Left Arrow
, Ctrl+b
: move the text cursor backward one character.Alt+f
: move the text cursor forward one word.Alt+b
: move the text cursor backward one word.Ctrl+a
: move the text cursor to the beginning of the line.Ctrl+e
: move the text cursor to the end of the line.Up/Down Arrow
: move forward and backward in the command line history.Ctrl+r
: search a string in the command line history
(keep pressing the key shortcut to go through command lines that match the string).Alt+p
: search a string in the command line history
(press Enter when you finish typing the string to see the last command line that match the string).$ echo "$HOME"
$(command)
or `command`
,
so they are substituted by their values before executing the command line.$ echo "$(pwd)"
$ echo "`pwd`"
$[arithmetic-expression]
,
so they are substituted by their values before executing the command line.$ echo "$[5 * 7]"
$ ssh mtitek@192.168.2.22 "cat /etc/shells" mtitek@192.168.2.22's password: # /etc/shells: valid login shells /bin/sh /bin/bash /bin/rbash /bin/dash
$ ssh mtitek@192.168.2.22 hostname
$ ssh mtitek@192.168.2.22 "cat /etc/shells"
$ ssh mtitek@192.168.2.22 'echo $SHELL'
$ ssh mtitek@192.168.2.22 "hostname;cat /etc/shells"
$ ssh -t mtitek@192.168.2.22 "sudo ls -al /root"
$ ssh mtitek@192.168.2.22 "$HOME/test.sh"