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

Содержание

Журнал

Вторник (03/29/11)

/dev/pts/6
11:03:26
$ls /tmp/D2/dir
FILE
11:03:31
$ls -l /tmp/D2/dir
total 0
?--------- ? ? ? ?            ? FILE
11:03:51
$cat /tmp/D2/dir/FILE
cat: /tmp/D2/dir/FILE: Permission denied
/dev/pts/6
11:04:37
$ls -l /tmp/D2/dir
total 0
?--------- ? ? ? ?            ? FILE
?--------- ? ? ? ?            ? FILE1
?--------- ? ? ? ?            ? FILE2
?--------- ? ? ? ?            ? FILE3
?--------- ? ? ? ?            ? FILE4
11:04:39
$ls -li /tmp/D2/dir
total 0
??--------- ? ? ? ?            ? FILE
??--------- ? ? ? ?            ? FILE1
??--------- ? ? ? ?            ? FILE2
??--------- ? ? ? ?            ? FILE3
??--------- ? ? ? ?            ? FILE4
/dev/pts/6
11:05:29
$ls -l /tmp/D2/dir
ls: /tmp/D2/dir: Permission denied
11:05:33
$ls -l /tmp/D2/dir/FILE1
-rw-r--r-- 1 root root 7 Mar 29 15:05 /tmp/D2/dir/FILE1
11:05:37
$cat /tmp/D2/dir/FILE1
secret
11:08:18
$touch /tmp/d

11:09:11
$mkdir /tmp/D

11:09:16
$ls -ld /tmp/D /tmp/d
-rw-rw-r-- 1 user user    0 Mar 29 15:09 /tmp/d
drwxrwxr-x 2 user user 4096 Mar 29 15:09 /tmp/D
11:09:21
$grep umask /etc/bashrc
        umask 002
        umask 022
11:12:26
$pstr
pstree      pstree.x11  pstruct
11:12:26
$pstree | less
11:15:32
$umask 077

11:16:45
$touch /tmp/U1

11:16:48
$ls -l /tmp/U1
-rw------- 1 user user 0 Mar 29 15:16 /tmp/U1
прошло 10 минут
/dev/pts/6
11:27:22
$touch /tmp/FFF

11:27:25
$chown root /tmp/FFF
chown: changing ownership of `/tmp/FFF': Operation not permitted
11:27:32
$chgrp audio /tmp/FFF

11:27:38
$chown :lp /tmp/FFF
chown: changing group of `/tmp/FFF': Operation not permitted
11:27:51
$chgrp lp /tmp/FFF
chgrp: changing group of `/tmp/FFF': Operation not permitted
11:28:00
$ls -l /tmp/FFF
-rw-rw-r-- 1 user audio 0 Mar 29 15:27 /tmp/FFF
11:28:07
$id
uid=500(user) gid=500(user) groups=63(audio),500(user)
11:28:23
$chgrp user /tmp/FFF

11:28:45
$ls -l /tmp/FFF
-rw-rw-r-- 1 user user 0 Mar 29 15:27 /tmp/FFF
11:28:47
$chown :audio /tmp/FFF

11:29:00
$newgrp audio
Password:
Sorry.
11:29:53
$id
uid=500(user) gid=500(user) groups=63(audio),500(user)
11:30:17
$ls -l /etc/passwd
-rw-r--r-- 1 root root 1636 Mar 29 13:20 /etc/passwd
прошло 59 минут
12:29:57
$hello world!
bash: hello: command not found
12:30:06
$# hello world!

12:30:15
$echo hello world!
hello world!
12:30:31
$# echo hello world! > file1

12:31:25
$echo hello world! > file1
bash: file1: Permission denied
12:31:34
$cd /tmp

12:31:42
$echo hello world! > file1

12:31:43
$less file1
12:31:55
$fg
hello world!
~
~
~
~
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
~
12:31:59
$less file1
12:32:04
$jobs
[1]+  Stopped                 less file1
12:32:07
$fg
hello world!
~
~
~
~
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
~
12:36:44
$mkdir /tmp/disk

12:36:55
$cp /usr/share/doc/bash-3.2/
article.ms     bashdb/        builtins.ps    INTRO          rbash.0        startup-files/
article.ps     bash.html      CHANGES        loadables/     rbash.ps
article.txt    bash.ps        COMPAT         misc/          rose94.ps
bash.0         bashref.html   complete/      NEWS           scripts/
bashbug.0      bashref.ps     FAQ            NOTES          scripts.noah/
bashbug.ps     builtins.0     functions/     POSIX          scripts.v2/
12:38:37
$set -o vi

12:46:14
$set -o
allexport       off
braceexpand     on
emacs           off
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      on
history         on
ignoreeof       off
...
notify          off
nounset         off
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              on
xtrace          off
12:46:52
$set -o emacs

12:47:09
$history
    1  ls
    2  exit
    3  pwd
    4  mkdir2
    5  mkdir 2
    6  less typescript
    7  less typescript
    8  less typescript
    9  less typescript
   10  less typescript
...
  168  less file1
  169  jobs
  170  fg
  171  #sdf gdflgjgkl dfrg sdf dfhgk dlfkg dfg sdf gsdfkg dsflg
  172  mkdir /tmp/disk
  173  #cp /usr/share/doc/bash-3.2/CHANGES  /tmp/disk
  174  set -o vi
  175  set -o
  176  set -o emacs
  177  history
12:48:03
$history 10
  169  jobs
  170  fg
  171  #sdf gdflgjgkl dfrg sdf dfhgk dlfkg dfg sdf gsdfkg dsflg
  172  mkdir /tmp/disk
  173  #cp /usr/share/doc/bash-3.2/CHANGES  /tmp/disk
  174  set -o vi
  175  set -o
  176  set -o emacs
  177  history
  178  history 10
12:48:10
$ls -l ~/.bash_history
-rw------- 1 user user 1351 Mar 29 15:24 /home/user/.bash_history
12:48:29
$!176
set -o emacs
12:49:34
$!em
bash: !em: event not found
12:50:11
$!emacs
bash: !emacs: event not found
12:50:16
$!set
set -o emacs
12:50:22
$!j
jobs
12:50:57
$which passwd
/usr/bin/passwd
12:54:27
$ldd `!!`
ldd `which passwd`
        libuser.so.1 => /usr/lib64/libuser.so.1 (0x00000037ece00000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00000037fe400000)
        libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00000037eee00000)
        libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00000037efa00000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00000037ed200000)
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00000037ee200000)
        libpopt.so.0 => /usr/lib64/libpopt.so.0 (0x00000037f7400000)
        libpam_misc.so.0 => /lib64/libpam_misc.so.0 (0x00000037ec600000)
        libaudit.so.0 => /lib64/libaudit.so.0 (0x00000037f4c00000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00000037ec200000)
        libc.so.6 => /lib64/libc.so.6 (0x00000037eca00000)
        libpam.so.0 => /lib64/libpam.so.0 (0x00000037f8800000)
        librt.so.1 => /lib64/librt.so.1 (0x00000037ede00000)
        /lib64/ld-linux-x86-64.so.2 (0x00000037eba00000)
        libsepol.so.1 => /lib64/libsepol.so.1 (0x00000037ebe00000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00000037ed600000)
12:57:57
$touch /tmp/{1,2,3,4}.txt

13:01:49
$find /tmp -name \*.txt
find: /tmp/mc-root: Permission denied
/tmp/2.txt
find: /tmp/gconfd-root: Permission denied
find: /tmp/keyring-VQSPZ4: Permission denied
find: /tmp/ssh-NwJjpD2893: Permission denied
find: /tmp/D2/dir: Permission denied
/tmp/4.txt
find: /tmp/ssh-AfKIzR7722: Permission denied
/tmp/1.txt
find: /tmp/virtual-root.bUQIYE: Permission denied
find: /tmp/orbit-root: Permission denied
/tmp/3.txt
find: /tmp/lost+found: Permission denied
13:02:03
$find /tmp -name \*.txt 2> /dev/null
/tmp/2.txt
/tmp/4.txt
/tmp/1.txt
/tmp/3.txt
13:02:07
$mkdir /tmp/txt

13:02:19
$find /tmp -name \*.txt 2> /dev/null
/tmp/2.txt
/tmp/4.txt
/tmp/1.txt
/tmp/3.txt
13:02:20
$cp `!!` /tmp/txt
cp `find /tmp -name \*.txt 2> /dev/null` /tmp/txt
13:02:29
$ls /tmp/txt
1.txt  2.txt  3.txt  4.txt
13:02:33
$vim super-puper-hyper-script
--- /dev/null	2011-03-29 10:45:08.189688728 +0600
+++ super-puper-hyper-script	2011-03-29 17:05:52.000000000 +0600
@@ -0,0 +1 @@
+echo hello
13:06:14
$./super-puper-hyper-script
hello
13:06:18
$[user@linux2:tmp]$ vim super-puper-hyper-script
bash: [user@linux2:tmp]$: command not found
13:06:41
$find . -name \*.txt
find: ./mc-root: Permission denied
./2.txt
find: ./gconfd-root: Permission denied
find: ./keyring-VQSPZ4: Permission denied
find: ./ssh-NwJjpD2893: Permission denied
find: ./D2/dir: Permission denied
./4.txt
./txt/2.txt
./txt/4.txt
./txt/1.txt
./txt/3.txt
find: ./ssh-AfKIzR7722: Permission denied
./1.txt
find: ./virtual-root.bUQIYE: Permission denied
find: ./orbit-root: Permission denied
./3.txt
find: ./lost+found: Permission denied
13:06:51
$find . -name \*.txt 2> /dev/null
./2.txt
./4.txt
./txt/2.txt
./txt/4.txt
./txt/1.txt
./txt/3.txt
./1.txt
./3.txt
13:07:59
$ls -l `find . -name \*.txt 2> /dev/null`
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./1.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./2.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./3.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./4.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./txt/1.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./txt/2.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./txt/3.txt
-rw-rw-r-- 1 user user 0 Mar 29 17:07 ./txt/4.txt
13:08:06
$rm `find . -name \*.txt 2> /dev/null`

13:08:46
$echo `find . -name \*.txt 2> /dev/null`

13:09:15
$history -c

13:10:38
$ls -l ~/.bash_logout
-rw-r--r-- 1 user user 33 Jan 22  2009 /home/user/.bash_logout
13:12:00
$echo $BASH
$BASH           $BASH_ARGV      $BASH_LINENO    $BASH_SUBSHELL  $BASH_VERSION
$BASH_ARGC      $BASH_COMMAND   $BASH_SOURCE    $BASH_VERSINFO
13:12:00
$history -h
bash: history: -h: invalid option
history: usage: history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...]
13:13:48
$man bash
13:15:33
$man
13:15:33
$. /etc/bash_completion

13:17:09
$man
13:17:09
$man bash
13:17:09
$ssh-keyscan 192.168.15.{1..5} >> ~/.ssh/known_hosts
bash: /home/user/.ssh/known_hosts: No such file or directory
13:25:27
$ssh 192.168.15.1
The authenticity of host '192.168.15.1 (192.168.15.1)' can't be established.
RSA key fingerprint is e3:0e:09:ae:33:7d:81:a1:0f:24:09:ec:67:47:9a:3f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.15.1' (RSA) to the list of known hosts.
user@192.168.15.1's password:
13:25:38
$ping
::1                      localhost                localhost6.localdomain6
192.168.15.1             localhost6               localhost.localdomain
13:26:05
$ssh 192.168.15.3
The authenticity of host '192.168.15.3 (192.168.15.3)' can't be established.
RSA key fingerprint is f4:5c:ee:e9:ef:b7:bd:94:2a:1a:de:fd:ad:43:a7:f7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.15.3' (RSA) to the list of known hosts.
user@192.168.15.3's password:
13:26:07
$ssh 192.168.15.4
The authenticity of host '192.168.15.4 (192.168.15.4)' can't be established.
RSA key fingerprint is 19:4c:6c:24:e0:65:29:18:56:ba:a7:2b:05:df:e8:26.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.15.4' (RSA) to the list of known hosts.
user@192.168.15.4's password:
13:26:10
$ssh-
ssh-add      ssh-agent    ssh-copy-id  ssh-keygen   ssh-keyscan
13:26:10
$ping 192.168.15.
192.168.15.1  192.168.15.2  192.168.15.3  192.168.15.4
13:26:10
$man bas
13:26:10
$rpm -q
Display all 748 possibilities? (y or n)
13:31:04
$vim /home/user/.bashrc
13:32:09
$~
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# By default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
        umask 002
else
        umask 022
fi
...
                . $i
            else
                . $i >/dev/null 2>&1
            fi
        fi
    done
        unset i