Журнал лабораторных работ

Содержание

Журнал

Среда (09/30/15)

/dev/pts/0
09:30:16
#set | grep ^c
c=10
09:30:20
#env
SHELL=/bin/bash
TERM=xterm
HISTSIZE=2500
SSH_CLIENT=192.168.16.106 49157 22
L3_PARENT_TTY=/dev/pts/0
L3_TAMPERED_EDITORS= vi vim pico nano
SSH_TTY=/dev/pts/0
USER=root
HISTFILESIZE=2500
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
L3_SESSION_ID=3214919816900022178-1443510370
PWD=/root
LANG=ru_RU.UTF-8
09:30:50
#export c

09:31:29
#env
SHELL=/bin/bash
TERM=xterm
HISTSIZE=2500
SSH_CLIENT=192.168.16.106 49157 22
L3_PARENT_TTY=/dev/pts/0
OLDPWD=/bin
L3_TAMPERED_EDITORS= vi vim pico nano
SSH_TTY=/dev/pts/0
USER=root
HISTFILESIZE=2500
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
L3_SESSION_ID=3214919816900022178-1443510370
PWD=/root
c=10
LANG=ru_RU.UTF-8
09:31:33
#bash
root@debian5:~# echo $c
10
root@debian5:~# exit
exit
09:32:05
#env
SHELL=/bin/bash
TERM=xterm
HISTSIZE=2500
SSH_CLIENT=192.168.16.106 49157 22
L3_PARENT_TTY=/dev/pts/0
OLDPWD=/bin
L3_TAMPERED_EDITORS= vi vim pico nano
SSH_TTY=/dev/pts/0
USER=root
HISTFILESIZE=2500
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
L3_SESSION_ID=3214919816900022178-1443510370
PWD=/root
c=10
LANG=ru_RU.UTF-8
09:32:19
#bash
root@debian5:~# PS1='[\u \A]\$ '
[root 10:34]# exit
exit
09:34:46
#test 4 -eq 4

09:40:29
#echo $?
0
09:40:35
#test 4 -eq 5

09:40:43
#echo $?
1
09:40:45
#help test
test: test [expr]
    Evaluate conditional expression.
    Exits with a status of 0 (true) or 1 (false) depending on
    the evaluation of EXPR.  Expressions may be unary or binary.  Unary
    expressions are often used to examine the status of a file.  There
    are string operators and numeric comparison operators as well.
    The behavior of test depends on the number of arguments.  Read the
    bash manual page for the complete specification.
    File operators:
      -a FILE        True if file exists.
...
      arg1 OP arg2   Arithmetic tests.  OP is one of -eq, -ne,
                     -lt, -le, -gt, or -ge.
    Arithmetic binary operators return true if ARG1 is equal, not-equal,
    less-than, less-than-or-equal, greater-than, or greater-than-or-equal
    than ARG2.
    See the bash manual page bash(1) for the handling of parameters (i.e.
    missing parameters).
    Exit Status:
    Returns success if EXPR evaluates to true; fails if EXPR evaluates to
    false or an invalid argument is given.
09:41:31
#ls
23423     234235232252352435  234g23        all     install    report  shell.sh
23423523  234235325           234g23hgfdfh  errors  privet.sh  shadow  wetwet
09:41:55
#ls -l
итого 32
-rw-r--r-- 1 root root    0 Сен 29 10:26 23423
-rw-r--r-- 1 root root    0 Сен 29 10:26 23423523
-rw-r--r-- 1 root root    0 Сен 29 10:26 234235232252352435
-rw-r--r-- 1 root root    0 Сен 29 10:26 234235325
-rw-r--r-- 1 root root    0 Сен 29 10:26 234g23
-rw-r--r-- 1 root root    0 Сен 29 10:26 234g23hgfdfh
-rw-r--r-- 1 root root 2640 Сен 29 11:22 all
-rw-r--r-- 1 root root  348 Сен 29 11:21 errors
-rw-r--r-- 1 root root 5380 Сен 29 14:31 install
-rwxr--r-- 1 root root   40 Сен 29 10:59 privet.sh
-rw-r--r-- 1 root root   36 Сен 29 11:30 report
-rw-r----- 1 root root 1029 Сен 28 14:23 shadow
-rwxr--r-- 1 root root  239 Сен 29 15:21 shell.sh
-rw-r--r-- 1 root root    0 Сен 29 10:26 wetwet
09:41:58
#chmod u-x privet.sh

09:42:28
#test -x privet.sh

09:42:59
#echo $?
1
09:43:05
#test -x shell.sh

09:43:18
#echo $?
0
09:43:19
#[ -x shell.sh ]

09:44:06
#echo $?
0
09:44:09
#help [
[: [ arg... ]
    Evaluate conditional expression.
    This is a synonym for the "test" builtin, but the last argument must
    be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
    Execute conditional command.
    Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators:
      ( EXPRESSION )    Returns the value of EXPRESSION
      ! EXPRESSION              True if EXPRESSION is false; else false
      EXPR1 && EXPR2    True if both EXPR1 and EXPR2 are true; else false
      EXPR1 || EXPR2    True if either EXPR1 or EXPR2 is true; else false
    When the `==' and `!=' operators are used, the string to the right of
    the operator is used as a pattern and pattern matching is performed.
    When the `=~' operator is used, the string to the right of the operator
    is matched as a regular expression.
    The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.
    Exit Status:
    0 or 1 depending on value of EXPRESSION.
09:44:45
#help ]
l3script: help: no help topics match `]'.  Try `help help' or `man -k ]' or `info ]'.
09:44:53
#help [
[: [ arg... ]
    Evaluate conditional expression.
    This is a synonym for the "test" builtin, but the last argument must
    be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
    Execute conditional command.
    Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators:
      ( EXPRESSION )    Returns the value of EXPRESSION
      ! EXPRESSION              True if EXPRESSION is false; else false
      EXPR1 && EXPR2    True if both EXPR1 and EXPR2 are true; else false
      EXPR1 || EXPR2    True if either EXPR1 or EXPR2 is true; else false
    When the `==' and `!=' operators are used, the string to the right of
    the operator is used as a pattern and pattern matching is performed.
    When the `=~' operator is used, the string to the right of the operator
    is matched as a regular expression.
    The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.
    Exit Status:
    0 or 1 depending on value of EXPRESSION.
09:44:56
#help [
[: [ arg... ]
    Evaluate conditional expression.
    This is a synonym for the "test" builtin, but the last argument must
    be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
    Execute conditional command.
    Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators:
      ( EXPRESSION )    Returns the value of EXPRESSION
      ! EXPRESSION              True if EXPRESSION is false; else false
      EXPR1 && EXPR2    True if both EXPR1 and EXPR2 are true; else false
      EXPR1 || EXPR2    True if either EXPR1 or EXPR2 is true; else false
    When the `==' and `!=' operators are used, the string to the right of
    the operator is used as a pattern and pattern matching is performed.
    When the `=~' operator is used, the string to the right of the operator
    is matched as a regular expression.
    The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.
    Exit Status:
    0 or 1 depending on value of EXPRESSION.
09:45:02
#help test
test: test [expr]
    Evaluate conditional expression.
    Exits with a status of 0 (true) or 1 (false) depending on
    the evaluation of EXPR.  Expressions may be unary or binary.  Unary
    expressions are often used to examine the status of a file.  There
    are string operators and numeric comparison operators as well.
    The behavior of test depends on the number of arguments.  Read the
    bash manual page for the complete specification.
    File operators:
      -a FILE        True if file exists.
...
      arg1 OP arg2   Arithmetic tests.  OP is one of -eq, -ne,
                     -lt, -le, -gt, or -ge.
    Arithmetic binary operators return true if ARG1 is equal, not-equal,
    less-than, less-than-or-equal, greater-than, or greater-than-or-equal
    than ARG2.
    See the bash manual page bash(1) for the handling of parameters (i.e.
    missing parameters).
    Exit Status:
    Returns success if EXPR evaluates to true; fails if EXPR evaluates to
    false or an invalid argument is given.
09:45:08
#help
GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
 job_spec [&]                            history [-c] [-d offset] [n] or hist>
 (( expression ))                        if COMMANDS; then COMMANDS; [ elif C>
 . filename [arguments]                  jobs [-lnprs] [jobspec ...] or jobs >
 :                                       kill [-s sigspec | -n signum | -sigs>
...
 export [-fn] [name[=value] ...] or ex>  typeset [-aAfFgilrtux] [-p] name[=va>
 false                                   ulimit [-SHacdefilmnpqrstuvx] [limit>
 fc [-e ename] [-lnr] [first] [last] o>  umask [-p] [-S] [mode]
 fg [job_spec]                           unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMAND>  unset [-f] [-v] [name ...]
 for (( exp1; exp2; exp3 )); do COMMAN>  until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name >  variables - Names and meanings of so>
 getopts optstring name [arg]            wait [id]
 hash [-lr] [-p pathname] [-dt] [name >  while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]               { COMMANDS ; }
09:47:28
#help cd
cd: cd [-L|[-P [-e]]] [dir]
    Change the shell working directory.
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.
    Options:
        -L      force symbolic links to be followed
        -P      use the physical directory structure without following symbolic
        links
        -e      if the -P option is supplied, and the current working directory
        cannot be determined successfully, exit with a non-zero status
    The default is to follow symbolic links, as if `-L' were specified.
    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when
    -P is used; non-zero otherwise.
09:48:52
#cd --help
l3script: cd: --: неправильная опция
cd: usage: cd [-L|[-P [-e]]] [dir]
09:49:12
#which cd

09:49:39
#which who
/usr/bin/who
09:49:51
#which pwd
/bin/pwd
09:50:06
#which kill
/bin/kill
09:50:14
#ls -ld /var/spool/
drwxr-xr-x 5 root root 4096 Июн 27  2014 /var/spool/
09:51:06
#ls -ld /var/spool/mail
lrwxrwxrwx 1 root root 7 Июн 27  2014 /var/spool/mail -> ../mail
09:51:09
#ls -ld /var/mail
drwxrwsr-x 2 root mail 4096 Сен 29 11:25 /var/mail
09:51:31
#cd /var/spool/mail

09:52:12
#pwd
/var/spool/mail
09:52:21
#/bin/pwd
/var/mail
09:52:55
#pwd -P
/var/mail
09:53:12