[root@host shl]#cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@host ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...
[root@host ~]# echo hello world.
hello world.
[root@host ~]#
[root@host ~]# hostname;pwd;whoami
host.localdomain
/root
root
[root@host ~]#
-bash-4.2$ echo hello\
> linux
hellolinux
-bash-4.2$
-bash-4.2$ pwd
/usr/local/kusy
-bash-4.2$ PWD
-bash: PWD: command not found
-bash-4.2$
-bash-4.2$ date '+%Y/%m/%d %H:%M:%S'
2018/11/05 22:36:23
-bash-4.2$ cal 12 2018
December 2018
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
-bash-4.2$
[root@host kusy]# ls -al
total 32
drwxr-xr-x 5 root root 4096 Nov 6 02:17 .
drwxr-xr-x. 15 root root 4096 Oct 30 21:54 ..
drwxr-xr-x 3 root root 4096 Oct 29 04:07 myproject
drwxr-xr-x 5 root root 4096 Oct 29 04:22 mysoftware
-rw------- 1 root root 1679 Oct 29 23:57 sshkey
-rw-r--r-- 1 root root 400 Oct 29 23:57 sshkey.pub
drwxr-xr-x 2 root root 4096 Oct 30 05:10 ssl
-rw-r--r-- 1 root root 5 Nov 6 02:17 .test.txt
[root@host kusy]# ll
total 20
drwxr-xr-x 3 root root 4096 Oct 29 04:07 myproject
drwxr-xr-x 5 root root 4096 Oct 29 04:22 mysoftware
-rw------- 1 root root 1679 Oct 29 23:57 sshkey
-rw-r--r-- 1 root root 400 Oct 29 23:57 sshkey.pub
drwxr-xr-x 2 root root 4096 Oct 30 05:10 ssl
[root@host kusy]# ll --full-time
total 20
drwxr-xr-x 3 root root 4096 2018-10-29 04:07:42.499263925 -0400 myproject
drwxr-xr-x 5 root root 4096 2018-10-29 04:22:32.612639261 -0400 mysoftware
-rw------- 1 root root 1679 2018-10-29 23:57:49.737676506 -0400 sshkey
-rw-r--r-- 1 root root 400 2018-10-29 23:57:49.737676506 -0400 sshkey.pub
drwxr-xr-x 2 root root 4096 2018-10-30 05:10:11.676048683 -0400 ssl
[root@host kusy]# cat /etc/locale.conf
LANG="en_US.UTF-8"
[root@host test]# ll
total 4
-rw-r--r-- 1 root root 5 Nov 6 03:49 test.txt
[root@host test]# chgrp kusy test.txt
[root@host test]# ll
total 4
-rw-r--r-- 1 root kusy 5 Nov 6 03:49 test.txt
[root@host test]# chown kusy test.txt
[root@host test]# ll
total 4
-rw-r--r-- 1 kusy kusy 5 Nov 6 03:49 test.txt
[root@host test]# chmod 774 test.txt
[root@host test]# ll
total 4
-rwxrwxr-- 1 kusy kusy 5 Nov 6 03:49 test.txt
-bash-4.2$ id kusy
uid=1000(kusy) gid=1000(kusy) groups=1000(kusy)
-bash-4.2$ whoami
zoey
-bash-4.2$ groups
zoey
-bash-4.2$
[root@host ~]# uname -a
Linux host.localdomain 4.10.4-1.el7.elrepo.x86_64 #1 SMP Sat Mar 18 12:50:10 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@host usr]# pwd
/usr
[root@host usr]# cd ~
[root@host ~]# pwd
/root
[root@host ~]# cd -
/usr
[root@host usr]# pwd
/usr
[root@host usr]# mkdir testAbc
[root@host usr]# ll testAbc
total 0
[root@host usr]# rmdir testAbc
[root@host usr]# ll testAbc
ls: cannot access testAbc: No such file or directory
[root@host ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@host ~]# PATH="$PATH:/usr"
[root@host ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr
[root@host test]# ll
total 0
[root@host test]# touch test.txt
[root@host test]# ll
total 0
-rw-r--r-- 1 root root 0 Nov 7 03:16 test.txt
[root@host test]# mv test.txt test2.txt
[root@host test]# ll
total 0
-rw-r--r-- 1 root root 0 Nov 7 03:16 test2.txt
[root@host test]# cp test2.txt test.txt
[root@host test]# ll
total 0
-rw-r--r-- 1 root root 0 Nov 7 03:16 test2.txt
-rw-r--r-- 1 root root 0 Nov 7 03:17 test.txt
[root@host test]# rm test2.txt
rm: remove regular empty file ‘test2.txt’? y
[root@host test]# ll
total 0
-rw-r--r-- 1 root root 0 Nov 7 03:17 test.txt
[root@host test]#
[root@host test]# pwd
/usr/local/kusy/test
[root@host test]# basename $PWD
test
[root@host test]# dirname $PWD
/usr/local/kusy
[root@host test]#
[root@host test]# echo abcdefg123456>test.txt
[root@host test]# cat test.txt
abcdefg123456
[root@host test]# od test.txt
0000000 061141 062143 063145 030547 031462 032464 005066
0000016
[root@host test]# nl test.txt
1 abcdefg123456
[root@host test]#
[root@host test]# ll
total 4
-rw-r--r-- 1 root root 14 Nov 7 03:23 test.txt
[root@host test]# which pwd
/usr/bin/pwd
[root@host test]# whereis test.txt
test: /usr/bin/test /usr/share/man/man1/test.1.gz
[root@host test]# find test.txt
test.txt
[root@host test]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 247420 0 247420 0% /dev
tmpfs 258040 0 258040 0% /dev/shm
tmpfs 258040 12712 245328 5% /run
tmpfs 258040 0 258040 0% /sys/fs/cgroup
/dev/sda2 10882760 3469384 6840868 34% /
/dev/sda1 388480 145230 222770 40% /boot
overlay 10882760 3469384 6840868 34% /var/lib/docker/overlay2/1eae537748a1b16e224390ea20b70dea76e1bd0f9f56bfa451be833fca59ad48/merged
shm 65536 0 65536 0% /var/lib/docker/containers/27f5c03b4828514fadf18e6ee8babbf39adfb8b730f14ea122fefeed331acc6d/mounts/shm
tmpfs 51608 0 51608 0% /run/user/0
[root@host test]#
[root@host test]# ll -i -R
.:
total 4
528553 drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
./cc:
total 4
528556 -rw-r--r-- 1 root root 14 Nov 7 03:23 test.txt
[root@host test]# ln cc/test.txt .
[root@host test]# ll -i -R
.:
total 8
528553 drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
528556 -rw-r--r-- 2 root root 14 Nov 7 03:23 test.txt
./cc:
total 4
528556 -rw-r--r-- 2 root root 14 Nov 7 03:23 test.txt
[root@host test]# ln -s cc/test.txt test2.txt
[root@host test]# ll -i -R
.:
total 8
528553 drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
528559 lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
528556 -rw-r--r-- 2 root root 14 Nov 7 03:23 test.txt
./cc:
total 4
528556 -rw-r--r-- 2 root root 14 Nov 7 03:23 test.txt
[root@host test]#
[root@host test]# tar cvf test.tar test.txt
test.txt
[root@host test]# ll
total 36
drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
-rw-r--r-- 2 root root 10240 Nov 7 21:28 test.txt
[root@host test]# rm -f test.txt
[root@host test]# gzip -v test.tar
test.tar: 99.5% -- replaced with test.tar.gz
[root@host test]# ll
total 8
drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 132 Nov 7 21:28 test.tar.gz
[root@host test]# zcat test.tar.gz
test.txt0000644000000000000000000002400013370717510011274 0ustar rootroot[root@host test]#
[root@host test]# gzip -d test.tar.gz
[root@host test]# ll
total 24
drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
[root@host test]# tar xf test.tar
[root@host test]# ll
total 36
drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
-rw-r--r-- 1 root root 10240 Nov 7 21:28 test.txt
[root@host test]# tar tvf test.tar
-rw-r--r-- root/root 10240 2018-11-07 21:28 test.txt
[root@host test]#
[root@host ~]# cat ~/.bash_history
cd /
ls
free
passwd root
clear
pwd
ll
yum install java
java
java -version
python
ls
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce
service docker start
docker ps
docker images
docker ps
sudo docker run hello-world
clear
docker ps
docker imagwees
clear
docker images
docker run hello-world
docker pull oddrationale/docker-shadowsocks
docker run -d -p 1991:1991 oddrationale/docker-shadowsocks -s 0.0.0.0 -p 1991 -k 123456 -m aes-256-cfb
docker ps
....
[root@host ~]# alias eo='echo'
[root@host ~]# eo hello linux
hello linux
[root@host ~]#
[root@host test]# ll
total 28
drwxr-xr-x 2 root root 4096 Nov 7 04:19 cc
-rw-r--r-- 1 root root 44 Nov 7 22:13 test
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
[root@host test]# ll te*
-rw-r--r-- 1 root root 44 Nov 7 22:13 test
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
[root@host test]# ll te*.tar
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
[root@host test]# ll *
-rw-r--r-- 1 root root 44 Nov 7 22:13 test
lrwxrwxrwx 1 root root 11 Nov 7 04:21 test2.txt -> cc/test.txt
-rw-r--r-- 1 root root 20480 Nov 7 21:28 test.tar
cc:
total 12
-rw-r--r-- 1 root root 10240 Nov 7 21:28 test.txt
[root@host test]#
[root@host test]# type -a ll
ll is aliased to `ls -l --color=auto'
[root@host test]# type pwd
pwd is a shell builtin
[root@host test]#
[root@host test]# varA = 123
-bash: varA: command not found
[root@host test]# varA=123
[root@host test]# echo ${varA}
123
[root@host test]#
[root@host ~]# echo `echo a`
a
[root@host ~]# echo echo a
echo a
[root@host ~]#
[root@host ~]# kusy=wangjz
[root@host ~]# echo $kusy
wangjz
[root@host ~]# unset kusy
[root@host ~]# echo $kusy
[root@host ~]#
[root@host ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@host ~]# su - kusy
Last login: Thu Nov 8 01:52:32 EST 2018 on pts/0
-bash-4.2$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin
-bash-4.2$
[root@host shl]# cat test1.sh
export kusy=wangjz
./test2.sh
[root@host shl]# cat test2.sh
echo $kusy
[root@host shl]# ./test1.sh
wangjz
[root@host shl]#
---------------------------------------------------------
[root@host shl]# cat test1.sh test2.sh
kusy=wangjz
./test2.sh
echo $kusy
[root@host shl]# ./test1.sh
[root@host shl]#
[root@host shl]# env
XDG_SESSION_ID=268
HOSTNAME=host.localdomain
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
...
[root@host shl]# set
BASH=/bin/bash
...
_=
colors=/root/.dircolors
kusy=wangjz
[root@host shl]# PS1='[\u@\h \W]__\$'
[root@host shl]__#
[root@host shl]#echo $$
2336
[root@host shl]#cat test1.sh
echo $$
[root@host shl]#./test1.sh
2432
[root@host shl]#
[root@host shl]#echo a
a
[root@host shl]#echo $?
0
[root@host shl]#xxss
-bash: xxss: command not found
[root@host shl]#echo $?
127
[root@host shl]#
[root@host shl]#history 1
4 history 1
[root@host shl]#history
1 history
2 history -1
3 clear
4 history 1
5 history
[root@host shl]#history -c
[root@host shl]#history
1 history
[root@host shl]#
[root@host shl]#xxx>11.txt 2>22.txt
[root@host shl]#ll
total 12
-rw-r--r-- 1 root root 0 Nov 8 03:54 11.txt
-rw-r--r-- 1 root root 30 Nov 8 03:54 22.txt
-rwxrwx--- 1 root root 8 Nov 8 02:52 test1.sh
-rwxrwx--- 1 root root 11 Nov 8 02:21 test2.sh
[root@host shl]#xxx>11.txt 2>/dev/null
[root@host shl]#ll
total 12
-rw-r--r-- 1 root root 0 Nov 8 03:55 11.txt
-rw-r--r-- 1 root root 30 Nov 8 03:54 22.txt
-rwxrwx--- 1 root root 8 Nov 8 02:52 test1.sh
-rwxrwx--- 1 root root 11 Nov 8 02:21 test2.sh
[root@host shl]#
[root@host shl]#echo aaa>aa 2>&1
[root@host shl]#bbb>bb 2>&1
[root@host shl]#cat aa
aaa
[root@host shl]#cat bb
-bash: bbb: command not found
[root@host shl]#
[root@host shl]#cat aa
aa
[root@host shl]#echo bb>aa
[root@host shl]#cat aa
bb
[root@host shl]#echo cc>>aa
[root@host shl]#cat aa
bb
cc
[root@host shl]#cat >bb <aa
[root@host shl]#cat bb
bb
cc
[root@host shl]#
[root@host shl]#echo a && xxx
a
-bash: xxx: command not found
[root@host shl]#xxx && echo a
-bash: xxx: command not found
[root@host shl]#echo a || xxx
a
[root@host shl]#xxx || echo a
-bash: xxx: command not found
a
[root@host shl]#
[root@host shl]#echo aaaaaaaaaaaaaaaaaa|tail
aaaaaaaaaaaaaaaaaa
[root@host shl]#echo aa-bb-cc | cut -d '-' -f 1
aa
[root@host shl]#echo aa-bb-cc | cut -d '-' -f 1,3
aa-cc
[root@host shl]#echo abcdefg|grep 'ef'
abcdefg
[root@host shl]#cat aa
bb
cc
[root@host shl]#grep 'bb' aa
bb
[root@host shl]#
[root@host shl]#cat aa
bb
cc
[root@host shl]#cat aa |wc
2 2 6(依次是行数、字数、字符数)
[root@host shl]#wc aa
2 2 6 aa
[root@host shl]#wc aa -l
2 aa
[root@host shl]#
[root@host shl]#echo aa>aa
[root@host shl]#echo bb|tee bb
bb
[root@host shl]#ll
total 16
-rw-r--r-- 1 root root 3 Nov 8 04:51 aa
-rw-r--r-- 1 root root 3 Nov 8 04:52 bb
-rwxrwx--- 1 root root 8 Nov 8 02:52 test1.sh
-rwxrwx--- 1 root root 11 Nov 8 02:21 test2.sh
[root@host shl]#
[root@host shl]#echo abcdef|tr -d 'cd'
abef
[root@host shl]#echo abcdef|tr 'cd' 'ee'
abeeef
[root@host shl]#
~~ 待续 ~~
PS:结合《鸟哥的linux私房菜》学习笔记