Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7

来源:互联网 发布:网络十大禁书百度云 编辑:程序博客网 时间:2024/05/16 08:40

官网转载:https://access.redhat.com/articles/1189123

Updated September 25 2015 at 2:31 PM -English

Lists common administrative commands for Red Hat Enterprise Linux 5, 6 and 7. Printable poster also available.

System basics

TaskRHEL5RHEL6RHEL7View subscription information/etc/sysconfig/rhn/systemid/etc/sysconfig/rhn/systemid
subscription-manager identitysubscription-manager identityConfigure subscriptionrhn_register
subscription-manager 1rhn_register
rhnreg_ks
subscription-managersubscription-manager2
rhn_register 3View RHEL version information/etc/redhat-releaseView system profilesosreport
dmidecode
hwbrowsersosreport
dmidecode
lstopo
lscpu

Basic configuration

TaskRHEL5RHEL6RHEL7Graphical configuration toolssystem-config-*gnome-control-centerText-based configuration toolssystem-config-*-tui Configure printersystem-config-printerConfigure networksystem-config-networknmcli
nmtui
nm-connection-editorConfigure system languagesystem-config-languagelocalectlConfigure time and datesystem-config-date
datetimedatectl
dateSynchronize time and datentpdate
/etc/ntp.conftimedatectl
/etc/chrony.conf
ntpdateConfigure keyboardsystem-config-keyboardlocalectlConfigure SSH/etc/ssh/ssh_config
/etc/ssh/sshd_config
~/.ssh/config ssh-keygen

Jobs and services

TaskRHEL5RHEL6RHEL7List all serviceschkconfig --list
ls /etc/init.d/systemctl -at service
ls /etc/systemd/system/*.service
ls /usr/lib/systemd/system/*.serviceList running servicesservice --status-allsystemctl -t service --state=activeStart/stop serviceservice name start
service name stopsystemctl start name.service
systemctl stop name.serviceEnable/disable servicechkconfig name on
chkconfig name offsystemctl enable name.service
systemctl disable name.serviceView service statusservice name statussystemctl status name.serviceCheck if service is enabledchkconfig name --listsystemctl is-enabled nameCreate new service file or modify configurationchkconfig --addsystemctl daemon-reload
/etc/systemd/system/*.serviceView run level/targetrunlevel
who -rsystemctl get-default
who -rChange run level/target/etc/inittab
init run_levelsystemctl isolate name.target
systemctl set-defaultConfigure logging/etc/syslog.conf/etc/rsyslog.conf/etc/rsyslog.conf
/etc/rsyslog.d/*.conf
/var/log/journal
systemd-journald.serviceView logs/var/log/var/log
journalctlConfigure system auditadd audit=1 to kernel cmdline
auditctl
/etc/audit/auditd.conf
/etc/audit/audit.rules
authconfig
/etc/pam.d/system-auth
pam_tty_audit kernel moduleView audit outputaureport /var/log/faillogSchedule/batch taskscron
at
batchFind file by namelocateFind file by characteristicfindCreate archivetar
cpio
zip

Kernel, boot, and hardware

TaskRHEL5RHEL6RHEL7Single user/rescue modeappend 1 or s or init=/bin/bash to kernel cmdlineappend rd.break or init=/bin/bash to kernel cmdlineShut down systemshutdownPower off systempoweroffpoweroff
systemctl poweroffHalt systemhalthalt
systemctl haltReboot systemrebootreboot
systemctl rebootConfigure default run level/target/etc/inittabsystemctl set-defaultConfigure GRUB bootloader/boot/grub/grub.conf/etc/default/grub
grub2-mkconfig
grub-set-defaultConfigure kernel modulemodprobeView hardware configuredhwbrowserlshw (in EPEL)Configure hardware deviceudevView kernel parameterssysctl -a
cat /proc/cmdlineLoad kernel modulemodprobeRemove kernel modulemodprobe -rView kernel versionrpm -q kernel
uname -r

Software management

TaskRHEL5RHEL6RHEL7Install softwareyum install
yum groupinstallyum install
yum group installView software infoyum info
yum groupinfoyum info
yum group infoUpdate softwareyum updateUpgrade softwareyum upgradeConfigure software repositorysubscription-manager repos
/etc/yum.repos.d/*.repoFind package owning filerpm -qf filename
yum provides filename-globView software versionrpm -q packagenameView installed softwarerpm -qa
yum list installed

User management

TaskRHEL5RHEL6RHEL7Graphical user managementsystem-config-usersCreate user accountuseraddDelete user accountuserdelView/change user account detailsusermod
/etc/passwd
vipw
idCreate user groupgroupaddDelete user groupgroupdelChange group detailsgroupmod
/etc/groupChange user passwordpasswdChange user permissionsusermod
visudoChange group permissionsgroupmod
visudoChange password policychageView user sessionsw

File systems, volumes, and disks

TaskRHEL5RHEL6RHEL7Default file systemext3ext4xfsCreate/modify disk partitionsfdisk
partedfdisk
gdisk
parted
ssm createFormat disk partitionmkfs.filesystem_type (ext4, xfs)
mkswapmkfs.filesystem_type (ext4, xfs)
mkswap
ssm createDefragment disk spacecopy data to new file system
fsck (look for 'non-contiguous inodes')copy data to new file system
fsck (look for 'non-contiguous inodes')
xfs_fsrMount storagemount
/etc/fstabmount
/etc/fstab
ssm mountMount and activate swap/etc/fstab
swapon -aConfigure static mounts/etc/fstabView free disk spacedfView logical volume infolvdisplay
lvs
vgdisplay
vgs
pvdisplay
pvsCreate physical volumepvcreatepvcreate
ssm create (if backend is lvm)Create volume groupvgcreatevgcreate
ssm create (if backend is lvm)Create logical volumelvcreatelvcreate
ssm create (if backend is lvm)Enlarge volumes formatted with default file systemvgextend
lvextend
resize2fsvgextend
lvextend
xfs_growfs
ssm resizeShrink volumes formatted with default file systemresize2fs
lvreduce
vgreduceXFS cannot currently be shrunk; copy desired data to a smaller file system.Check/repair file systemfsckfsck
ssm checkView NFS shareshowmount -e
mountConfigure NFS share/etc/exports
service nfs reload/etc/exports
systemctl reload nfs.serviceConfigure on-demand auto-mounts/etc/auto.master.d/*.autofs
/etc/auto.*Change file permissionschmod
chown
chgrp
umask (future file creation)Change file attributeschattrChange access control listsetfacl

Networking

TaskRHEL5RHEL6RHEL7Configure name resolution/etc/hosts
/etc/resolv.conf/etc/hosts
/etc/resolv.conf
nmcli con modConfigure hostname/etc/sysconfig/networkhostnamectl
/etc/hostname
nmtuiView network interface infoip addr
ifconfig
brctlip addr
nmcli dev show
teamdctl
brctl
bridgeConfigure network interface/etc/sysconfig/network-scripts/ifcfg-*/etc/sysconfig/network-scripts/ifcfg-*
nmcli con [add|mod|edit]
nmtui
nm-connection-editorView routesip routeConfigure routesip route add
system-config-network
/etc/sysconfig/route-ifaceip route add
nmcli
nmtui
nm-connection-editor
/etc/sysconfig/route-ifaceConfigure firewalliptables and ip6tables
/etc/sysconfig/ip*tablesiptables and ip6tables
/etc/sysconfig/ip*tables
system-config-firewallfirewall-cmd
firewall-configView ports/socketsss
lsof
netstatss
lsof

Security and identity

TaskRHEL5RHEL6RHEL7Configure system security/etc/selinux/config
chcon
restorecon
semanage
setsebool
system-config-selinuxReport on system securitysealertLDAP, SSSD, Kerberosauthconfig
authconfig-tui
authconfig-gtkNetwork usersgetent

Resource management

TaskRHEL5RHEL6RHEL7Trace system callsstraceTrace library callsltraceChange process prioritynice
reniceChange process run locationtasksetKill a processkill
pkill
killallView system usagetop
ps
sar
iostat
netstat
vmstat
mpstat
numastattop
ps
sar
iostat
netstat
ss
vmstat
mpstat
numastat
tunatop
ps
sar
iostat
ss
vmstat
mpstat
numastat
tunaView disk usagedfdf
iostat
  1. Be aware of potential issues when using subscription-manager on Red Hat Enterprise Linux 5:https://access.redhat.com/solutions/129003.↩

  2. subscription-manager is used for Satellite 6, Satellite 5.6 with SAM and newer, and Red Hat's CDN.↩

  3. 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, andSatellite 5.6 unable to register RHEL 7 client system due to rhn-setup package not included in Minimal installation↩


0 0