---
title: "常用的一些Linux命令"
author: "wang5598"
date: "2013-03-27T20:54:45Z"
tags: []
categories: ["非技术"]
slug: "linux"
draft: false
lastmod: "2013-06-20T17:05:42Z"
id: 1837567
url: "https://wang5598.iteye.com/blog/1837567"
---

1、ubuntu下面查找被占用的端口的进程号：fuser -n tcp 80     （n 代表namespace，后面接 tcp 或者 udp）.

2、Centos下面查找被占用的端口号的进程： lsof -i  :8080

3、Centos下面挂载NTFS分区：1、下载rpmforge，地址：[http://pkgs.repoforge.org/rpmforge-release/](http://pkgs.repoforge.org/rpmforge-release/)

直接双击打开rpm包 2、终端输入yum install fuse-ntfs-3g

4、CentOs下面禁用IPV6的方法：

echo -e "install ipv6 /bin/true\\nblacklist ipv6" &gt; /etc/modprobe.d/blacklist-ipv6.conf

service ip6tables stop

chkconfig ip6tables off

reboot

   Ubuntu下面禁用IPV6：

1.修改配置文件blacklist.conf禁用IPV6：  
sudo vi /etc/modprobe.d/blacklist.conf  
2.在文档最后添加 blacklist ipv6，然后查看修改结果：  
cat /etc/modprobe.d/blacklist.conf  
3.设置IP（设置网卡eth0的IP地址和子网掩码）  
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0  
4.设置网关  
sudo route add default gw 192.168.2.254  
5.设置DNS 修改/etc/resolv.conf，在其中加入nameserver DNS的地址1 和 nameserver DNS的地址2 完成。  
6.重启网络服务（若不行，请重启ubuntu：sudo reboot）：  
sudo /etc/init.d/networking restart  
7.查看当前IP：  
ifconfig

5、Centos下安装rar文档管理器：

1、通过wget指令获取相匹配的安装包。wget http://www.rarsoft.com/rar/rarlinux-x64-4.2.0.tar.gz；注意，作者的操作系统为(centos 64位)，各位看官根据自己的实际情况来选择相匹配的安装包，下载列表地址为：http://www.rarsoft.com/download.htm

       2、解压rarlinux

tar-zxvf rarlinux-x64-4.2.0.tar.gz

3、安装rarlinux

cd rar

       make

4、安装完毕之后，就可以使用rar指令来解压rar文件了

rar x filename.rar

如果需要将文件压缩为rar格式的话，则：  
rar filename.rar xxxfile.xxx

 

6、查看磁盘容量：df -h  ，查看某个目录下的使用容量：du -h --depth=3

7、fdisk -l 查看未挂载的磁盘，mount -t ntfs-3g /dev/sdc1 /mnt/wangyq