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

Содержание

Журнал

Понедельник (11/02/20)

/dev/pts/0
12:09:19
#цÑÑwhich find
l3script: $'\321\206\321\321which': command not found
12:09:36
#~
l3script: /root: Is a directory
12:09:53
#Ñwhich find
l3script: $'\321which': command not found
12:10:02
#which find
/usr/bin/find
12:10:13
#file /usr/bin/find
l3script: file: command not found
this will show content type of file
12:11:11
#which xargs
/usr/bin/xargs
12:12:16
#cp -v d2/f2 d4
`d2/f2' -> `d4/f2'
12:15:17
#cp -rv d2 d1
`d2' -> `d1/d2'
`d2/f2' -> `d1/d2/f2'
`d2/d3' -> `d1/d2/d3'
12:16:08
#find . -maxdepth 1 -type d -name "d*"
./d4
./d2
./d1
12:17:26
#find . maxdepth 1 -type d - name "d*" | xargs ls
find: paths must precede expression: -
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
d1  d2  d4  f1  install  who.txt  whoH.txt
12:18:23
#find . -maxdepth 1 -type d - name "d*" | xargs ls
find: paths must precede expression: -
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
d1  d2  d4  f1  install  who.txt  whoH.txt
12:18:33
#find . -maxdepth 1 -type d -name "d*" | xargs ls
./d1:
d2
./d2:
d3  f2
./d4:
d5  f2
12:18:41
#find . -maxdepth 1 -type d -name "d*" ; xargs ls
./d4
./d2
./d1
^C
commands one by one ;
12:19:38
#rm d4
rm: cannot remove `d4': Is a directory
12:19:46
#rm -r d4

12:19:59
#find . -maxdepth 1 -type d -name "d*" | xargs ls
./d1:
d2
./d2:
d3  f2
12:20:14
#echo d2/*
d2/d3 d2/f2
12:20:40
#cat who.txt
root     pts/0        2020-11-02 09:12 (192.168.15.129)
ivan     pts/2        2020-11-02 09:51 (192.168.15.129)
petr     pts/3        2020-11-02 09:53 (192.168.15.129)
12:22:28
#shred who.txt

12:22:47
#cat who.txt
R²o®ÄUËèÞZô•êëüY\boš¯Eq‡TDL-Wƒ|ŠOԖèωºû`yœR Ë_½8±x'*)%ùªƒ•B&      'ä(HP¼¯ð™a²Ð—œÿ`Þ<քp’º!¬Î
’–Ú‰f¤»L 3Þ*N~MxÎGDﻪ[(­^úM«ÍµÆÓýßV00¬\œÝ[GLíU-ý™“JLAEÞ'pߜ¢!À%X|{Ëo[A(¿íñh3).Çòs0¸F!ßS‡ù_.ÿ ¾ÅI…ƒÐƒÒJnÏIû”Ò9õ”È:$0׌>ˆ%{Ë7§—‘êCòka«¥@`µŒk`'íúÖáv´ìLÔ¹`E³c‰Æ9²{ލf¤Ü¹¨=œ£UÆýY¦
                                                                                                           ÙMWSï‚j                                                                +Dt~\[8ÎIJ•jÕ:ºícg´˜åßê®LõMÖbÚf*‚Q”~RCœ
                                                                                                                  J     Uç¹)k([v9W¬Z|Ônzd޵€Ød§1CܑæQÜ%'¢XBZ\Zü–Ë{nÉ¥{Uûs]¥                                                dÛ¢{ó.D4´{¥ápžÖàX"wÓê Ë>·*ú‹+䙣r9‡M0õý‘YPÿ¹WnÆèBçû5z؉%Dî<ŽR˕Ž(ŠÖÝá"‚
                                                                                                                                                                           %¢                                                                                                                      rCÜ:ʜ
øq                                                                                                                                                                           @Ÿ|¦­àŠ•g@)™í±¯Äž¨©@9Q%%¦—Zјu2Ñ>Çoô\                                                                                       ù…fAzaù%2ó¯~—¸ò0€Š{BCèÍÐøS#1ø»&ôê°µvÝAe†%DïyÛj_ëœQÉðî‡ÈíÿO
ø‘TÅãGB´ÖÅ;ÏÓ+—FuöæíÖ$AÏ'ÜȓÕJÜme„}†-…¦ðrk?Néû÷9I>RÜF6wŸÓÞÃ4Bt#¡XçCŽSkê·~:¶&£,ˆÕÂ,ÏÊ͂chÿ½¦¥†P½ŽÈÖÑ=ɂée÷iÏùVµˆ»­0¶î®SƒØ·“¼õÕK$´yС
ènûE¤j҇Èaò«‚¡¨€´<ø§fæxè1Ì
`nÙ0˝®˜˜óHͤ§o÷Áÿ09-Œgr        ¯xÒìº
                                     ¹
...
                                                                                                                                                                                           Ã{îAáÝA‰õ-
                                                                                                                                                                                                     ÂJ&MI?5cí¡C|tTǒAvUuža®”1çh€
                                                                                                                                                                                                                                 €í=r)„õä‹P>Åó¥œGŽ÷øÃIK‰ß½fc¿ª_†ô…xÜ4×ô=ü-ô_®#×Q»g>#f”ÿr¡xe¼·šŽ¸q®=pÔ¥’¬«'ƀŠ <'žè°%e½.4z×#FÇÒë¢<7™U~\ƌ
yef‚G‰s&FàK?‡éþ‰õçjõû÷£¶éS½m<pMäKÎU»?<zá`>ùÌÚ/î˕ú7ü5Û/7«q±^Rµd]sŀli`©[¾SdUÛoa jÌÚö«<ȼ£Û}ØmWžŒò¶QÝÇè7FÂà󆰰ù¦|I ‹4ž×֏’Kíöliq
Ӎÿ¨xXöînnsåæ4ލhð×iñ~DKhíZB"ߌ¶bX¸èÄg6$D£éÑ_‡Ée„FóGë} :‰.¯
                                                           ŠLÌXAq•‡ÅYz Þ:s<G¹?ëº.YcFО‰…ßÝ7Zé¹<Äì‡*ç¬åô8á·èýO÷bŒäíÿîÎ0y$®
nÒP!ë•6¨&.]÷kרžïÉ1@Öô.X×÷xœ.Q…vU´yH¥JΈ`8ûg“´(d1'“
                                                    ޖ¦Áe'j4ñkü%I2?°fáƒäÀF#5•…?î_Ü`ñ‡{üãBIè(´˜Ù¸MêK´Í@½Ñ
                                                                                                          'rìÔ".ô#þ¬$“>ç其•™¥œÿ%r—ôò–^7µêÙÎmb÷Ó¿7ÊÙ÷Ó{Oâõ"o®O˜Aã?7µ¿¬·:Z
                                                                                                                                                                         žFMrëYyж¬ø}ñm,diðÚEžÇ}]3”ÄiôÚlÑ~xCÖMSœIbÝ.Ê·ŽXÅdêŒd Âìõ¦Or-±‹ÌÁÛo0“zvì
12:22:59
#qvßê%"•‘÷¦_
l3script: PuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTY: command not found
12:23:15
#ls -l
total 24
drwxr-xr-x 3 root root 4096 Nov  2 13:16 d1
drwxr-xr-x 3 root root 4096 Nov  2 12:49 d2
-rw-r--r-- 1 root root    0 Nov  2 12:48 f1
-rw-r--r-- 1 root root 5268 Oct 13  2014 install
-rw-r--r-- 2 root root 4096 Nov  2 13:22 who.txt
-rw-r--r-- 2 root root 4096 Nov  2 13:22 whoH.txt
12:23:33
#shred -u who.txt

12:24:09
#cat whoH.txt

12:24:37
#ls -l
total 16
drwxr-xr-x 3 root root 4096 Nov  2 13:16 d1
drwxr-xr-x 3 root root 4096 Nov  2 12:49 d2
-rw-r--r-- 1 root root    0 Nov  2 12:48 f1
-rw-r--r-- 1 root root 5268 Oct 13  2014 install
-rw-r--r-- 1 root root    0 Nov  2 13:24 whoH.txt
12:24:55
#rm whoh.txt
rm: cannot remove `whoh.txt': No such file or directory
12:26:26
#rm whoH.txt

12:26:32
#find . -maxdepth 1 -type d -name "d*" | xargs ls
./d1:
d2
./d2:
d3  f2
прошло 75 минут
13:42:26
#which vi
/usr/bin/vi
13:42:33
#which vim
/usr/bin/vim
13:42:36
#ls -l `which vi`
lrwxrwxrwx 1 root root 20 Jun 27  2014 /usr/bin/vi -> /etc/alternatives/vi
13:44:07
#ls -l $(which vi)
lrwxrwxrwx 1 root root 20 Jun 27  2014 /usr/bin/vi -> /etc/alternatives/vi
13:44:45
#which vi | xargs ls -l
lrwxrwxrwx 1 root root 20 Jun 27  2014 /usr/bin/vi -> /etc/alternatives/vi
13:46:41
#ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Jun 27  2014 /etc/alternatives/vi -> /usr/bin/vim.basic
13:48:52
#ls -l $(which vim))
l3script: syntax error near unexpected token `)'
13:49:20
#ls -l $(which vim)
lrwxrwxrwx 1 root root 21 Jun 27  2014 /usr/bin/vim -> /etc/alternatives/vim
13:49:24
#ls -l /etc/alternatives/vim
lrwxrwxrwx 1 root root 18 Jun 27  2014 /etc/alternatives/vim -> /usr/bin/vim.basic
13:49:39
#ls -lh /usr/bin/vim.basic
-rwxr-xr-x 1 root root 1.8M Feb 10  2013 /usr/bin/vim.basic
13:50:44
#ls
d1  d2  f1  install
13:52:10
#vi install
прошло 42 минуты
14:34:39
# 31
lilalo_rc=.l3rc 5268C
lilalo_home=.lilalo
url_lilalo="http://xgu.ru/lilalo"
url_l3bashrc="${url_lilalo}"/l3bashrc
url_l3agent="${url_lilalo}"/l3-agent
url_l3config_pm="${url_lilalo}"/l3config.pm
url_l3config="${url_lilalo}"/l3-config
url_l3prompt="${url_lilalo}"/l3prompt
url_perl_modules=${url_lilalo}/
perl_modules="Term-VT102 Text-Iconv"
apt_get_install_this="perl make libmodule-build-perl libc6-dev gcc"
wget=wget
uname -a | egrep -qi '(bsd|darwin)' && wget=fetch
normC='\033[0;39m'
14:35:58
#whiteC='\033[1;37m'
syntax on
~
~
~
~
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
".vimrc" [New] 3L, 29C written
14:37:55
#vi .vimrc
14:38:01
#~

14:38:52
#cp .vimrc ~user

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

07:46:40
#cat /etc
cat: /etc: Is a directory
07:49:20
#cat /etc/sh
cat: /etc/sh: No such file or directory
07:50:05
#cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
07:50:14
#ls -l /bin/*sh
-rwxr-xr-x 1 root root 975488 Sep 25  2014 /bin/bash
-rwxr-xr-x 1 root root 106920 Mar  1  2012 /bin/dash
lrwxrwxrwx 1 root root      4 Sep 25  2014 /bin/rbash -> bash
lrwxrwxrwx 1 root root      4 Mar  1  2012 /bin/sh -> dash
07:50:59
#pstree
init-+-acpid
     |-cron
     |-exim4
     |-6*[getty]
     |-2*[l3-agent]
     |-rsyslogd---3*[{rsyslogd}]
     |-sshd-+-sshd---bash---script---script---l3script---pstree
     |      |-2*[sshd---sshd---bash]
     |      `-sshd---sshd---bash---script---script---l3script
     `-udevd
07:57:53
#pstree -h
init-+-acpid
     |-cron
     |-exim4
     |-6*[getty]
     |-2*[l3-agent]
     |-rsyslogd---3*[{rsyslogd}]
     |-sshd-+-sshd---bash---script---script---l3script---pstree
     |      |-2*[sshd---sshd---bash]
     |      `-sshd---sshd---bash---script---script---l3script
     `-udevd
07:58:11
#echo $$
3510
07:58:55
#ps -l -p 3510
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0  3510  3509  0  80   0 -  5432 -      pts/1    00:00:00 l3script
07:59:11
#ps -p 3510
  PID TTY          TIME CMD
 3510 pts/1    00:00:00 l3script
08:00:20
#ps -p $(echo $$)
  PID TTY          TIME CMD
 3510 pts/1    00:00:00 l3script
08:00:37
#head install
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
08:01:35
#head -3 install
#!/bin/sh
hostname=`hostname`
08:01:45
#tail -3 install
show_final_message
08:02:05
#tail install
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Installing perl modules for l3-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
08:02:11
#head -1 install
#!/bin/sh
Important path for current shell
08:03:37
#dash
dash: 1: Syntax error: Bad fd number
08:06:30
#ps -p $(echo $$)
  PID TTY          TIME CMD
 3510 pts/1    00:00:00 l3script
08:06:51
#echo $HISTSIZE
500
08:09:31
#history
    1  ifconfig
    2  vim /etc/network/interfaces
    3  nano /etc/network/interfaces
    4  /etc/init.d/networking restart
    5  ifconfig
    6  route
    7  ping 192.168.13.253
    8  shutdown -r now
    9  exit
   10  ping ya.ru
...
  270  head install
  271  head -3 install
  272  tail -3 install
  273  tail install
  274  head -1 install
  275  #^ Important path for current shell
  276  dash
  277  ps -p $(echo $$)
  278  echo $HISTSIZE
  279  history
08:10:14
#echo $HISTSIZE
500
08:11:57
#echo $HISTFILESIZE
500
08:12:05
#vi /etc/profile
--- /tmp/l3-saved-3510.5880.5710	2020-11-03 09:13:45.631974881 +0200
+++ /etc/profile	2020-11-03 09:18:57.652037110 +0200
@@ -35,3 +35,7 @@
   done
   unset i
 fi
+
+HISTSIZE=4000
+HISTFILESIZE=4000
+export HISTSIZE HISTFILESIZE
/dev/pts/0
08:20:13
#echo $HISTSIZE
4000
08:20:20
#echo $HISTSIZE
4000
прошло 13 минут
08:34:00
#ls

08:34:10
#ls -a
.  ..  .bash_logout  .bashrc  .profile
08:34:16
#vi .bashrc
--- /tmp/l3-saved-6675.25775.8603	2020-11-03 09:35:15.352009474 +0200
+++ .bashrc	2020-11-03 09:36:45.104008333 +0200
@@ -16,8 +16,8 @@
 shopt -s histappend
 
 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
-HISTSIZE=1000
-HISTFILESIZE=2000
+# HISTSIZE=4000
+# HISTFILESIZE=4000
 
 # check the window size after each command and, if necessary,
 # update the values of LINES and COLUMNS.
08:36:45
#vi .bashrc
08:38:45
#cd /etc/s
screenrc                   services                   shells                     staff-group-for-usr-local
securetty                  sgml/                      skel/                      sysctl.conf
security/                  shadow                     ssh/                       sysctl.d/
selinux/                   shadow-                    ssl/                       systemd/
08:38:45
#cd

08:43:10
#user
useradd  userdel  usermod  users
08:43:10
#echo #HISTFILE

08:44:22
#cd ~ivan/.
./             ../            .bash_history  .bash_logout   .bashrc        .profile       .viminfo
08:44:22
#cd

08:44:46
#cd /bin

08:47:35
#ls
bash     date           false      ip        loadkeys  mountpoint      open      rmdir       stty      uncompress     zforce
busybox  dd             fgconsole  kbd_mode  login     mt              openvt    rnano       su        unicode_start  zgrep
cat      df             fgrep      kill      ls        mt-gnu          pidof     run-parts   sync      vdir           zless
chgrp    dir            findmnt    kmod      lsblk     mv              ping      sed         tailf     which          zmore
chmod    dmesg          fuser      less      lsmod     nano            ping6     setfont     tar       ypdomainname   znew
chown    dnsdomainname  grep       lessecho  mkdir     nc              ps        setupcon    tempfile  zcat
chvt     domainname     gunzip     lessfile  mknod     nc.traditional  pwd       sh          touch     zcmp
cp       dumpkeys       gzexe      lesskey   mktemp    netcat          rbash     sh.distrib  true      zdiff
cpio     echo           gzip       lesspipe  more      netstat         readlink  sleep       umount    zegrep
dash     egrep          hostname   ln        mount     nisdomainname   rm        ss          uname     zfgrep
08:48:05
#ls --color
bash     date           false      ip        loadkeys  mountpoint      open      rmdir       stty      uncompress     zforce
busybox  dd             fgconsole  kbd_mode  login     mt              openvt    rnano       su        unicode_start  zgrep
cat      df             fgrep      kill      ls        mt-gnu          pidof     run-parts   sync      vdir           zless
chgrp    dir            findmnt    kmod      lsblk     mv              ping      sed         tailf     which          zmore
chmod    dmesg          fuser      less      lsmod     nano            ping6     setfont     tar       ypdomainname   znew
chown    dnsdomainname  grep       lessecho  mkdir     nc              ps        setupcon    tempfile  zcat
chvt     domainname     gunzip     lessfile  mknod     nc.traditional  pwd       sh          touch     zcmp
cp       dumpkeys       gzexe      lesskey   mktemp    netcat          rbash     sh.distrib  true      zdiff
cpio     echo           gzip       lesspipe  more      netstat         readlink  sleep       umount    zegrep
dash     egrep          hostname   ln        mount     nisdomainname   rm        ss          uname     zfgrep
08:48:22
#ls --color -F
bash*     dd*             fgrep*     kmod*      lsmod@       nc@              pwd*        sh.distrib@  umount*         zfgrep*
busybox*  df*             findmnt*   less*      mkdir*       nc.traditional*  rbash@      sleep*       uname*          zforce*
cat*      dir*            fuser*     lessecho*  mknod*       netcat@          readlink*   ss*          uncompress*     zgrep*
chgrp*    dmesg*          grep*      lessfile@  mktemp*      netstat*         rm*         stty*        unicode_start*  zless*
chmod*    dnsdomainname*  gunzip*    lesskey*   more*        nisdomainname*   rmdir*      su*          vdir*           zmore*
chown*    domainname*     gzexe*     lesspipe*  mount*       open@            rnano@      sync*        which*          znew*
chvt*     dumpkeys*       gzip*      ln*        mountpoint*  openvt*          run-parts*  tailf*       ypdomainname*
cp*       echo*           hostname*  loadkeys*  mt@          pidof@           sed*        tar*         zcat*
cpio*     egrep*          ip*        login*     mt-gnu*      ping*            setfont*    tempfile*    zcmp*
dash*     false*          kbd_mode*  ls*        mv*          ping6*           setupcon*   touch*       zdiff*
date*     fgconsole*      kill*      lsblk*     nano*        ps*              sh@         true*        zegrep*
08:48:30
#ls n*
nano  nc  nc.traditional  netcat  netstat  nisdomainname
08:52:46
#ls *sh
bash  dash  rbash  sh
08:53:09
#ls ??sh
bash  dash
08:53:33
#ls ??s*
bash  busybox  dash  dnsdomainname  fuser  hostname  less  lessecho