RHEL5/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 |
|
内容以整理好,所以没有对原作者的东西进行调整
转自:https://blog.csdn.net/lizy0327/article/details/82290454
RHEL5/6/7中常用命令及命令之间的差异的更多相关文章
- 工作中常用的Linux命令:mkdir命令
本文链接:http://www.cnblogs.com/MartinChentf/p/6076075.html (转载请注明出处) 在Linux系统中,mkdir命令用来创建一个目录或一个级联目录. ...
- 工作中常用的Linux命令:crontab命令
本文链接:http://www.cnblogs.com/MartinChentf/p/6060252.html (转载请注明出处) crontab是一个用来设置.删除或显示供守护进程cron执行的定时 ...
- 工作中常用的Linux命令:ipcs/ipcrm命令
本文链接:http://www.cnblogs.com/MartinChentf/p/6057100.html (转载请注明出处) ipcs 1. 命令格式 ipcs [resource-option ...
- 工作中常用的Linux命令:find命令
本文链接:http://www.cnblogs.com/MartinChentf/p/6056571.html (转载请注明出处) 1.命令格式 find [-H] [-L] [-P] [-D deb ...
- 开发过程中常用的Linux命令
做Java开发好几年了,部署JavaWeb到服务器上,一般都选择Linux,Linux作为服务器真是不二之选,高性能,只要熟悉Linux,操作快捷,效率很高. 总结一下工作中常用的Linux命令备忘: ...
- Tcl与Design Compiler (十三)——Design Compliler中常用到的命令(示例)总结
本文如果有错,欢迎留言更正:此外,转载请标明出处 http://www.cnblogs.com/IClearner/ ,作者:IC_learner 本文将描述在Design Compliler中常用 ...
- 安卓日常开发和逆向中常用的shell命令与非shell命令
简述shell 命令与 非shell命令区别 shell命令不用先adb shell进入界面执行 非shell命令必须要 adb shell进入界面执行 基础非shell命令 1.安装app adb ...
- 工作中常用的 Linux 命令
awk 示例: env变量值如下,需要获得pkg_url的链接值: {"name": "michael", "sex": "mal ...
- Windows学习总结(10)——Windows系统中常用的CMD命令详解
1.ping命令 ping是电脑网络故障诊断中的常用的命令,它的作用是用来检查网络是否通畅或者网络连接速度.我们来看一下PING命令的具体表述. 日常的诊断过程中我们最常用到的就是诊断连接是否通畅. ...
- Linux 中常用的基础命令一
1.目录相关命令的使用 pwd(printing working directory) 显示当前工作目录 pwd命令相关的环境变量: PWD 保存了当前工作目录路径 OLDP ...
随机推荐
- freemarker在web应用项目的使用
FreeMarker是一个用Java语言编写的模板引擎,它基于模板来生成文本输出.FreeMarker与Web容器无关,即在Web运行时,它并不知道Servlet或HTTP.它不仅可以用作表现层的实现 ...
- 【代码健壮性】善用data-属性来关联,慎用parent()之类的查找结构
$(".minus,target").unbind().click(function(){ console.log(this); var $thisParent = $(this) ...
- C—变量
C—变量 在C语言中,变量要先定义后使用. 使用时,必须说明变量的存储类型与数据类型. 变量说明的一般形式: <存储类型> <数据类型> <变量名> 存储类型的 ...
- JavaScript 中 reduce去重方法
过去有很长一段时间,我一直很难理解 reduce() 这个方法的具体用法,平时也很少用到它.事实上,如果你能真正了解它的话,其实在很多地方我们都可以用得上,那么今天我们就来简单聊聊 JS 中 redu ...
- 为何在新建STM工程中全局声明两个宏
在uVision中新建STM32工程后,需要从STM32标准库中拷贝标准外设驱动到自己的工程目录中,此时需要在工程设置->C/C++选项卡下的Define文本框中键入这两个全局宏定义. STM3 ...
- MySQL不支持事务处理的解决方法
MySQL数据库默认的存储引擎类型是MyISAM,这种存储引擎类型不支持事务处理. 在MySQL中,只有InnoDB存储引擎类型的数据表才能支持事务处理. 因此,如果想让MySQL支持事务处理,只要将 ...
- Python文件路径操作
print(os.environ.get('HOME')) # 打印`HOME`这个环境变量 /Users/<> file_path = os.environ.get('HOME') + ...
- CentOS 7.2 安装MySQL 5.7
CentOS 7之后的版本yum的默认源中使用MariaDB替代原先MySQL,因此安装方式较为以往有一些改变: 下载mysql的源 wget http://dev.mysql.com/get/mys ...
- 深入浅出 Vue.js 第九章 解析器---学习笔记
本文结合 Vue 源码进行学习 学习时,根据 github 上 Vue 项目的 package.json 文件,可知版本为 2.6.10 解析器 一.解析器的作用 解析器的作用就是将模版解析成 AST ...
- Android中ViewPgae中的Fragment如何确认当前页面可见的问题
由于在ViewPage中PageAdapter来管理所有的Fragment.在加载一个Fragment的时候,会自动缓存左右几个(默认是一个)页面,此时也会调用到正常的生命周期函数,onCreate, ...