Linux命令随手记


随手记录常用的Linux命令。


 

tar 解压.   tar   -xzvf

tar 压缩tar   -czvf  

tar -zxvf Python-2.7.5.tgz 
(z是压缩格式,x为解压,v为显示过程,f指定备份文件)

tar -zcvf pdkbug.tar /pdk_bug

-x:解压
-c:压缩
 
-C dir :指定压缩/解压缩的目录dir。注意这里是大写

   将 Python-2.7.5.tgz解压,放到 abcde 这个文件夹内
tar -zxvf Python-2.7.5.tgz  -C abcde
 

 

 

查看所有的python路径  whereis  

查看当前使用的 python 路径  which 

[heliang@VM_0_10_centos ~]$ whereis python
python: /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz

[heliang@VM_0_10_centos ~]$ which python
/usr/bin/python

 

显示软件安装信息  rpm -qi 

[heliang@VM_0_10_centos ~]$ rpm -qi python
Name : python
Version : 2.7.5
Release : 58.el7
Architecture: x86_64
Install Date: Mon 26 Mar 2018 02:57:06 PM CST
Group : Development/Languages
Size : 80827
License : Python

 

检查postfix是否已安装  rpm  -qa

rpm -qa | grep postfix

 

修改完成后运行postifx  

service postfix start

 

检查mail

rpm -qa | grep mail 

 

如果没安装就运行该命令

yum -y install mailx

 

在云主机,给自己的邮箱发邮件

echo "content" | mail -s "title" 1073072541@qq.com

 

添加用户到某个组  usermod -a -G 

usermod -G groupname username (这种会把用户从其他组中去掉,只属于该组)
如:usermod -G git git (git只属于git组)

usermod -a -G groupname username (把用户添加到这个组,之前所属组不影响)
如:usermod -a -G www git (git属于之前git组,也属于www组)

 

将 /usr/local以及该目录下的子文件的 组改为 storm.  chgrp -R 

chgrp -R storm /usr/local

 

给某个用户某个分配某个目录的可读可写权限.  chmod -R g+rwx 

chmod 更多命令,请参考这里(https://www.cnblogs.com/music-liang/p/11871532.html)

chmod -R g+rwx /usr/local

 

arp 命令查看ARP高速缓存:

[root@VM_0_10_centos heliang]# arp -a
? (169.254.128.11) at fe:ee:0b:ca:e5:69 [ether] on eth0
? (169.254.128.5) at fe:ee:0b:ca:e5:69 [ether] on eth0
? (169.254.0.15) at fe:ee:0b:ca:e5:69 [ether] on eth0

 

所有知名应用层协议使用的端口号可以在  /etc/services  文件中找到

cat  /etc/servies

tcpdump抓包

tcpdump -i eth0 -ent

DNS服务器IP

cat  /etc/resolv.conf

 

根据域名查出ip

[heliang@localhost Desktop]$ host -t A  7haogonglu.com
7haogonglu.com has address 118.89.235.163

[heliang@localhost Desktop]$ host -t A www.baidu.com
www.baidu.com is an alias for www.a.shifen.com.
www.a.shifen.com has address 112.80.248.75
www.a.shifen.com has address 112.80.248.76

 

 tcpdump观察 ipv4头部结构

 tcpdump -ntx -i lo

然后,打开另一个终端,输入下面的 telnet命令

 telnet 127.0.0.1

如果你电脑提示,没有telnet命令,请参考这里的文档。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

---------------

posted @ 2019-11-15 20:08  He_LiangLiang  阅读(168)  评论(0编辑  收藏  举报