In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what are the commands of Linux system management". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what are the commands of Linux system management.
Directory 1: common system working commands echo
Command description: the echo command is used to output the value of a string or variable at the terminal.
Command format: echo [string | $variable].
Example of command usage:
Show normal string
Echo "Hello World"
Display variables first define a temporary variable name in the shell environment.
Export name= "Tom"
Use the echo command to display the value of the variable name to the terminal.
Echo $name
Output result:
The following command directs the text This is a test text. The output is redirected to the file test.txt, overwriting the contents of the file if it already exists, and creating it if it does not exist. Where the > symbol indicates output redirection.
Echo "This is a test text." > test.txt
If you want to append the text to the end of the file content instead of overwriting it, use > > output to append the redirection symbol.
Display command execution results the following command will display the current work path on the terminal.
Echo `pwd`
Note: the pwd command is wrapped in a pair of backquotes (``), not a pair of single quotes ('').
The same effect can be achieved using the $(command) form.
Echo $(pwd)
Output result:
Date
Command description: the date command is used to display and set the time and date of the system.
Command format: date [options] [+ format].
Among them, some of the control characters of the time format are explained as follows:
The character indicates the abbreviation of the week name of% a local time (e.g., day, representing Sunday)% A the full name of the week of local time (e.g., Sunday)% b the abbreviation of month name of local time (e.g., January)% the full name of month of local time (e.g., January)% the date and time of local time (e.g., Thursday, March 3, 2005, 23:05:25)% C Century For example,% Y, usually omitting the last two digits of the current year (for example, 20)% d monthly date (for example: 01)% D monthly date Equal to% m/%d/%y%F full date format, equivalent to% Y-%m-%d%j annualized date (001,366)% p annualized date (0013666)% r 12-hour clock time (e.g. 11:11:04 afternoon)% R24-hour hours and minutes Equivalent to the number of seconds H:%M%s has elapsed since 00:00:00 UTC time 1970-01-01 T time, equal to the week ordinal of% H:%M:%S%U Take Sunday as the first day of the week (00-53)% x the date description under the local time (e.g. 12-31-99)% X the time description under the local time (e.g. 23:13:48)% w the day of the week (0-6), 0 represents the week ordinal of Monday% W, and Monday is the first day of the week (00-53)
Example of command usage:
View the current system time in the default format
Date
Output result:
View the current system time in the specified format
Date "+% Y-%m-%d% H:%M:%S"
Output result:
Check what day of the year it is today.
Date "+% j"
Output result:
Set the current time of the system to 20:20:20 on February 20, 2020
Date-s "20200220 20:20:20"
Output result:
Correct the system time, synchronize with the network time a. Install the NTP timing tool
Yum-y install ntpb. Update the time ntpdate time.nist.gov output from the time server with ntpdate:
Wget
Command description: download the file in the terminal.
Command format: download address of wget [parameters].
Parameter description:
Parameter function-b background download-P download to the specified directory-t maximum number of retries-c breakpoint resume-p download all resources on the download page, including pictures, videos, etc.-r recursive download
Examples of command usage:
Download a picture to the path / root/static/img/. The default value of the-p parameter is the current path. If the specified path does not exist, it will be created automatically.
Wget-P / root/static/img/ http://img.alicdn.com/tfs/TB1.R._t7L0gK0jSZFxXXXWHVXa-2666-1500.png
Output result:
Ps command description: the ps command is used to view the status of processes on the system.
Command format: ps [parameters].
The command parameter description:
The parameter function-a displays all the programs under the current terminal, including the programs of other users-u displays the program status in a user-based format-x displays the processes that do not control the terminal, and displays the specific path of each command-e lists the programs, displays the environment variable used by each program-f shows all current processes-t specifies the terminal number, and lists the status of the programs belonging to the terminal
Examples of command usage:
Ps-ef | grep sshd
Output result:
Top
Command description: the top command dynamically monitors information such as process activity and system load.
Examples of command usage:
Top
Output result:
Explanation of command output parameters:
The above command output view is divided into two areas, a statistics area and a process information area.
Statistical information area
The first line of information is: system time, run time, number of login terminals, system load (the three values are the average value of 1 minute, 5 minutes, 15 minutes respectively, the smaller the value means the lower the load).
The second line of information is in turn: the total number of processes, the number of running processes, the number of processes in sleep, the number of stopped processes, and the number of dead processes.
The third line of information is: the percentage of resources occupied by users, the percentage of resources occupied by the system kernel, the percentage of process resources that have changed priority, the percentage of idle resources, and so on.
The fourth line of information is in turn: the total amount of physical memory, the amount of memory used, the amount of free memory, and the amount of memory as the kernel cache.
The fifth line of information is in turn: total virtual memory, virtual memory usage, virtual memory free, preloaded memory.
Process information area
The column name means the user name of the PID process IDUSER process owner, the PR process priority NInice value. A negative value indicates a high priority, and a positive value indicates the total amount of virtual memory used by low-priority VIRT processes, the amount of physical memory used by the kbRES process that has not been swapped out, and the amount of shared memory per kbSHR Unit kbS process state D: uninterruptible sleep state R: running S: sleep T: stop Z: zombie process% CPU percentage of CPU time last updated to present%% percentage of physical memory used by MEM process total CPU time used by TIME+ process, unit: 100s COMMAND command name
Press Q to exit the monitoring page.
Pidof
Command description: the pidof command is used to query the pid value of the specified service process.
Command format: pidof [service name].
The command parameter description:
Parameter description-s returns only one process number-c displays only processes running in the root directory, this option is valid only for root users-o ignore processes with specified process numbers-x displays processes started by scripts
Examples of command usage:
Query the ID of all processes under the crond service.
Pidof crond
Output result:
Kill
Command description: the kill command is used to terminate the service process of the specified PID.
Kill can send the specified information to the program. The default information is SIGTERM (15), which terminates the specified program. If the program still cannot be terminated, you can use the SIGKILL (9) message to try to force the program to be deleted.
Command format: kill [parameters] [process PID].
Examples of command usage:
Delete the process with pid 1247.
Kill-9 1247killall
Command description: the killall command is used to terminate all processes corresponding to a service with a specified name.
Command format: killall [process name].
Examples of command usage:
Delete all processes under the crond service.
Killall crondreboot
Command description: the reboot command is used to restart the system.
Command format: reboot [- n] [- w] [- d] [- f] [- I].
The command parameter description:
-n: save the data and restart the system. -w: just do the test, not really reboot the system, but only write the rebooted data to the log file / var/log/wtmp. -d: no data is written to the record file / var/tmp/wtmp when rebooting. -f: force reboot without invoking the function of shutdown instruction. -I: turn off the network settings and then restart the system. Examples of command usage:
Rebootpoweroff
Command description: the poweroff command is used to shut down the system.
Examples of command usage:
Poweroff directory 2: system state detection command ifconfig
Command description: the ifconfig command is used to obtain information such as network card configuration and network status.
Example of the command:
Command output description:
The first line of the first part displays the network card status information.
Eth0 represents the first network card.
UP represents the enabled status of the Nic.
RUNNING represents the network cable of the network card is connected.
MULTICAST indicates support for multicast.
The second line shows the network information of the network card.
Inet (IP address): 172.16.132.195.
Broadcast (broadcast address): 172.16.143.255.
Netmask (mask address): 255.255.240.0.
RX indicates the situation in which the packet is received, and TX indicates the situation in which the packet is sent.
Lo represents the loopback network card of the host, which is a special network interface, which is not connected to any actual equipment, but is completely implemented by software. Unlike the loopback address (127.0.0.0swap 8 or:: 1tap 128), the loopback Nic appears as a piece of hardware to the system. Any data sent to the network card will be immediately received by the same network card.
Uname
Command description: the uname command is used to view information such as system kernel and system version.
Command syntax: uname [- amnrsv] [--help] [--version]
Examples of command usage:
Displays system information.
Uname-a
Command output result:
Displays the hardware architecture of the current system.
Uname-I
Command output result:
Displays the operating system release number.
Uname-r
Command output result:
Displays the operating system name.
Uname-s
Command output result:
Displays the host name.
Uname-n
Command output result:
Uptime
Command description: uptime is used to view the load information of the system.
Examples of command usage:
Command output description:
Load information command output value current server time 14:20:27 current server running time 2 min current number of users 2 users current load load average: 0.03,0.04,0.02 (take the average of 1 minute, 5 minutes, 15 minutes respectively) free
Command description: free is used to display memory usage information on the current system.
Command syntax: free [- bkmotV] [- s].
The command parameter description:
Parameter description-b displays memory usage in Byte units-k displays memory usage in KB units-m displays memory usage in MB units-h displays memory usage in appropriate units, with a maximum of three digits, and automatically calculates the corresponding unit value.
Examples of command usage:
Command output description:
Parameter indicates the total amount of total physical memory used has used, the number of memory in free space, the total amount of memory shared by multiple processes, the total amount of memory shared by multiple processes buff/cache application uses the number of memory available available virtual memory (virtual memory is not enabled by default on Ali cloud ECS server) who
Command description: the who command displays information about all users currently on the local system.
Examples of command usage:
Displays the users who are currently logged in to the system
Show user login source
Show only the current user
Compact mode display
Last
Command description: the last command is used to display the user's most recent login information.
Examples of command usage:
Because the information is saved in the system in the form of log files, hackers can easily tamper with the content, so the information output by the command can not be used as a basis for whether the server is invaded or not.
History
Command description: the history command is used to display commands that have been executed in history.
Bash records 1000 executed historical commands by default, which are recorded in the ~ / .bash_history file.
Examples of command usage:
Displays the last 10 executed commands.
Clear the history.
History-c thank you for your reading, the above is the content of "what are the commands of Linux system management". After the study of this article, I believe you have a deeper understanding of what the commands of Linux system management have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
ZAP installation of software that installs non-MSI format
© 2024 shulou.com SLNews company. All rights reserved.