2017-7-18-Daily blog-about Linux basic commands CnetOS7 system Basic Operations command. doc

Source: Internet
Author: User

1.root/ cat anaconda-ks.cfg determines if the Base software Group

Yum Groupinstall Base Install Base Group Ifconfig command can be used or use IP addr sh to view IP information

Yum usage instructions need to create xxx.repo for the Yum installation system that does not have its own. Then install the Base Group

2. command line : Use the shell to interpret the input string to run the program
Type
Sudo
Which, Whereis, Whatis, man, info
Use tab auto-up Arrows query history
CTRL + C, CTRL + Z

3. There is no killall command in the command to resolve Yum Install Psmisc

The PSMISC package contains three programs to help manage the/proc directory

Install the following programs : Fuser, Killall,pstree and pstree.x11 (link to Pstree)

Fuser displays the PID of the process using the specified file or file system.

Killall a process that kills a name it signals to all processes that run the specified command.

The Pstree tree displays the currently running processes.

Pstree.x11 and Pstree function the same only need to confirm before exiting.

4. View system hardware information

UNAME-A # Linux System Information command to view kernel/Os/cpu information
Head-n 1/etc/issue # View OS version is number 1 not letter L
Cat/proc/cpuinfo # Linux System Information command to view CPU information
Hostname # View Linux System Information command for computer name
LSPCI-TV # List all PCI devices
LSUSB-TV # lists Linux System Information commands for all USB devices
Lsmod # List of loaded kernel modules
ENV # View environment variable resources
Free-m # View memory usage and swap area usage
Df-h # Viewing the usage of each partition
Du-sh # Viewing the size of a specified directory
grep memtotal/proc/meminfo # View Total Memory
grep Memfree/proc/meminfo # Viewing the amount of free memory
Uptime # View System uptime, number of users, load
CAT/PROC/LOADAVG # Viewing system load disks and partitions
Mount | COLUMN-T # Viewing the status of a mounted partition
Fdisk-l # View all partitions
Swapon-s # View all swap partitions
Hdparm-i/dev/hda # View disk parameters (for IDE devices only)
DMESG | grep IDE # View IDE device detection network at startup
Ifconfig # View the properties of all network interfaces
Iptables-l # View firewall settings
Route-n # Viewing the routing table
NETSTAT-LNTP # View All listening ports
NETSTAT-ANTP # View all established connections
Netstat-s # Viewing the network statistics process
PS-EF # View All Processes
Top # Real-time display of process status users
W # View Active Users
ID # view specified user information
Last # View user log in log
cut-d:-f1/etc/passwd # View All users of the system
cut-d:-f1/etc/group # View all system groups
Crontab-l # View the current user's scheduled tasks service
Chkconfig–list # List all system services
Chkconfig–list | grep on # Lists all started system services programs
RPM-QA # View all installed Packages
Cat/proc/cpuinfo # Linux system commands for viewing CPU-related parameters
Cat/proc/partitions # View System Information commands for Linux hard disk and partition information
Cat/proc/meminfo # Linux system commands to view Linux system memory information
Cat/proc/version # View version similar to Uname-r
Cat/proc/ioports # viewing device IO ports
Cat/proc/interrupts # Viewing interrupts
CAT/PROC/PCI # Viewing information for PCI devices
Cat/proc/swaps # View information for all swap partitions

Systemctl Status Network///////

View service port number netstat-anp|grep SSH

View Ipip addr

view selinux status Sestatus selinux status:disabled

Restart the Nic systemctl restart Network.servic

See firewall settings
Old instructions
Iptables-l View firewall settings
Service iptables Stop shutting down the firewall
Service iptables Start/restart turn on or restart
New directives

Systemctl Status Firewalld.service

Check if the service is running PS aux | grep Gmond

View the version of the system such as 6.4
Cat/etc/issue

Cat/etc/redhat-releaserpm-qa | grep centos-release

Cat/etc/system-release
View device IO port NETSTAT-TUPLN

through IP View mac $ arp 192.168.56.11

Route View Route

Disk View

Df-h
Fdisk-l

Du-sh
Ls-lish

Du-sk * | Sort-n//Small to large look at the space usage under the current directory

Df-hl

The DF command is a disk partition for viewing the file system can add parameters to view the disk's remaining space information
Check to see if there are failed services systemctl–failed

Time Synchronous Ntpdate ntp.fudan.edu.cn
new Folder mkdir file name

Nmtui Network Management

Systemctl enable XXXXX To add the services you have written to boot.

Systemctl Stop Firewall.service

Systemctl is-enabled Iptables.service
Systemctl is-enabled Servicename.service #查询服务是否开机启动
Systemctl Enable *.service #开机运行服务
Systemctl Disable *.service #取消开机运行
Systemctl Start *.service #启动服务
Systemctl Stop *.service #停止服务
Systemctl Restart *.service #重启服务
Systemctl Reload *.service #重新加载服务配置文件
Systemctl Status *.service #查询服务运行状态
Systemctl–failed #显示启动失败的服务

Alias Syntax alias[alias]=[directive name]
Add an alias that users can take advantage of the alias custom directive.

5, CENTOS7 system daily simple Operation command

Add or remove a disk partition
Add disk

Fdisk-l View the disk condition

Fdisk/dev/sdb for/DEV/SDB device partition---N add partition P/E primary partition/Logical partition W Save exit

Mkdir/data Creating a Mount Directory

MKFS.EXT3/DEV/SDB format disk as ext3 file system

FDISK-L Check the disk condition again

Mount/dev/sdb/data mount the disk to the created Mount directory

vi/etc/fstab– Modify Start Auto mount item/dev/sdb/data ext3 defaults 0 0

in the The prerequisite for the CentOS system to mount a USB stick
  1. Log in as root user
use fdisk-l to see the device of U disk
if USB Stick is sda1
  2, determine in the directory/mnt set up a folder/usb, if not established can type the command Mkdir/mnt/usb_disk, successful after the next step.
  3. To load the U disk, type the following command Mount/dev/sda1/mnt/usb_disk
after success, you can use the U-disk, the file is under the directory/MNT/USB.
  4, unloading U-disk after the use of the U-disk before pulling out before you need to type the uninstall U disk command
The command is as follows Umount/mnt/usb

two Centos7 the various issues that occur when running a Process execution command

1.YUM error yum install yum loaded plugin Fastestmirror

Syntaxerror:invalid syntax causes the problem after installing the new Python.
Solutions

Vi/usr/libexec/urlgrabber-ext-down the head python to the same as in the/usr/bin/yum.

2. Installation of CentOS 7 minimal after the network is not a problem the first thing is to set up network access.
first, you need to use the Nmtui command to enter the Network manager to set the boot to start a service command named Networkmanager-wait-online

Systemctl Enable Networkmanager-wait-online.service

3. TCP6 occupancy issue after deploying ganglia 80 ports
Netstat-lntp|grep 80
Restart httpd after direct kill PID
Systemctl Restart Httpd.service

4. httpd cannot Web Access issue after deploying ganglia
Turn off firewall systemctl stop Firewall.service

Login: Back to the landing screen

Shutdown now immediately shuts down the machine

Shutdown +5 5 minutes after shutdown

Reboot restart

centos7.0 no netstat and ifconfig command issues

Yum Install wget

running Yum install net-tools is OK.

Three delete folder, File command New, delete, move, copy and other commands

1. New Folder mkdir file name

Create a new folder named Test under Home view Source1 mkdir/home/test

2. New text

Create a new test.sh script under Home vi/home/test.sh

3. Delete a file or folder

Delete The test directory under the home directory Rm/home/test

this method of deleting without parameters often prompts that it cannot be removed because the permissions are insufficient rm-r/home/test

-R is a recursive delete parameter in the table of directories and their subdirectories directories will be emptied and deleted when the delete directory contains a write-protected file when the user is usually prompted for the Rm-rf/home/test

F is not prompting the user to delete all files under the directory. Please note that it is tragic to check the path into another directory. Rm-ir/home/test

-I is an interactive mode. Use this option RM command to prompt the user for confirmation before deleting any files.

4. Move a file or folder MV [options] source file or directory destination file or directory

Parameters

-I interactive mode operation. If the MV operation will result in overwriting an existing target file, the system asks whether the override requires the user to answer "y" or "n" to avoid overwriting the file by mistake.

-F disables interactive operation. MV operation to overwrite an existing target file without giving any indication when this parameter is specified the I parameter will no longer work.

5. Copying files or folders

CP [Options] source files (source) destination files (destination)

Parameters
-A is equivalent to the meaning of-PDR
-D If the source file is a property of a linked file, the link file property is copied instead of the file itself
-F is mandatory (force) meaning that if there are duplicates or other questions, do not ask the user for forced copying
-I if the destination file (destination) is already present, ask if the action is true when overwriting
-L make a hard link to a link file instead of copying the file itself
-P Copies the past with the attributes of the archive instead of using the preset properties
-R recursive continuous replication for directory replication behavior
-s copy becomes a symbolic link file (symbolic link) that is the "shortcut" profile
-U if destination is older than source update destination

The four top command is explained in detail below

The top command acts as one of the most commonly used commands in Linux to analyze the performance of Linux. Often use this command but have not been detailed understanding of the meaning of each parameter the meaning of each parameter of the top command is summarized in detail below

Clipboard

first row top-16:10:53 up Notoginseng days, 20:20, 4 users, Load average:0.00, 0.00, 0.00

16:10:53 Current Time
Up Notoginseng days 20:20 system runtime format last: minutes
4 user Current number of users logged on
Load average:0.00, 0.00, 0.00 The system load is the average length of the task queue. The three values were 1 minutes, 5 minutes, and 15 minutes ago to the present average.

PS: Although it is known that load average is the meaning of the system load but does not understand its meaning after Google found

It is important to note that the multi-core CPU needs to divide this value by the number of logical cores

Second Line tasks:259 Total, 2 running, 257 sleeping, 0 stopped, 0 zombie

tasks:259 Total Process Totals
2 running number of running processes
257 sleeping The number of sleep processes
0 Number of processes stopped stopped
0 Zombie Number of zombie processes

Third line Cpu (s): 0.2%us, 0.6%sy, 0.0%ni, 99.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

CPU (s): 0.2%us user space consumes CPU percentage
0.6%sy CPU percent of kernel space consumed
0.0% CPU Percentage of processes that have changed priority within NI user process space
99.3%id Idle CPU Percentage
0.0%wa percentage of CPU time waiting for input and output
0.0% hi hard interrupt hardware IRQ consumes percent of CPU
0.0% si soft interrupt software interrupts% of CPU occupied
0.0%st Virtual Machine Steal time

Line Fourth mem:16143520k Total, 15581588k used, 561932k free, 919728k buffers

mem:16143520k Total Physical Memory
Total physical memory used by 15581588k used
561932k free Memory Total
The amount of memory that 919728k buffers uses as the kernel cache
PS: KB

Line Fifth swap:8011768k Total, 58072k used, 7953696k free, 11067628k cached

Total swap area of swap:8011768k
Total swap area used by 58072k used
7953696k Free Swap Area total
11067628k cached buffered Swap area total

Process List

column name  
PID process id 
PPID parent process id 
Ruser Real user name 
UID process owner user id 
User Process Owner's username & nbsp
The group process owner's name  
The terminal name of the TTY startup process. Processes that are not started from the terminal are displayed as  
PR priority  
NI Nice value. A negative value indicates that a high-priority positive value represents a low-priority   the last CPU used by the
P is only meaningful   in a multi-CPU environment;
%CPU the CPU time occupied by the last update to the current   the
time process uses a total unit of CPU seconds   The
time+ process uses a total unit of CPU time 1/100 seconds  
%MEM The percentage of physical memory used by the process   the
VIRT process uses the total amount of virtual memory in kilobytes. virt=swap+res  The
Swap process uses the size of the virtual memory that is swapped out in kilobytes.   The amount of physical memory size in kilobytes that the
RES process uses and is not swapped out. res=code+data 
The physical memory size unit KB&NBSP that the code executable is occupying;
The amount of physical memory that is used by the data executable code (segment + stack) kb 
SHR Shared memory size unit kb 
Nflt page faults  
NDRT The number of pages that were last written to the page that has now been modified.  
S process state.  
d= non-interruptible sleep state  
R= run  
s= sleep  
t= track/Stop  
z= Zombie process  
Command command name/command line  
Wchan If the process is sleeping, the system function name   is displayed in sleep;
Flags task Flag Reference Sched.h

Command

-Q Exit Top command-Refresh now-s set refresh Interval-C show command full mode-T: Show or hide process and CPU status information-m show or hide memory status information-L show or hide uptime information-f increase or decrease the process display flag- The S-accumulate mode accumulates the CPU time occupied by the completed or exited subprocess to the parent process mite+-p by%cpu usage ranking-T by mite+ rank-m by%mem rank-U Specify show user process-R Modify Process Renice value-Kkill process- I only show running processes-W save settings for top to file ^/.TOPRC the next boot will automatically call the settings of the TOPRC file. -H help command. -Q exit

2017-7-18-Daily blog-about Linux basic commands CnetOS7 system Basic Operations command. doc

Related Article

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.