linux 操作基础
内嵌指令 & 外部指令:
[root@MASTER ~]# type cd
cd 是 shell 内嵌
[root@MASTER ~]# type mkdir
mkdir 是 /usr/bin/mkdir
[root@MASTER ~]#
linux shell
[root@MASTER ~]# cat /etc/shells //系统支持的shell /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/nologin /bin/tcsh /bin/csh [root@MASTER ~]# echo $SHELL //系统默认shell /bin/bash
[root@MASTER ~]# sh //进入sh shell
sh-4.2#
sh-4.2# exit
exit
[root@MASTER ~]# tcsh
[root@MASTER ~]# exit
[root@MASTER ~]# date +%Y/%m/%d_%H-%M-%S //按格式显示时间 2015/12/22_11-53-20 [root@MASTER ~]# file aaa.txt //显示文件属性 aaa.txt: ASCII text [root@MASTER ~]# head -3 /etc/passwd //显示开头3行 root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin [root@MASTER ~]# tail -3 /etc/passwd //显示末尾3行 ROOT-test apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin named:x:25:25:Named:/var/named:/sbin/nologin [root@MASTER ~]# wc -l /etc/passwd //查看文件 行 41 /etc/passwd [root@MASTER ~]# wc -w /etc/passwd //查看文件 单词 69 /etc/passwd [root@MASTER ~]# wc -c /etc/passwd //查看文件 字符 2013 /etc/passwd [root@MASTER ~]# wc /etc/passwd //查看文件 行、word、字符 41 69 2013 /etc/passwd [root@MASTER ~]# 568 date +%Y/%m/%d_%H-%M-%S 569 history [root@MASTER ~]# !568 //执行历史目录 date +%Y/%m/%d_%H-%M-%S 2015/12/22_12-00-57 [root@MASTER ~]# //ctrl+r 查找历史命令 (reverse-i-search)`dig': dig @192.168.1.160 3gnet.1864710.mnc001.mcc460.gprs