网络配置与文件

1、配置网络环境

桥接模式,IP为200+学号 172.16.191.200+学号
---------------------------------------------------------
[root@root ~]# # 1、先网卡的配置文件. /etc/sysconfig/network-scripts/ifcfg-网卡名
[root@root ~]# # 2、改配置
[root@root ~]# # 3、重启网卡、或者网络服务 service network start|restart|stop

------------------------------------------------------------------------
[root@root ~]# cd /etc/sysconfig/network-scripts/
[root@root network-scripts]# vi ifcfg-eth0
[root@root network-scripts]# cat ifcfg-eth0

 

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.16.191.246
NETMASK=255.255.255.0
GATEWAY=172.16.191.1
[root@root network-scripts]# service network restart
正在关闭接口 eth0: [确定]
关闭环回接口: [确定]
弹出环回接口: [确定]
弹出界面 eth0: [确定]

--------------------------------------------------------------------
1、查看网卡的配置信息
ifconfig //只能查看当前启动的网卡的信息,启动or激活
ifconfig -a //查看所有的网卡的信息

ifconfig eth0 //只查看网卡eth0的信息

 

2、linux是区分大小写、无论是配置文件、还是命令

[root@root ~]# IFCONFIG
-bash: IFCONFIG: command not found

-----------------------------------------------------
vi 的时候

vi找一个文件,首先查看模式
按i进入编辑,可以进行内容的修改
i //编辑模式

按ESC退出编辑模式

再按:进入命令模式模式
:w //写入,也可以理解保存,但是不会退出,依然回到查看模式
:q //退出,但不保存
:wq //写入了之后再退出
:q! //强制退出,不保存
:wq! //强制保存退出
------------------------------------------------------------------------------------------------------------
撤销-----按ESC,先退出到查看模式,按u,按一次撤销一次的操作

-------------------------------------------------------------------------------------------------------------
查看文件的内容:
cat 文件名 //以cat是concatenate的缩写,连接、拼接
------------------------------------------------------------
cat - concatenate files and print on the standard output
concatenate
英[k?n'k?t?ne?t]
美[kɑn?k?t(?)?ne?t]
vt. 把 (一系列事件、事情等)联系起来;
adj. 连接的,联系在一起的;
[网络] 连接; 连锁; 串联;

------------------------------------------------------------------
创建文件的方法
1、vi是一种方式,但是保存之后才有文件
2、touch 文件名 //只能够创建文件,不能向文件里写入内容
3、rm 文件 //删除文件的命令
4、文件名的更改 //使用 mv 原文件名 新文件名
文件位置的移动 mv 文件1 文件2 目录的名字

5、创建目录 //mkdir 目录的名字、

6、在shell里*能代表1个或者多个字符 *.txt 代表 一个或者多个字符并且以.txt
rm -f *.txt //删除所有.txt结尾

7、linux里的隐藏文件,指文件名前面有一个点. .12345.txt
查看所有文件 ls -la //可以看到隐藏文件

rm -f * //删除所有的文件,但不包括隐藏文件
rm -f .* //删除当目录的所有隐藏文件



[root@root ~]# mv 1.txt aa01/
[root@root ~]# mv 2.txt aa01/
[root@root ~]# mv 3.txt 4.txt aa01/
[root@root aa01]# ls -la
总计 32
drwxr-xr-x 2 root root 4096 12-10 03:30 .
drwxr-x--- 3 root root 4096 12-10 03:30 ..
-rw-r--r-- 1 root root 0 12-10 03:27 1.txt
-rw-r--r-- 1 root root 0 12-10 03:27 2.txt
-rw-r--r-- 1 root root 0 12-10 03:30 3.txt
-rw-r--r-- 1 root root 0 12-10 03:30 4.txt

[root@root aa01]# ls
1.doc 1.exe 1.pdf 1.txt 23.doc 2.doc 2.exe 2.pdf 2.txt 3.txt 4.txt a.jgp b.jgp
[root@root aa01]# ls *.txt
1.txt 2.txt 3.txt 4.txt

 


[root@root ~]# cat 1.txt
这是1.txt,使用vi命令创建的!!!
[root@root ~]# cat 2.txt
这是2.txt 使用touch命令创建的!!
[root@root ~]#
[root@root ~]#
[root@root ~]# cat 1.txt 2.txt
这是1.txt,使用vi命令创建的!!!
这是2.txt 使用touch命令创建的!!
[root@root ~]#

[root@root ~]#
[root@root ~]# cat 2.txt 1.txt
这是2.txt 使用touch命令创建的!!
这是1.txt,使用vi命令创建的!!!
[root@root ~]#
------------------------------------------------------------------------------
[root@root ~]# rm 1.txt
rm:是否删除 一般文件 “1.txt”? y
[root@root ~]# rm -f 2.txt

posted @ 2016-10-11 16:44  大鱼青花  阅读(194)  评论(0编辑  收藏  举报