Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7
https://access.redhat.com/articles/1189123
Common administrative commands in Red Hat Enterprise Linux 5, 6, and 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 |
|
Be aware of potential issues when using subscription-manager on Red Hat Enterprise Linux 5: https://access.redhat.com/solutions/129003. ↩
subscription-manager is used for Satellite 6, Satellite 5.6 with SAM and newer, and Red Hat's CDN. ↩
RHN tools are deprecated on Red Hat Enterprise Linux 7. rhn_register should be used for Satellite server 5.6 and newer only. For details, see: What's the difference between management services provided by Red Hat Network (RHN) Classic and Red Hat Customer Portal Subscription Management/RHSM?, Transition of Red Hat Network Classic Hosted to Red Hat Subscription Management, and Satellite 5.6 unable to register RHEL 7 client system due to rhn-setup package not included in Minimal installation↩
Attachments
Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7的更多相关文章
- Red Hat Enterprise Linux 8正式发布
现在CENTOS 8还没有发布. 了解其主要特点. https://developers.redhat.com/blog/2019/05/07/red-hat-enterprise-linux-8-n ...
- setting up a IPSEC/L2TP vpn on CentOS 6 or Red Hat Enterprise Linux 6 or Scientific Linux
This is a guide on setting up a IPSEC/L2TP vpn on CentOS 6 or Red Hat Enterprise Linux 6 or Scientif ...
- Configure Red Hat Enterprise Linux shared disk cluster for SQL Server——RHEL上的“类”SQL Server Cluster功能
下面一步一步介绍一下如何在Red Hat Enterprise Linux系统上为SQL Server配置共享磁盘集群(Shared Disk Cluster)及其相关使用(仅供测试学习之用,基础篇) ...
- Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux 5, 6 and 7
Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux 5, 6 and 7 Solution Verified ...
- How to use, monitor, and disable transparent hugepages in Red Hat Enterprise Linux 6
Resolution Note: Transparent Huge Pages are not available on the 32-bit version of RHEL 6. Transpare ...
- How to rebuild RPM database on a Red Hat Enterprise Linux system?
本文是笔者最近遇到的一个故障的处理过程,解决方案是Rebuild RPM 的DB,后面内容其实是REDHAT官方的solutions,不过我遇到的现象和解决方案都与官方有点出入,故一直帖出来: 我遇到 ...
- Configure Red Hat Enterprise Linux shared disk cluster for SQL Server
下面一步一步介绍一下如何在Red Hat Enterprise Linux系统上为SQL Server配置共享磁盘集群(Shared Disk Cluster)及其相关使用(仅供测试学习之用,基础篇) ...
- Red Hat Enterprise Linux 6.6安装体验
Red Hat Enterprise Linux 6.6的安装首界面有五个选项,这跟以前的Red Hat Enterprise Linux 5.x的安装界面是有一些区别的. 安装或者升级现有系统( ...
- Red Hat Enterprise Linux 各个版本以及发布日期
Red Hat Enterprise Linux 7 Release/Update General Availability Date redhat-release Errata Date* Kern ...
随机推荐
- css自动适应宽度
.itemContent { background-color:#F0F0F0; padding:3px 11px 11px 11px; text-align:justify; text-justif ...
- Nginx的几个常用配置和技巧
文章列举了几个Nginx常见的,实用的,有趣的配置,希望看过之后能说一句:学到了! 一个站点配置多个域名 server { listen 80; server_name ops-coffee.cn b ...
- Nodejs学习笔记(六)—Node.js + Express 构建网站预备知识
前言 前面经过五篇Node.js的学习,基本可以开始动手构建一个网站应用了,先用这一篇了解一些构建网站的知识! 主要是些基础的东西... 如何去创建路由规则.如何去提交表单并接收表单项的值.如何去给密 ...
- 开源方案搭建可离线的精美矢量切片地图服务-4.Mapbox样式设计
项目成果展示(所有项目文件都在阿里云的共享云虚拟主机上,访问地图可以会有点慢,请多多包涵). 01:中国地图:http://test.sharegis.cn/mapbox/html/3china.ht ...
- 基础拾遗----RabbitMQ
基础拾遗 基础拾遗------特性详解 基础拾遗------webservice详解 基础拾遗------redis详解 基础拾遗------反射详解 基础拾遗------委托详解 基础拾遗----- ...
- OracleServer总结进阶之系统分析(进阶完结)
个人原创,转载请在文章头部明显位置注明出处:https://www.cnblogs.com/sunshine5683/p/10080102.html 在上一篇进阶中大概讲解了一些关于进阶方面的知识,今 ...
- Linux学习8-Linux常用命令(4)
链接命令 命令名称:ln 命令英文原意:link 命令所在路径:/bin/ln 执行权限:所有用户 功能描述:生成链接文件 语法:ln 选项[-s][原文件] [目标文件] 选项: -s 创建 ...
- 关于JS中闭包的问题
一直以来,我都以为我已经懂了JavaScript中闭包的概念,直到有一次小伙伴突然问我这个概念的时候,我才发现我根本不知道该怎来么跟他来讲述这个概念. 那时候我就知道我是自我欺骗,打肿脸充胖子了. 所 ...
- CSS 媒体查询创建响应式网站
使用 CSS 媒体查询创建响应式网站 适用于所有屏幕大小的设计 固定宽度的静态网站很快被灵活的响应式设计所取代,该设计可以根据屏幕大小进行上扩和下扩.利用响应式设计,无论您采用什么设备或屏幕来访问网 ...
- navicat 批量插入 测试数据
1. 前言 遇到线上大sql执行较慢, 10s+, 做优化改进时,首先想到的是在本地造出一个类似的库环境,先本地实验. 然后往表中创建大量数据... 2. 方案 利用mysql函数来插入大量数据 代码 ...