.23.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe61:eb6b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11444 errors:0 dropped:0 overruns:0 frame:0
TX packets:3638 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:825629 (806.2 KiB) TX bytes:461351 (450.5 KiB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1532 (1.4 KiB) TX bytes:1532 (1.4 KiB)
-bash: ifconfig2: command not found
命令>>文件1 2>>文件2 ——分开保存
这三个操作是这一块需要记下来的!
--输入重定向
wc命令
[root@andy ~]# wc
sadklfjkla
asdlkfjl
asdf^[[3~asdlfj
asdf
4 4 40
统计了你输入的字符长度。
很少用,大概了解下
命令<文件
命令<<文件
9.3.4 管道符
--多命令顺序执行
; 命令1;命令2 多个命令无逻辑关系按顺序执行
&& 逻辑与,其他一样——1成功,2才执行
|| 或——1或2只执行一个
[root@andy ~]# ls ; ifconfig
anaconda-ks.cfg cangls hello.sh install.log install.log.syslog japan test2.log test3.log test.log
eth0 Link encap:Ethernet HWaddr 00:0C:29:61:EB:6B
inet addr:192.168.23.50 Bcast:192.168.23.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe61:eb6b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12241 errors:0 dropped:0 overruns:0 frame:0
TX packets:3901 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:884175 (863.4 KiB) TX bytes:489889 (478.4 KiB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1532 (1.4 KiB) TX bytes:1532 (1.4 KiB)
[root@andy ~]# ls && ifconfig
anaconda-ks.cfg cangls hello.sh install.log install.log.syslog japan test2.log test3.log test.log
eth0 Link encap:Ethernet HWaddr 00:0C:29:61:EB:6B
inet addr:192.168.23.50 Bcast:192.168.23.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe61:eb6b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12289 errors:0 dropped:0 overruns:0 frame:0
TX packets:3926 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:887929 (867.1 KiB) TX bytes:493627 (482.0 KiB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1532 (1.4 KiB) TX bytes:1532 (1.4 KiB)
[root@andy ~]# ls || config
anaconda-ks.cfg cangls hello.sh install.log install.log.syslog japan test2.log test3.log test.log
当然,;可以顺序执行很多命令
[root@andy ~]# ls ; ifconfig ; cd ;history
再看第二个
[root@andy ~]# ls && echo "yes"
anaconda-ks.cfg cangls hello.sh install.log install.log.syslog japan test2.log test3.log test.log
yes
适用于具有(简单)逻辑关系的情况,比如LAMP安装
简单的实现判断命令是否正确
[root@andy ~]# ls && echo yes || echo no
anaconda-ks.cfg cangls hello.sh install.log install.log.syslog japan test2.log test3.log test.log
yes
--管道符
|
也是多