/l3/users/bas/2011-03/linux2.unix.bas/user :1 :2 :3 |
|
$ls -l /tmp/D2/dir
total 0 ?--------- ? ? ? ? ? FILE |
$cat /tmp/D2/dir/FILE
![]() cat: /tmp/D2/dir/FILE: Permission denied |
$ls -l /tmp/D2/dir
total 0 ?--------- ? ? ? ? ? FILE ?--------- ? ? ? ? ? FILE1 ?--------- ? ? ? ? ? FILE2 ?--------- ? ? ? ? ? FILE3 ?--------- ? ? ? ? ? FILE4 |
$ls -li /tmp/D2/dir
total 0 ??--------- ? ? ? ? ? FILE ??--------- ? ? ? ? ? FILE1 ??--------- ? ? ? ? ? FILE2 ??--------- ? ? ? ? ? FILE3 ??--------- ? ? ? ? ? FILE4 |
$ls -l /tmp/D2/dir/FILE1
-rw-r--r-- 1 root root 7 Mar 29 15:05 /tmp/D2/dir/FILE1 |
$cat /tmp/D2/dir/FILE1
secret |
$touch /tmp/d
|
$mkdir /tmp/D
|
$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 |
$grep umask /etc/bashrc
umask 002 umask 022 |
$pstr
![]() pstree pstree.x11 pstruct |
$pstree | less
|
$umask 077
|
$touch /tmp/U1
|
$ls -l /tmp/U1
-rw------- 1 user user 0 Mar 29 15:16 /tmp/U1 |
$chown root /tmp/FFF
![]() chown: changing ownership of `/tmp/FFF': Operation not permitted |
$chgrp audio /tmp/FFF
|
$chown :lp /tmp/FFF
![]() chown: changing group of `/tmp/FFF': Operation not permitted |
$chgrp lp /tmp/FFF
![]() chgrp: changing group of `/tmp/FFF': Operation not permitted |
$ls -l /tmp/FFF
-rw-rw-r-- 1 user audio 0 Mar 29 15:27 /tmp/FFF |
$id
uid=500(user) gid=500(user) groups=63(audio),500(user) |
$chgrp user /tmp/FFF
|
$ls -l /tmp/FFF
-rw-rw-r-- 1 user user 0 Mar 29 15:27 /tmp/FFF |
$chown :audio /tmp/FFF
|
$newgrp audio
![]() Password: Sorry. |
$id
uid=500(user) gid=500(user) groups=63(audio),500(user) |
$ls -l /etc/passwd
-rw-r--r-- 1 root root 1636 Mar 29 13:20 /etc/passwd |
$hello world!
![]() bash: hello: command not found |
$# hello world!
![]() |
$echo hello world!
hello world! |
$# echo hello world! > file1
|
$echo hello world! > file1
![]() bash: file1: Permission denied |
$cd /tmp
|
$echo hello world! > file1
|
$less file1
![]() |
$less file1
![]() |
$jobs
[1]+ Stopped less file1 |
$mkdir /tmp/disk
|
$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/ |
$set -o vi
|
$set -o emacs
|
$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 |
$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 |
$ls -l ~/.bash_history
-rw------- 1 user user 1351 Mar 29 15:24 /home/user/.bash_history |
$!176
set -o emacs |
$!em
bash: !em: event not found |
$!emacs
bash: !emacs: event not found |
$!set
set -o emacs |
$!j
jobs |
$which passwd
/usr/bin/passwd |
$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) |
$touch /tmp/{1,2,3,4}.txt
|
$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 |
$find /tmp -name \*.txt 2> /dev/null
![]() /tmp/2.txt /tmp/4.txt /tmp/1.txt /tmp/3.txt |
$mkdir /tmp/txt
|
$find /tmp -name \*.txt 2> /dev/null
![]() /tmp/2.txt /tmp/4.txt /tmp/1.txt /tmp/3.txt |
$cp `!!` /tmp/txt
cp `find /tmp -name \*.txt 2> /dev/null` /tmp/txt |
$ls /tmp/txt
1.txt 2.txt 3.txt 4.txt |
$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 |
$./super-puper-hyper-script
hello |
$[user@linux2:tmp]$ vim super-puper-hyper-script
![]() bash: [user@linux2:tmp]$: command not found |
$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 |
$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 |
$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 |
$rm `find . -name \*.txt 2> /dev/null`
|
$echo `find . -name \*.txt 2> /dev/null`
|
$history -c
![]() |
$ls -l ~/.bash_logout
-rw-r--r-- 1 user user 33 Jan 22 2009 /home/user/.bash_logout |
$echo $BASH
![]() $BASH $BASH_ARGV $BASH_LINENO $BASH_SUBSHELL $BASH_VERSION $BASH_ARGC $BASH_COMMAND $BASH_SOURCE $BASH_VERSINFO |
$history -h
![]() bash: history: -h: invalid option history: usage: history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...] |
$man bash
|
$man
![]() |
$. /etc/bash_completion
|
$man
![]() |
$man bash
![]() |
$ssh-keyscan 192.168.15.{1..5} >> ~/.ssh/known_hosts
![]() bash: /home/user/.ssh/known_hosts: No such file or directory |
$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: |
$ping
::1 localhost localhost6.localdomain6 192.168.15.1 localhost6 localhost.localdomain |
$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: |
$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: |
$ssh-
![]() ssh-add ssh-agent ssh-copy-id ssh-keygen ssh-keyscan |
$ping 192.168.15.
![]() 192.168.15.1 192.168.15.2 192.168.15.3 192.168.15.4 |
$man bas
![]() |
$rpm -q
Display all 748 possibilities? (y or n) |
$vim /home/user/.bashrc
|
$~
# /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 |