| /l3/users/12-9-2016/NT-Ladm/debian1.net.nt/user :1 :2 :3 |
|
|
$ls -a
. acpi ._bash bjon group .j_bash .passwd .. alloca.H .._bash core.c -hello _kik_my Regexp.H _1_2_3 __asterisk bjan fcntl.h _hrypun modules s_tol_ 1cdesktop .bash bjen -file1 isdn_ttyfax.c passwd term.h |
|
$ls .[^.]*
.bash ._bash .j_bash .passwd |
|
$ls .*
.bash ._bash .._bash .j_bash .passwd .: _1_2_3 alloca.H bjen fcntl.h -hello _kik_my Regexp.H 1cdesktop __asterisk bjon -file1 _hrypun modules s_tol_ acpi bjan core.c group isdn_ttyfax.c passwd term.h ..: backup lpi 2 proj bigfile man_smb_conf sh bin matrix.jpg source freebsd.jpg names text granata.jpg ogo.jpg touchlist Light_Alloy_4.4.784_RC2_by_FAFNIR.exe pamyatka.pdf lpi 1 press_any_key_to_continue.jpg |
|
$touch "file with spaces at the name"
|
|
$ls
_1_2_3 bjan -file1 isdn_ttyfax.c s_tol_ 1cdesktop bjen file with spaces at the name _kik_my term.h acpi bjon group modules alloca.H core.c -hello passwd __asterisk fcntl.h _hrypun Regexp.H |
|
$touch 'another very long file name'
|
|
$touch one\ space
|
|
$ls
_1_2_3 bjan file with spaces at the name modules 1cdesktop bjen group one space acpi bjon -hello passwd alloca.H core.c _hrypun Regexp.H another very long file name fcntl.h isdn_ttyfax.c s_tol_ __asterisk -file1 _kik_my term.h |
|
$touch "O'Reilly"
|
|
$ls
_1_2_3 core.c modules 1cdesktop fcntl.h one space acpi -file1 O'Reilly alloca.H file with spaces at the name passwd another very long file name group Regexp.H __asterisk -hello s_tol_ bjan _hrypun term.h bjen isdn_ttyfax.c bjon _kik_my |
|
$touch 'A:\WINDOWS\SYSTEM32'
|
|
$touch "Queen \"Live at Wembley '86\""
|
|
$echo *
_1_2_3 1cdesktop acpi alloca.H another very long file name __asterisk A:\WINDOWS\SYSTEM32 bjan bjen bjon core.c fcntl.h -file1 file with spaces at the name group -hello _hrypun isdn_ttyfax.c _kik_my modules one space O'Reilly passwd Queen "Live at Wembley '86" Regexp.H s_tol_ term.h |
|
$touch -bad-name-
touch: неверный ключ -- b Попробуйте «touch --help» для получения более подробного описания. |
|
$touch "-bad-name-"
touch: неверный ключ -- b Попробуйте «touch --help» для получения более подробного описания. |
|
$touch --bad--name--
touch: ключ --bad--name-- не распознан Попробуйте «touch --help» для получения более подробного описания. |
|
$touch ./-bad./-name./-
touch: невозможно выполнить touch для «./-bad./-name./-»: Нет такого файла или каталога |
|
$cd
|
|
$ls
backup lpi 2 proj bigfile man_smb_conf sh bin matrix.jpg source freebsd.jpg names text granata.jpg ogo.jpg touchlist Light_Alloy_4.4.784_RC2_by_FAFNIR.exe pamyatka.pdf lpi 1 press_any_key_to_continue.jpg |
|
$cat touchlist
file1 file2 file3 directory1 directory2 directory3 aba abb abc abd killall |
|
$cd names/
|
|
$touch 'cat ~/touchlist'
touch: невозможно выполнить touch для «cat ~/touchlist»: Нет такого файла или каталога |
|
$touch `cat ~/touchlist`
|
|
$cd
|
|
$cd names/
|
|
$ls
_1_2_3 file1 1cdesktop -file1 aba file2 abb file3 abc file with spaces at the name abd group acpi -hello alloca.H _hrypun another very long file name isdn_ttyfax.c __asterisk _kik_my A:\WINDOWS\SYSTEM32 killall bjan modules bjen one space bjon O'Reilly core.c passwd directory1 Queen "Live at Wembley '86" directory2 Regexp.H directory3 s_tol_ fcntl.h term.h |
|
$echo date
date |
|
$echo $date
|
|
$echo `date`
Втр Сен 13 14:46:35 EEST 2016 |
|
$echo `date +%Y`
2016 |
|
$echo `date +%Y+1`
2016+1 |
|
$echo $(expr `date +%Y+1`)
2016+1 |
|
$echo $(expr `date +%Y + 1`)
date: лишний операнд «+» Попробуйте «date --help» для получения более подробного описания. expr: пропущен операнд Попробуйте «expr --help» для получения более подробного описания. |
|
$echo $(expr `date +%Y +1`)
date: лишний операнд «+1» Попробуйте «date --help» для получения более подробного описания. expr: пропущен операнд Попробуйте «expr --help» для получения более подробного описания. |
|
$echo $(expr `date +%Y+1`)
2016+1 |
|
$echo $(expr `date +%Y`+1)
2016+1 |
|
$echo $(`date +%Y`+1)
l3script: 2016+1: команда не найдена |
|
$echo $((`date +%Y`+1))
2017 |
|
$ls
_1_2_3 file1 1cdesktop -file1 aba file2 abb file3 abc file with spaces at the name abd group acpi -hello alloca.H _hrypun another very long file name isdn_ttyfax.c __asterisk _kik_my A:\WINDOWS\SYSTEM32 killall bjan modules bjen one space bjon O'Reilly core.c passwd directory1 Queen "Live at Wembley '86" directory2 Regexp.H directory3 s_tol_ fcntl.h term.h |
|
$rm -f `find ~ -name core`
|
|
$ls
_1_2_3 file1 1cdesktop -file1 aba file2 abb file3 abc file with spaces at the name abd group acpi -hello alloca.H _hrypun another very long file name isdn_ttyfax.c __asterisk _kik_my A:\WINDOWS\SYSTEM32 killall bjan modules bjen one space bjon O'Reilly core.c passwd directory1 Queen "Live at Wembley '86" directory2 Regexp.H directory3 s_tol_ fcntl.h term.h |
|
$cd ..
|
|
$ls
backup lpi 2 proj bigfile man_smb_conf sh bin matrix.jpg source freebsd.jpg names text granata.jpg ogo.jpg touchlist Light_Alloy_4.4.784_RC2_by_FAFNIR.exe pamyatka.pdf lpi 1 press_any_key_to_continue.jpg |
|
$echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games |
|
$echo HHHHHHHHHHHHHH$PATHHHHHHHHHHHHHHHHHHHhh
HHHHHHHHHHHHHH |
|
$echo HHHHHHHHHHHHHH${PATH}HHHHHHHHHHHHHHHHHHhh
HHHHHHHHHHHHHH/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/gamesHHHHHHHHHHHHHHHHHHhh |
|
$echo $(((1+2+3)*4*5+1))
121 |
|
$A=1
|
|
$B=2
|
|
$echo $((A+B))
3 |
|
$echo ((A+$B))
l3script: syntax error near unexpected token `('
|
|
$cat /etc/passwd >newfile
|
|
$less newfile
|
|
$sort < newfile
backup:x:34:34:backup:/var/backups:/bin/sh bin:x:2:2:bin:/bin:/bin/sh daemon:x:1:1:daemon:/usr/sbin:/bin/sh Debian-exim:x:101:103::/var/spool/exim4:/bin/false games:x:5:60:games:/usr/games:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh ivan:x:1001:1001::/home/ivan:/bin/bash libuuid:x:100:101::/var/lib/libuuid:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh ... nobody:x:65534:65534:nobody:/nonexistent:/bin/sh petr:x:1002:1002::/home/petr:/bin/bash proxy:x:13:13:proxy:/bin:/bin/sh root:x:0:0:root:/root:/bin/bash sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync sys:x:3:3:sys:/dev:/bin/sh user:x:1000:1000:user,,,:/home/user:/bin/bash uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh |
|
$ls
backup names bigfile newfile bin ogo.jpg freebsd.jpg pamyatka.pdf granata.jpg press_any_key_to_continue.jpg Light_Alloy_4.4.784_RC2_by_FAFNIR.exe proj lpi 1 sh lpi 2 source man_smb_conf text matrix.jpg touchlist |
|
$cat >> unsorted
Windows XP Windows N Solaris Sun OS Linux FreeBSD . ^C |
|
$cat unsorted
Windows XP Windows N Solaris Sun OS Linux FreeBSD . |
|
$sort < unsorted >sorted
|
|
$cat sorted
. FreeBSD Linux Solaris Sun OS Windows N Windows XP |
|
$cat > file
1 2 |
|
$cat >> file
3 4 |
|
$cat file
1 2 3 4 |
|
$mkdir /tmp/etccopy
|
|
$cp -v /etc/* /tmp/etccopy/ 2>&1 | less
|
|
$cp -v /etc/* /tmp/etccopy/ | less
|
|
$cat /etc/passwd | sort | tee sorted_passwd | less
|
|
$ls
backup newfile bigfile ogo.jpg bin pamyatka.pdf file press_any_key_to_continue.jpg freebsd.jpg proj granata.jpg sh Light_Alloy_4.4.784_RC2_by_FAFNIR.exe sorted lpi 1 sorted_passwd lpi 2 source man_smb_conf text matrix.jpg touchlist names unsorted |
|
$car sorted_passwd
l3script: car: команда не найдена |
|
$cat sorted_passwd
backup:x:34:34:backup:/var/backups:/bin/sh bin:x:2:2:bin:/bin:/bin/sh daemon:x:1:1:daemon:/usr/sbin:/bin/sh Debian-exim:x:101:103::/var/spool/exim4:/bin/false games:x:5:60:games:/usr/games:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh ivan:x:1001:1001::/home/ivan:/bin/bash libuuid:x:100:101::/var/lib/libuuid:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh ... nobody:x:65534:65534:nobody:/nonexistent:/bin/sh petr:x:1002:1002::/home/petr:/bin/bash proxy:x:13:13:proxy:/bin:/bin/sh root:x:0:0:root:/root:/bin/bash sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync sys:x:3:3:sys:/dev:/bin/sh user:x:1000:1000:user,,,:/home/user:/bin/bash uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh |
|
$sed 's/:/ /g' /etc/passwd
root x 0 0 root /root /bin/bash daemon x 1 1 daemon /usr/sbin /bin/sh bin x 2 2 bin /bin /bin/sh sys x 3 3 sys /dev /bin/sh sync x 4 65534 sync /bin /bin/sync games x 5 60 games /usr/games /bin/sh man x 6 12 man /var/cache/man /bin/sh lp x 7 7 lp /var/spool/lpd /bin/sh mail x 8 8 mail /var/mail /bin/sh news x 9 9 news /var/spool/news /bin/sh ... list x 38 38 Mailing List Manager /var/list /bin/sh irc x 39 39 ircd /var/run/ircd /bin/sh gnats x 41 41 Gnats Bug-Reporting System (admin) /var/lib/gnats /bin/sh nobody x 65534 65534 nobody /nonexistent /bin/sh libuuid x 100 101 /var/lib/libuuid /bin/sh Debian-exim x 101 103 /var/spool/exim4 /bin/false user x 1000 1000 user,,, /home/user /bin/bash sshd x 102 65534 /var/run/sshd /usr/sbin/nologin ivan x 1001 1001 /home/ivan /bin/bash petr x 1002 1002 /home/petr /bin/bash |
|
$sed 's/[^a]//g' /etc/passwd
a aa aaa aaaaa a aaaa a a aaaaa aaaa aaaa a aaaaa a aaa a a aaa a |
|
$sed 's/[^a]//g' /etc/passwd
a aa aaa aaaaa a aaaa a a aaaaa aaaa aaaa a aaaaa a aaa a a aaa a |
|
$cat /etc/passwd
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh ... list:x:38:38:Mailing List Manager:/var/list:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh Debian-exim:x:101:103::/var/spool/exim4:/bin/false user:x:1000:1000:user,,,:/home/user:/bin/bash sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin ivan:x:1001:1001::/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash |