---
title: "RHEL常用命令"
author: "iffiffj"
date: "2012-01-09T11:19:51Z"
tags: []
categories: ["操作系统"]
slug: "rhel"
draft: false
lastmod: "2012-01-09T11:34:26Z"
id: 1338516
url: "https://iffiffj.iteye.com/blog/1338516"
---

系统重要目录和文件：

```java

网络配置：/etc/sysconfig/network-scripts/
SELinux：/etc/sysconfig/selinux
HostName：/etc/sysconfig/network
服务脚本：/etc/init.d/
系统默认启动界面：/etc/inittab
系统调度：/etc/crontab
CPU信息：/proc/cpuinfo
内存信息：/proc/meminfo
系统版本：/etc/system-release

```

查看进程打开的文件数：

```java
lsof -p pid|wc -l
```

修改最大打开文件数(too many open files)：

```java

ulimit -u 查看open files设置
ulimit -a 查看所有设置
ulimit -u 65535(新的open files 值)修改设置
ulimit -n 65536 设置用户可以同时打开的最大文件数（max open files

```

查看修改网卡工作模式（全双工/半双工）：

```java

ethtool eth0

```

SELinux的开启和关闭：

```java

getenforce
setenforce [ enforcing | permissive | 1 | 0 ]

```

设置系统语言：

```java
export LANG=en_US.UTF-8
```

系统自启动服务：

```java

chkconfig [--list] [--type <type>] [name]
chkconfig --add <name>
chkconfig --del <name>
chkconfig --override <name>
chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>

```

启动系统服务：

```java

service < option > | --status-all | [ service_name [ command | --full-restart ] ]
service servicename start | stop | restart | status

```