大数据linux系统部分命令解析(2)0912

1.查看ip
ifconfig 解释:
ifconfig 常用命令关闭网卡,查看ip。请看帮助!
NAME
ifconfig - configure a network interface

SYNOPSIS
ifconfig [interface]
ifconfig interface [aftype] options | address …
OPTIONS
interface
The name of the interface. This is usually a driver name followed by a unit number, for example eth0 for the first Ethernet
interface.

   up     This flag causes the interface to be activated.  It is implicitly specified if an address is assigned to the interface.

   down   This flag causes the driver for this interface to be shut down.

   [-]arp Enable or disable the use of the ARP protocol on this interface.

   [-]promisc
          Enable or disable the promiscuous mode of the interface.  If selected, all packets on the network  will  be  received  by  the
          interface.

   [-]allmulti
          Enable or disable all-multicast mode.  If selected, all multicast packets on the network will be received by the interface.

   metric N
          This parameter sets the interface metric. It is not available under GNU/Linux.

   mtu N  This parameter sets the Maximum Transfer Unit (MTU) of an interface.

   dstaddr addr
          Set  the remote IP address for a point-to-point link (such as PPP).  This keyword is now obsolete; use the pointopoint keyword
          instead.

   netmask addr
          Set the IP network mask for this interface.  This value defaults to the usual class A, B or C network mask  (as  derived  from
          the interface IP address), but it can be set to any value.

   add addr/prefixlen
          Add an IPv6 address to an interface.

   del addr/prefixlen
          Remove an IPv6 address from an interface.

linux ifconfig : 192.168.137.190

启动关闭指定网卡:

ifconfig eth0 up
ifconfig eth0 down
ifconfig eth0 up为启动网卡eth0,ifconfig eth0 down为关闭网卡eth0。ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。

为网卡配置和删除IPv6地址:

ifconfig eth0 add 33ffe:3240:800:1005::2/64 #为网卡eth0配置IPv6地址
ifconfig eth0 del 33ffe:3240:800:1005::2/64 #为网卡eth0删除IPv6地址
用ifconfig修改MAC地址:

ifconfig eth0 hw ether 00:AA:BB:CC:dd:EE
配置IP地址:

[root@localhost ~]# ifconfig eth0 192.168.2.10
[root@localhost ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0
[root@localhost ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255
启用和关闭arp协议:

ifconfig eth0 arp #开启网卡eth0 的arp协议
ifconfig eth0 -arp #关闭网卡eth0 的arp协议
设置最大传输单元:

ifconfig eth0 mtu 1500 #设置能通过的最大数据包大小为 1500 bytes
【站长推荐】淘宝购物省钱小窍门,有些商品优惠力度高达50%,非常夸张!

ping hadoop000

[root@hadoop000 ~]# hostname -i
192.168.137.190
[root@hadoop000 ~]# 

/etc/hosts文件

hosts 文件相当于本地的DNS。
DNS 又涉及到正向解析 反向解析等等。
192.168.137.190 hadoop000
[root@Data etc]# cat hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@Data etc]#
[root@Data etc]#
[root@Data etc]# cat host.conf
multi on
[root@Data etc]# cat hosts.allow
#

hosts.allow This file contains access rules which are used to

allow or deny connections to network services that

either use the tcp_wrappers library or that have been

started through a tcp_wrappers-enabled xinetd.

#

See ‘man 5 hosts_options’ and ‘man 5 hosts_access’

for information on rule syntax.

See ‘man tcpd’ for information on tcp_wrappers

#

2.如何判断Linux服务是否存活
2.1 进程 ps -ef|grep httpd
2.2 端口号 netstat -nlp|grep 1943

第一步测试网络联通性,通过系统命令抓取相关的数据。检查路由信息!
ping xxx服务所在的机器的ip:
第二步 查看xxx服务的端口号和服务地址
首先定位应用是否有相关进程,
检查服务地址状态是up or down。
第三步 telnet 192.168.137.190 80 这是ping ip加端口号
[root@hadoop000 ~]# yum install telnet
[root@hadoop000 ~]# telnet 192.168.137.190 80
Trying 192.168.137.190…
Connected to 192.168.137.190.
Escape character is ‘^]’. 连成功

3.设置服务开机自启动
[root@hadoop000 ~]# chkconfig –list | grep http
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@hadoop000 ~]# chkconfig httpd on
[root@hadoop000 ~]# chkconfig –list | grep http
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@hadoop000 ~]#

4.查看文件内容
cat
more
less

实时查看
tail -f xxx.log
tail -F xxx.log
-F = -f -retry

[root@hadoop000 ruozedata]# touch jepson.log
[root@hadoop000 ruozedata]#
[root@hadoop000 ruozedata]# ll
total 0
-rw-r–r–. 1 root root 0 Sep 12 21:42 jepson.log
[root@hadoop000 ruozedata]# tail -f jepson.log

[root@hadoop000 ruozedata]# echo “www.ruozedata.com” >> jepson.log
[root@hadoop000 ruozedata]#

这是tab1窗口显示 :www.ruozedata.com

log4j 200M 10份
jepson.log—>200M
mv jepson.log jepson.log1
touch jepson.log

jepson.log1
jepson.log2
jepson.log3

jepson.log10

[root@hadoop000 ruozedata]# mv jepson.log jepson.log1
[root@hadoop000 ruozedata]# touch jepson.log
[root@hadoop000 ruozedata]#
[root@hadoop000 ruozedata]# echo “www.ruozedata.com” >> jepson.log
[root@hadoop000 ruozedata]# echo “www.ruozedata.com” >> jepson.log
[root@hadoop000 ruozedata]# echo “www.ruozedata.com” >> jepson.log
[root@hadoop000 ruozedata]# echo “www.ruozedata.com” >> jepson.log
[root@hadoop000 ruozedata]#

这是tab1窗口显示 无新数据

[root@hadoop000 ruozedata]# tail -F jepson.log
www.ruozedata.com
www.ruozedata.com
www.ruozedata.com
www.ruozedata.com

[root@hadoop000 ruozedata]# mv jepson.log jepson.log2
[root@hadoop000 ruozedata]# touch jepson.log
[root@hadoop000 ruozedata]# echo “ruoze” >> jepson.log

这是tab1窗口显示 有新数据
[root@hadoop000 ruozedata]#

tail: jepson.log' has become inaccessible: No such file or directory
tail:
jepson.log’ has appeared; following end of new file
ruoze

5.如何找命令
[root@hadoop000 ~]#
[root@hadoop000 ~]# cat ruozedata/jepson.log
ruoze
[root@hadoop000 ~]# cat1 ruozedata/jepson.log
-bash: cat1: command not found
[root@hadoop000 ~]#

command not found:
1.输入系统命令
[root@hadoop000 ~]# which cat
/bin/cat
[root@hadoop000 ~]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@hadoop000 ~]# ll /usr/lib64/qt-3.3/bin/cat
ls: cannot access /usr/lib64/qt-3.3/bin/cat: No such file or directory
[root@hadoop000 ~]# ll /usr/local/sbin/cat
ls: cannot access /usr/local/sbin/cat: No such file or directory
[root@hadoop000 ~]# ll /bin/cat
-rwxr-xr-x. 1 root root 48568 Nov 22 2013 /bin/cat

2.安装服务的命令
安装软件的目录/bin

$PATH

6.找文件或文件夹
find / -name ‘abc’ 全文搜索abc匹配的
find ./ -name ‘abc’ 当前目录
find /tmp -name ‘abc’ 指定目录

7.vi

题目: 如何使用vi清空一个文件

echo ” > jepson.log1
cat /dev/null > jepson.log2

坑:
修改生产上面配置文件 和其他同事的文件,一定备份
cp jepson.log1 jepson.log1.20180912
vi jepson.log1

8.上传下载
[root@hadoop000 ~]# yum install lrzsz
上传 win–>linux rz
下载 Linux–》win sz install.log

EditPlus工具

9.文件大小
ll -h
du -sh xxx.log

10.文件夹大小
du -sh xxxd

11.系统情况命令
内存: free -m
硬盘: df -h
负载: top

load average: 0.00, 0.00, 0.00
1min 5min 15min

10

哪些进程 负载高

12.压缩解压
zip -r ruoze.zip ruozedata/*
unzip ruoze.zip

tar -czvf ruoze.tar.gz ruozedata/*
tar -xzvf ruoze.tar.gz

猜你喜欢

转载自blog.csdn.net/u012923827/article/details/82685619