Red hat 5 、6 和 7 常用命令对比

System basics
Task RHEL5 RHEL6 RHEL7
View subscription information /etc/sysconfig/rhn/systemid /etc/sysconfig/rhn/systemid 
subscription-manager identity
subscription-manager identity
Configure subscription rhn_register 
subscription-manager 1
rhn_register 
rhnreg_ks 
subscription-manager
subscription-manager2 
rhn_register 3
View RHEL version information /etc/redhat-release
View system profile sosreport 
dmidecode 
hwbrowser
sosreport 
dmidecode 
lstopo 
lscpu

Basic configuration


Task RHEL5 RHEL6 RHEL7
Graphical configuration tools system-config-* gnome-control-center
Text-based configuration tools system-config-*-tui
Configure printer system-config-printer
Configure network system-config-network nmcli 
nmtui 
nm-connection-editor
Configure system language system-config-language localectl
Configure time and date system-config-date 
date
timedatectl 
date
Synchronize time and date ntpdate 
/etc/ntp.conf
timedatectl 
/etc/chrony.conf 
ntpdate
Configure keyboard system-config-keyboard localectl
Configure SSH /etc/ssh/ssh_config 
/etc/ssh/sshd_config 
~/.ssh/config ssh-keygen

Jobs and services

Task RHEL5 RHEL6 RHEL7
List all services chkconfig --list 
ls /etc/init.d/
systemctl -at service 
ls /etc/systemd/system/*.service 
ls /usr/lib/systemd/system/*.service
List running services service --status-all systemctl -t service --state=active
Start/stop service service name start 
service name stop
systemctl start name.service 
systemctl stop name.service
Enable/disable service chkconfig name on 
chkconfig name off
systemctl enable name.service 
systemctl disable name.service
View service status service name status systemctl status name.service
Check if service is enabled chkconfig name --list systemctl is-enabled name
Create new service file or modify configuration chkconfig --add systemctl daemon-reload 
/etc/systemd/system/*.service
View run level/target runlevel 
who -r
systemctl get-default 
who -r
Change run level/target /etc/inittab 
init run_level
systemctl isolate name.target
systemctl set-default
Configure logging /etc/syslog.conf /etc/rsyslog.conf /etc/rsyslog.conf 
/etc/rsyslog.d/*.conf 
/var/log/journal 
systemd-journald.service
View logs /var/log /var/log 
journalctl
Configure system audit add audit=1 to kernel cmdline 
auditctl 
/etc/audit/auditd.conf 
/etc/audit/audit.rules 
authconfig 
/etc/pam.d/system-auth 
pam_tty_audit kernel module
View audit output aureport /var/log/faillog
Schedule/batch tasks cron 
at 
batch
Find file by name locate
Find file by characteristic find
Create archive tar 
cpio 
zip

Kernel, boot, and hardware

Task RHEL5 RHEL6 RHEL7
Single user/rescue mode append 1 or s or init=/bin/bash to kernel cmdline append rd.break or init=/bin/bash to kernel cmdline
Shut down system shutdown
Power off system poweroff poweroff 
systemctl poweroff
Halt system halt halt 
systemctl halt
Reboot system reboot reboot 
systemctl reboot
Configure default run level/target /etc/inittab systemctl set-default
Configure GRUB bootloader /boot/grub/grub.conf /etc/default/grub 
grub2-mkconfig 
grub-set-default
Configure kernel module modprobe
View hardware configured hwbrowser lshw (in EPEL)
Configure hardware device udev
View kernel parameters sysctl -a 
cat /proc/cmdline
Load kernel module modprobe
Remove kernel module modprobe -r
View kernel version rpm -q kernel 
uname -r

Software management

Task RHEL5 RHEL6 RHEL7
Install software yum install 
yum groupinstall
yum install 
yum group install
View software info yum info 
yum groupinfo
yum info 
yum group info
Update software yum update
Upgrade software yum upgrade
Configure software repository subscription-manager repos 
/etc/yum.repos.d/*.repo
Find package owning file rpm -qf filename 
yum provides filename-glob
View software version rpm -q packagename
View installed software rpm -qa 
yum list installed

User management

Task RHEL5 RHEL6 RHEL7
Graphical user management system-config-users
Create user account useradd
Delete user account userdel
View/change user account details usermod 
/etc/passwd 
vipw 
id
Create user group groupadd
Delete user group groupdel
Change group details groupmod 
/etc/group
Change user password passwd
Change user permissions usermod 
visudo
Change group permissions groupmod 
visudo
Change password policy chage
View user sessions w

File systems, volumes, and disks

Task RHEL5 RHEL6 RHEL7
Default file system ext3 ext4 xfs
Create/modify disk partitions fdisk 
parted
fdisk 
gdisk 
parted 
ssm create
Format disk partition mkfs.filesystem_type (ext4, xfs) 
mkswap
mkfs.filesystem_type (ext4, xfs) 
mkswap 
ssm create
Defragment disk space copy data to new file system 
fsck (look for ‘non-contiguous inodes‘)
copy data to new file system 
fsck (look for ‘non-contiguous inodes‘) 
xfs_fsr
Mount storage mount 
/etc/fstab
mount 
/etc/fstab 
ssm mount
Mount and activate swap /etc/fstab 
swapon -a
Configure static mounts /etc/fstab
View free disk space df
View logical volume info lvdisplay 
lvs 
vgdisplay 
vgs 
pvdisplay 
pvs
Create physical volume pvcreate pvcreate 
ssm create (if backend is lvm)
Create volume group vgcreate vgcreate 
ssm create (if backend is lvm)
Create logical volume lvcreate lvcreate 
ssm create (if backend is lvm)
Enlarge volumes formatted with default file system vgextend 
lvextend 
resize2fs
vgextend 
lvextend 
xfs_growfs 
ssm resize
Shrink volumes formatted with default file system resize2fs 
lvreduce 
vgreduce
XFS cannot currently be shrunk; copy desired data to a smaller file system.
Check/repair file system fsck fsck 
ssm check
View NFS share showmount -e 
mount
Configure NFS share /etc/exports 
service nfs reload
/etc/exports 
systemctl reload nfs.service
Configure on-demand auto-mounts /etc/auto.master.d/*.autofs 
/etc/auto.*
Change file permissions chmod 
chown 
chgrp 
umask (future file creation)
Change file attributes chattr
Change access control list setfacl

Networking

Task RHEL5 RHEL6 RHEL7
Configure name resolution /etc/hosts 
/etc/resolv.conf
/etc/hosts 
/etc/resolv.conf 
nmcli con mod
Configure hostname /etc/sysconfig/network hostnamectl        
/etc/hostname 
nmtui
View network interface info ip addr 
ifconfig 
brctl
ip addr 
nmcli dev show 
teamdctl 
brctl 
bridge
Configure network interface /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/ifcfg-*        
nmcli con [add|mod|edit] 
nmtui 
nm-connection-editor
View routes ip route
Configure routes ip route add 
system-config-network 
/etc/sysconfig/route-iface
ip route add 
nmcli 
nmtui 
nm-connection-editor 
/etc/sysconfig/route-iface
Configure firewall iptables and ip6tables 
/etc/sysconfig/ip*tables
iptables and ip6tables 
/etc/sysconfig/ip*tables 
system-config-firewall
firewall-cmd 
firewall-config
View ports/sockets ss 
lsof 
netstat
ss 
lsof

Security and identity

Task RHEL5 RHEL6 RHEL7
Configure system security /etc/selinux/config 
chcon 
restorecon 
semanage 
setsebool 
system-config-selinux
Report on system security sealert
LDAP, SSSD, Kerberos authconfig 
authconfig-tui 
authconfig-gtk
Network users getent

Resource management

Task RHEL5 RHEL6 RHEL7
Trace system calls strace
Trace library calls ltrace
Change process priority nice 
renice
Change process run location taskset
Kill a process kill 
pkill 
killall
View system usage top 
ps 
sar 
iostat 
netstat 
vmstat 
mpstat 
numastat
top 
ps 
sar 
iostat 
netstat 
ss 
vmstat 
mpstat 
numastat 
tuna
top 
ps 
sar 
iostat 
ss 
vmstat 
mpstat 
numastat 
tuna
View disk usage df df 
iostat
时间: 2024-10-14 13:00:16

Red hat 5 、6 和 7 常用命令对比的相关文章

【Red Hat 】vim编辑器的常用命令以及使用技巧

vim编辑器分为三种模式:命令模式.输入模式.末行模式(插入模式) 下面为大家介绍一些常用的vim编辑器的常见的快捷键已经使用技巧 显示行号和翻页 :set nu  显示行号 :set nonu 取消行号 page up 向上翻页 page down 向下翻页 插入 a 在当前光标后面插入内容 A 在当前行末尾插入内如 i 在当前光标前插入内容 I 在当前行行首插入内容 o 在当前行的下方插入行 O 在当前行的上方插入行 光标跳转 L 将光标跳转到当前屏幕最后一行 H 将光标跳转到当前屏幕第一行

Red Hat Enterprise linux 7与linxu6命令的变化,运行级别,多ip网卡配置,nmtui功能的使用及说明

  注2:常用命令安装:查看anaconda-ks.cfg,确定是否装base软件组 显示部份信息如下: 若没安装base软件组,则一些常规命令如ifconfig等就无法使用.可以使用yumgroupinstall base安装base软件组. 二.rhel7默认运行级别和终端分辨率修改 修改默认运行级别: rhel7.0 做了很多大的改变,打开inittab看下 # inittab is no longer used whenusing systemd. /etc/inittab 这个文件已经

RED HAT LINUX bash 自动补全命令安装

RHEL / CentOS 怎么启用bash命令自动补齐功能呢?请看下面 准备工作:系统镜像,配置好yum源. 1.首先需要安装bash-completion 包: [[email protected] src]# yum install -y bash-completion 2.安装完成后,需要用source 命令或者是注销当前登陆用户重新登陆系统使其立即生效,如下: [[email protected] src]# source /etc/bash_completion 3.此时你就可以使用

windows与linux常用命令对比

原文地址:http://blog.51cto.com/12173069/2121854

Red Hat、Fedora和Ubuntu软件包操作

五.Red Hat.Fedora和Ubuntu软件包操作对比 任务 Red Hat.Fedora Ubuntu 基本信息 软件包后缀 *.rpm *.deb 软件源配置文件 /etc/yum.conf /etc/apt/sources.list 安装.删除.升级软件包 更新软件包列表 每次运行yum时自动执行 apt-get update 从软件仓库软件安装软件 yum install package apt-get install package 安装一个已下载的软件包 yum install

Linux软件包安装2——基于red hat系列的rpm命令安装及apache简单搭建httpserver

rpm命令管理 rpm包是基于red hat系列的二进制安装包.常见的red hat系列的有red hat enterprise Linux.centos.fedora等Linux发行版本 首先介绍一下rpm包的命名方式: httpd-2.2.15-39.el6.centos.i686.rpm   在介绍Linux的rpm命令之前,先说明两个概念: 包全名:类似于上述的完整的命名方式 httpd-2.2.15-39.el6.centos.i686.rpm 包名:httpd   1.rpm安装.升

Linux关闭防火墙命令red hat/CentOs7

一.下面是red hat/CentOs7关闭防火墙的命令! 1:查看防火状态 systemctl status firewalld service  iptables status 2:暂时关闭防火墙 systemctl stop firewalld service  iptables stop 3:永久关闭防火墙 systemctl disable firewalld chkconfig iptables off 4:重启防火墙 systemctl enable firewalld servi

linux 查看文件安装目录命令 locate; whereis ; which ; RPM(Red Hat Package Manager)

locate; whereis ; which 参考:http://blog.csdn.net/tianlesoftware/article/details/5954040 Red Hat Package Manager(简称RPM) 参考:http://www.jb51.net/os/RedHat/1261.html

Configure Red Hat Enterprise Linux shared disk cluster for SQL Server

下面一步一步介绍一下如何在Red Hat Enterprise Linux系统上为SQL Server配置共享磁盘集群(Shared Disk Cluster)及其相关使用(仅供测试学习之用,基础篇) 一.      创建共享磁盘和 Cluster 微软官方配置文档:https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-shared-disk-cluster-red-hat-7-configure. Linux Cluster结构