/l3/users/27-3-2017/NT-Ladm/debian3.net.nt/root :1 :2 :3 :4 :5 :6 :7 :8 :9 :10 |
|
#ls
backup bin debian3 debian3.text2 file granata.jpg lpi 1 man_smb_conf names pamyatka.pdf press_any_key_to_continue.jpg screenrc temp.tar touchlist bigfile cod debian3.text debian3.txt freebsd.jpg light_alloy_4.4.784_rc2_by_fafnir.exe lpi 2 matrix.jpg ogo.jpg passwd proj sh text |
#find ~ -regex '.*(\.tar|\.gz|\.tgz|\.rmp)'
|
#man find
|
#find ~ -regex '.*(\.tar|\.gz|\.tgz|\.rmp)' -regextype posix-egrep
|
#ls
backup bin debian3 debian3.text2 file granata.jpg lpi 1 man_smb_conf names pamyatka.pdf press_any_key_to_continue.jpg screenrc temp.tar touchlist bigfile cod debian3.text debian3.txt freebsd.jpg light_alloy_4.4.784_rc2_by_fafnir.exe lpi 2 matrix.jpg ogo.jpg passwd proj sh text |
#pwd
/home/user |
#find ~user -regex '.*(\.tar|\.gz|\.tgz|\.rmp)' -regextype posix-egrep
|
#find ~user -regex '.*(\.tar\.gz|\.tgz|\.rmp)' -regextype posix-egrep
|
#find ~user -regex '.*(\.tar|\.gz|\.tgz|\.rmp)' -regextype posix-egrep
|
#find /home/user/ -regex '.*(\.tar|\.gz|\.tgz|\.rmp)' -regextype posix-egrep
.aptitude/ cod/ .l3rc names/ sh/ backup/ debian3 .lesshst ogo.jpg .ssh/ .bash_history debian3.text light_alloy_4.4.784_rc2_by_fafnir.exe pamyatka.pdf temp.tar .bash_logout debian3.text2 .lilalo/ passwd text/ .bash_profile debian3.txt lpi 1/ press_any_key_to_continue.jpg touchlist .bashrc file lpi 2/ .profile .vifm/ bigfile freebsd.jpg man_smb_conf proj/ .viminfo bin/ granata.jpg matrix.jpg screenrc .w3m/ |
#ls /home/user/
![]() .aptitude/ cod/ .l3rc names/ sh/ backup/ debian3 .lesshst ogo.jpg .ssh/ .bash_history debian3.text light_alloy_4.4.784_rc2_by_fafnir.exe pamyatka.pdf temp.tar .bash_logout debian3.text2 .lilalo/ passwd text/ .bash_profile debian3.txt lpi 1/ press_any_key_to_continue.jpg touchlist .bashrc file lpi 2/ .profile .vifm/ bigfile freebsd.jpg man_smb_conf proj/ .viminfo bin/ granata.jpg matrix.jpg screenrc .w3m/ |
#ls /home/user/
backup bin debian3 debian3.text2 file granata.jpg lpi 1 man_smb_conf names pamyatka.pdf press_any_key_to_continue.jpg screenrc temp.tar touchlist bigfile cod debian3.text debian3.txt freebsd.jpg light_alloy_4.4.784_rc2_by_fafnir.exe lpi 2 matrix.jpg ogo.jpg passwd proj sh text |
#ls /home
ivan petr user |
#find /home/user -regex '\.tar' -regextype posix-egrep
|
#find /home/user/ -regex '\.tar' -regextype posix-egrep
|
#find /home/user/ -regex '\.tar' -regextype posix-egrep
|
#find /home/user/ -regex '\.tar'
|
#find /home/user/ -regex '*\.tar'
|
#find /home/user/ -regex '*\.tar'
|
#find /home/user/ -regex '*\.tar'
|
#ls
backup bin debian3 debian3.text2 file granata.jpg lpi 1 man_smb_conf names pamyatka.pdf press_any_key_to_continue.jpg screenrc temp.tar touchlist bigfile cod debian3.text debian3.txt freebsd.jpg light_alloy_4.4.784_rc2_by_fafnir.exe lpi 2 matrix.jpg ogo.jpg passwd proj sh text |
#find /home/user/ -regex '*\.tar'
|
#pwd
/home/user |
#man find
|
#man find
|
#find /home/user/ -regextype posix-grep -regex '*\.tar'
![]() find: Unknown regular expression type `posix-grep'; valid types are `findutils-default', `awk', `egrep', `ed', `emacs', `gnu-awk', `grep', `posix-awk', `posix-basic', `posix-egrep', `posix-extended', `posix-minimal-basic', `sed'. |
#find /home/user/ -regextype posix-egrep -regex '*\.tar'
|
#find /home/user/ -regextype posix-egrep -regex '.*\.tar'
/home/user/temp.tar |
#a=1
|
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.187 49228 22 L3_PARENT_TTY=/dev/pts/0 L3_TAMPERED_EDITORS= vi vim pico nano SSH_TTY=/dev/pts/0 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=31383263589649259-1490769712 PWD=/home/user LANG=ru_RU.UTF-8 |
#echo $a
1 |
#bash
root@debian3:/home/user# echo $a root@debian3:/home/user# pstree init─┬─acpid ├─cron ├─exim4 ├─6*[getty] ├─2*[l3-agent] ├─rsyslogd───3*[{rsyslogd}] ├─sshd───sshd───bash───script───script───l3script───bash───pstree └─udevd root@debian3:/home/user# pstree -h init─┬─acpid ├─cron ├─exim4 ├─6*[getty] ├─2*[l3-agent] ├─rsyslogd───3*[{rsyslogd}] ├─sshd───sshd───bash───script───script───l3script───bash───pstree └─udevd root@debian3:/home/user# exit |
#echo $a
1 |
#pstree -h
init─┬─acpid ├─cron ├─exim4 ├─6*[getty] ├─2*[l3-agent] ├─rsyslogd───3*[{rsyslogd}] ├─sshd───sshd───bash───script───script───l3script───pstree └─udevd |
#export a
|
#bash
root@debian3:/home/user# echo $a 1 root@debian3:/home/user# exit |
#set
BASH=/usr/local/bin/l3script BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath BASH_ALIASES=() BASH_ARGC=() BASH_ARGV=() BASH_CMDS=() BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="4" [1]="2" [2]="37" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu") BASH_VERSION='4.2.37(1)-release' ... MACHTYPE=x86_64-pc-linux-gnu MAIL=/var/mail/root MAILCHECK=60 OLDPWD=/home OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PIPESTATUS=([0]="0") PPID=14495 |
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.187 49228 22 L3_PARENT_TTY=/dev/pts/0 OLDPWD=/home L3_TAMPERED_EDITORS= vi vim pico nano SSH_TTY=/dev/pts/0 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=31383263589649259-1490769712 a=1 PWD=/home/user LANG=ru_RU.UTF-8 |
#export
declare -x HISTFILESIZE="2000" declare -x HISTSIZE="2000" declare -x HOME="/root" declare -x L3_HOME="/root/.lilalo/" declare -x L3_PARENT_TTY="/dev/pts/0" declare -x L3_SESSION_ID="31383263589649259-1490769712" declare -x L3_TAMPERED_EDITORS=" vi vim pico nano" declare -x LANG="ru_RU.UTF-8" declare -x LANGUAGE="ru_UA:ru" declare -x LOGNAME="root" declare -x MAIL="/var/mail/root" declare -x OLDPWD="/home" declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
#man set
![]() |
#help set
set: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] Set or unset values of shell options and positional parameters. Change the value of shell attributes and positional parameters, or display the names and values of shell variables. Options: -a Mark variables which are modified or created for export. -b Notify of job termination immediately. -e Exit immediately if a command exits with a non-zero status. -f Disable file name generation (globbing). -h Remember the location of commands as they are looked up. ... are unset. - Assign any remaining arguments to the positional parameters. The -x and -v options are turned off. Using + rather than - causes these flags to be turned off. The flags can also be used upon invocation of the shell. The current set of flags may be found in $-. The remaining n ARGs are positional parameters and are assigned, in order, to $1, $2, .. $n. If no ARGs are given, all shell variables are printed. Exit Status: Returns success unless an invalid option is given. |
#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 history -anrw [filename] or history -ps arg [arg...] (( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x command [args] : kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] ... export [-fn] [name[=value] ...] or export -p typeset [-aAfFgilrtux] [-p] name[=value] ... false ulimit [-SHacdefilmnpqrstuvx] [limit] fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command] umask [-p] [-S] [mode] fg [job_spec] unalias [-a] name [name ...] for NAME [in WORDS ... ] ; do COMMANDS; done unset [-f] [-v] [name ...] for (( exp1; exp2; exp3 )); do COMMANDS; done until COMMANDS; do COMMANDS; done function name { COMMANDS ; } or name () { COMMANDS ; } variables - Names and meanings of some shell variables getopts optstring name [arg] wait [id] hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS; done help [-dms] [pattern ...] { COMMANDS ; } |
#help emacs
![]() l3script: help: no help topics match `emacs'. Try `help help' or `man -k emacs' or `info emacs'. |
#help set
set: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] Set or unset values of shell options and positional parameters. Change the value of shell attributes and positional parameters, or display the names and values of shell variables. Options: -a Mark variables which are modified or created for export. -b Notify of job termination immediately. -e Exit immediately if a command exits with a non-zero status. -f Disable file name generation (globbing). -h Remember the location of commands as they are looked up. ... are unset. - Assign any remaining arguments to the positional parameters. The -x and -v options are turned off. Using + rather than - causes these flags to be turned off. The flags can also be used upon invocation of the shell. The current set of flags may be found in $-. The remaining n ARGs are positional parameters and are assigned, in order, to $1, $2, .. $n. If no ARGs are given, all shell variables are printed. Exit Status: Returns success unless an invalid option is given. |
#help set | grep emacs
emacs use an emacs-style line editing interface |
#help set | grep vim
![]() |
#help env
![]() l3script: help: no help topics match `env'. Try `help help' or `man -k env' or `info env'. |
#env --help
ÐÑполÑзование: env [ÐÐ-] [ÐÐЯ=ÐÐÐЧÐÐÐÐ]⦠[ÐÐÐÐÐÐÐ [ÐÐ Ð]â¦] ÐÑиÑÐ²Ð°Ð¸Ð²Ð°ÐµÑ ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ ÐÐÐÐÐ ÑооÑвеÑÑÑвÑÑÑее ÐÐÐЧÐÐÐРи запÑÑÐºÐ°ÐµÑ ÐÐÐÐÐÐУ в ÑÑом окÑÑжении. -i, --ignore-environment наÑаÑÑ Ñ Ð¿ÑÑÑÑм окÑÑжением -0, --null завеÑÑаÑÑ ÐºÐ°Ð¶Ð´ÑÑ Ð²ÑводимÑÑ ÑÑÑÐ¾ÐºÑ 0-м байÑом, a не Ñимволом новой ÑÑÑоки -u, --unset=ÐÐЯ ÑдалиÑÑ Ð¿ÐµÑеменнÑÑ Ñ ÐÐÐÐÐРиз окÑÑÐ¶ÐµÐ½Ð¸Ñ --help показаÑÑ ÑÑÑ ÑпÑÐ°Ð²ÐºÑ Ð¸ вÑйÑи --version показаÑÑ Ð¸Ð½ÑоÑмаÑÐ¸Ñ Ð¾ веÑÑии и вÑйÑи ÐÑоÑÑо «-» -- Ñиноним Ð´Ð»Ñ Â«-i». ÐÑли не задана ÐÐÐÐÐÐÐ, пеÑаÑÐ°ÐµÑ Ð¿Ð¾Ð»ÑÑивÑееÑÑ Ð¾ÐºÑÑжение. Ðб оÑÐ¸Ð±ÐºÐ°Ñ Ð² env ÑообÑайÑе по адÑеÑÑ bug-coreutils@gnu.org. ÐомаÑнÑÑ ÑÑÑаниÑа GNU coreutils: <http://www.gnu.org/software/coreutils/> СпÑавка по ÑабоÑе Ñ Ð¿ÑогÑаммами GNU: <http://www.gnu.org/gethelp/> Ðб оÑÐ¸Ð±ÐºÐ°Ñ Ð² пеÑеводе ÑообÑений «env» ÑообÑайÑе по адÑеÑÑ <gnu@mx.ru> ÐÐ¾Ð»Ð½Ð°Ñ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ Ð´Ð¾ÑÑÑпна по команде: info coreutils 'env invocation' |
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.187 49228 22 L3_PARENT_TTY=/dev/pts/0 OLDPWD=/home L3_TAMPERED_EDITORS= vi vim pico nano SSH_TTY=/dev/pts/0 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=31383263589649259-1490769712 a=1 PWD=/home/user LANG=ru_RU.UTF-8 |
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.187 49228 22 L3_PARENT_TTY=/dev/pts/0 OLDPWD=/home L3_TAMPERED_EDITORS= vi vim pico nano SSH_TTY=/dev/pts/0 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=31383263589649259-1490769712 a=1 PWD=/home/user LANG=ru_RU.UTF-8 |
#export
declare -x HISTFILESIZE="2000" declare -x HISTSIZE="2000" declare -x HOME="/root" declare -x L3_HOME="/root/.lilalo/" declare -x L3_PARENT_TTY="/dev/pts/0" declare -x L3_SESSION_ID="31383263589649259-1490769712" declare -x L3_TAMPERED_EDITORS=" vi vim pico nano" declare -x LANG="ru_RU.UTF-8" declare -x LANGUAGE="ru_UA:ru" declare -x LOGNAME="root" declare -x MAIL="/var/mail/root" declare -x OLDPWD="/home" declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
#export
declare -x HISTFILESIZE="2000" declare -x HISTSIZE="2000" declare -x HOME="/root" declare -x L3_HOME="/root/.lilalo/" declare -x L3_PARENT_TTY="/dev/pts/0" declare -x L3_SESSION_ID="31383263589649259-1490769712" declare -x L3_TAMPERED_EDITORS=" vi vim pico nano" declare -x LANG="ru_RU.UTF-8" declare -x LANGUAGE="ru_UA:ru" declare -x LOGNAME="root" declare -x MAIL="/var/mail/root" declare -x OLDPWD="/home" declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.187 49228 22 L3_PARENT_TTY=/dev/pts/0 OLDPWD=/home L3_TAMPERED_EDITORS= vi vim pico nano SSH_TTY=/dev/pts/0 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=31383263589649259-1490769712 a=1 PWD=/home/user LANG=ru_RU.UTF-8 |
#help export
export: export [-fn] [name[=value] ...] or export -p Set export attribute for shell variables. Marks each NAME for automatic export to the environment of subsequently executed commands. If VALUE is supplied, assign VALUE before exporting. Options: -f refer to shell functions -n remove the export property from each NAME -p display a list of all exported variables and functions An argument of `--' disables further option processing. Exit Status: Returns success unless an invalid option is given or NAME is invalid. |
#export -p
declare -x HISTFILESIZE="2000" declare -x HISTSIZE="2000" declare -x HOME="/root" declare -x L3_HOME="/root/.lilalo/" declare -x L3_PARENT_TTY="/dev/pts/0" declare -x L3_SESSION_ID="31383263589649259-1490769712" declare -x L3_TAMPERED_EDITORS=" vi vim pico nano" declare -x LANG="ru_RU.UTF-8" declare -x LANGUAGE="ru_UA:ru" declare -x LOGNAME="root" declare -x MAIL="/var/mail/root" declare -x OLDPWD="/home" declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
#echo $Ps1
|
#echo $Ps1
|
#echo $PS1
|
#mkdir scripts
|
#cd scripts/
|
#vi shell.sh
![]() --- /dev/null 2017-03-27 13:30:21.879999998 +0300 +++ shell.sh 2017-03-29 14:24:05.343932263 +0300 @@ -0,0 +1,4 @@ +#!/bin/bash + +users=`awk -F: '$3>=1000&&$3==65534{print $1}' | tr "\n" " "` +echo $users |
#chmod u+x shell.sh
|
#pwd
/home/user/scripts |
#/home/user/scripts/shell.sh
^C |
#./shell.sh
nobody |
#vi shell.sh
--- /tmp/l3-saved-14496.7784.20248 2017-03-29 14:29:14.703920862 +0300 +++ shell.sh 2017-03-29 14:32:01.007924913 +0300 @@ -1,4 +1,4 @@ #!/bin/bash -users=`awk -F: '$3>=1000&&$3==65534{print $1}' /etc/passwd | tr "\n" " "` +users=`awk -F: '$3>=1000&&$3!=65534{print $1}' /etc/passwd | tr "\n" " "` echo $users |
#vi shell.sh
|
#vim .vimrc
![]() --- /dev/null 2017-03-27 13:30:21.879999998 +0300 +++ .vimrc 2017-03-29 14:32:49.463918874 +0300 @@ -0,0 +1,2 @@ +set syntax=on +set nnoremap <F7> :!%:p<Enter> |
#vim .vimrc
|
#~
#!/bin/bash users=`awk -F: '$3>=1000&&$3!=65534{print $1}' /etc/passwd | tr "\n" " "` echo $users "shell.sh" 4L, 99C |
#~
shell.sh |
#ls -lah
итого 16K drwxr-xr-x 2 root root 4,0K Мар 29 14:33 . drwxr-xr-x 17 user user 4,0K Мар 29 14:16 .. -rwxr--r-- 1 root root 99 Мар 29 14:32 shell.sh -rw-r--r-- 1 root root 45 Мар 29 14:32 .vimrc |
#useradd -m anna
|
|