RHEL7 Basic Operations (view IP configuration, turn off the firewall, temporarily or permanently shut down selinux, common command Operations)

Source: Internet
Author: User
Tags symlink

* rhel7的基本操作*

1. View IP Configuration
[Email protected] ~]# LS/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP0S25
/etc/sysconfig/network-scripts/ifcfg-enp0s25
View DNS Configuration
[Email protected] ~]# cat/etc/resolv.conf

Generated by NetworkManager

NameServer 114.114.114.114
viewing IP and Host binding information
[Email protected] ~]# cat/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
View Host Name
[Email protected] ~]# Cat/etc/hostname
admin203

2, turn off the firewall, set the boot not to start
View status
[[email protected] ~]# systemctl status Firewalld.service
firewalld.service-firewalld-dynamic Firewall daemon
loaded:loaded (/usr/lib/systemd/system/firewalld.service; Enabled Vendor preset:enabled)
Active:active (running) since Tue 2018-09-11 09:47:40 CST; 1 day 5h ago
Main pid:698 (fire WALLD)
CGroup:/system.slice/firewalld.service
└─698/usr/bin/python-es/usr/sbin/firewalld--nofork--nopid

Sep 09:47:40 admin203 systemd[1]: Starting firewalld-dynamic Firewall daemon ...
Sep 09:47:40 admin203 systemd[1]: Started firewalld-dynamic firewall daemon.
Turn off firewall
[[email protected] ~]# systemctl stop firewalld
Turn on firewall
[[email protected] ~]# Systemctl Start FIREWALLD
Boot firewall automatically
[[email protected] ~]# systemctl enable FIREWALLD
Turn off firewall automatically
[email  protected] ~]# systemctl disable FIREWALLD
removed symlink/etc/systemd/system/ Dbus-org.fedoraproject.firewalld1.service.
removed symlink/etc/systemd/system/basic.target.wants/firewalld.service.

3. Temporarily and permanently close SELinux
View SELinux Run Status
[Email protected] ~]# Getenforce
Enforcing
Temporarily turn off SELinux and view the running status
[Email protected] ~]# Setenforce 0
[Email protected] ~]# Getenforce
Permissive
Temporarily turn on SELinux and view the running status
[Email protected] ~]# Setenforce 1
[Email protected] ~]# Getenforce
Enforcing
Permanently close selinux, change enforcing to disabled, save reboot
[Email protected] ~]# Vim/etc/selinux/config

This file controls the state of the SELinux on the system. Selinux= can take one of the these three Values:enforcing-selinux security policy is enforced.permissive-selinux prints WA Rnings instead of Enforcing.disabled-no SELinux policy is loaded.

Selinux=disabled

Selinuxtype= can take one of three, values:targeted-targeted processes is protected,minimum-modification of target Ed Policy. Only selected processes is Protected.mls-multi level Security protection.

selinuxtype=targeted

4. Basic command operation
To view the currently owned virtual terminal with TTY
[[email protected] ~]# TTY
/dev/pts/0
Distinguish internal and external commands with type, syntax: Type the command to detect
[[Email protected] ~]# type cat
Cat is hashed (/USR/BIN/CAT)
[[Email protected] ~]# type pwd
PWD is a shell builtin
View all shell types
[Email protected] ~]# Cat/etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
Take a look at the last character of each line of/etc/passwd
[Email protected] ~]# head-1/etc/passwd
Root:x:0:0:root:/root:/bin/bash
See which files are in the current directory
[[email protected] ~]# ls
Anaconda-ks.cfg Mima
[Email protected] ~]# LS/ETC/PASSWD
/etc/passwd
View file details such as creation time, creator, file read and Write permissions
[Email protected] ~]# ls-l/etc/passwd
-rw-r--r--. 1 root root 1118 Sep 22:24/etc/passwd
Summary of shortcut keys under Linux
Clear screen: ctrl+l
Exit: Ctrl+d
Search History Command: Ctr+r

View hardware Time
[[email protected] ~]# hwclock
Wed Sep 2018 04:20:15 PM CST-0.875517 seconds
View system time
[[EMA Il protected] ~]# date
Wed Sep 16:20:44 CST 2018
Modification Time
[[email protected] ~]# date-s "2018-9-12 15:2 "
Wed Sep 15:22:30 CST 2018
View full Date
[[email protected] ~]# date" +%f "
2018-09-12
View year last two digits
[[email protected] ~]# date "+%y"

View seconds/minute
[[email protected] ~]# date "+%m"
+
[email  protected] ~]# Date "+%h"

[[email protected] ~]# date "+%s"
Wuyi
View Month Day
[[email  Protected] ~]# Date "+%y-%m-%d"
2018-09-12
Use time to measure when a command is run
[[email protected] ~]# temporal ls
Anaconda-ks.cfg Mima

Real 0m0.002s
User 0m0.001s
SYS 0m0.001s
Help command man, view manual page or command description
Syntax: Man command
[[email protected] ~]# man CP
View the current default RunLevel
[Email protected] ~]# Systemctl Get-default
Multi-user.target
Set default to third boot level
[Email protected] ~]# Systemctl set-default multi-user.target
Removed Symlink/etc/systemd/system/default.target.
Created symlink from/etc/systemd/system/default.target To/usr/lib/systemd/system/multi-user.target.
Set default to fifth start level
[Email protected] ~]# Systemctl set-default graphical.target
Removed Symlink/etc/systemd/system/default.target.
Created symlink from/etc/systemd/system/default.target To/usr/lib/systemd/system/graphical.target.

RHEL7 Basic Operations (view IP configuration, turn off the firewall, temporarily or permanently shut down selinux, common command Operations)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.