In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about the commonly used Linux commands, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
one。 System working command
1. Echo command
The echo command is used to output a string or the extracted value of a variable at the terminal. Format: echo [string | $variable]
Similar to system.out.println in java
[root@k8s-master ~] # echo "hello world" hello world [root@k8s-master ~] # str= "hello world" [root@k8s-master ~] # echo $strhello world
2. Date command
The time used to display and set the system in data [options] [+ specify format]
Common parameters of data
% t tabbed [tab key]
% H hours (0,23)
% I hours (0,12)
% M minutes (0,59)
% s seconds (0,59)
% J the day of the year
[root@k8s-master ~] # dateThu Apr 11 13:42:20 CST 2019 [root@k8s-master ~] # date "+% Y-%m-%d% H:%M:%S" 2019-04-11 13:43:41 [root@k8s-master ~] # date "+% j" 101
3. Reboot restart command
The reboot command is used to restart the system in the format reboot.
[root@k8s-master ~] # reboot
4. Poweroff command
The poweroff command is used to shut down the system in the format poweroff
[root@k8s-master ~] # poweroff
5. Wget command
The wget command downloads the network file on the terminal in the format of wget [parameters] [download address]
Parameter introduction
-b background download mode
-P download to the specified directory
-t maximum attempts
-C breakpoint continuation
-p download all resources on the page
-r recursive download
[root@k8s-master ~] # wget http://www.linuxprobe.com/docs/LinuxProbe.pdf
6. Ps command
The ps command is used to view the status of processes on the system in the format [ps parameter]
Parameter introduction
-a shows all processes
-u displays users and other details
-x shows the process without controlling the terminal
[root@k8s-master ~] # ps aux
7. Top command
The top command is used to dynamically monitor details such as process and system load. The top command is powerful, equivalent to "enhanced windows Task Manager" in linux
Top-10:41:34 up 12 days, 19:14, 2 users, load average: 1.00,1.06, 0.92Tasks: 635 total, 2 running, 633 sleeping, 0 stopped, 0 zombie%Cpu (s): 4.6 us, 1.2 sy, 0.0 ni, 92.1 id, 1.7 wa, 0.0 hi, 0.1 si, 0.3 stKiB Mem: 16268340 total, 7407372 free, 4552160 used, 4308808 buff/cacheKiB Swap: 0 total, 0 free, 0 used. 10456728 avail Mem PID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND 32056 root 20 0 868460 790968 42808 S 25.2 4.9 1915 MEM TIME+ COMMAND 18 kube-apiserver
The first five lines of the top command are the overall system statistics. It represents system load, process, cpu, physical memory, and virtual memory usage, respectively.
8. Pidof command
The pidof command is used to query the pid value of a service. Format: [pidof parameter service name]
[root@k8s-master ~] # pidof java 27775
9. Kill and killall commands
The kill command is the process format for terminating the pid value [kill parameter pid value], and the killall command is for terminating all processes of a particular service [killall parameter a process name].
two。 State monitoring command
System status monitoring commands can faster and better understand the linux server. It includes the use of related commands, such as the network card network of the system, the system kernel, the system load, the memory usage, the current number of startup terminals and so on.
1. Ifconfig command
Ifconfig is used to obtain information such as network card configuration and network operation status. Format is [ifconfig network device parameters]
Only enter ifconfig to view all the network card information.
[root@k8s-master] # ifconfigens33: flags=4163 mtu 1500 inet 192.168.223.16 netmask 255.255.255.0 broadcast 192.168.223.255 inet6 fe80::20c:29ff:fede:d1af prefixlen 64 scopeid 0x20 ether 00:0c:29:de:d1:af txqueuelen 1000 (Ethernet) RX packets 66 bytes 8951 (8.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 88 bytes 10153 (9.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The main way to view the Nic information is to check the name of the Nic, the IP address after inet, the physical address after ether, the number of data packets received and sent by RX and TX, and the cumulative traffic.
The main way to view the Nic information is to check the name of the Nic, the IP address after inet, the physical address after ether, the number of data packets received and sent by RX and TX, and the cumulative traffic.
2. Uname command
The uname command looks at information such as the system kernel and system version. It is generally matched with the-a parameter to view the relevant information.
[root@k8s-master ~] # uname-aLinux mysql 3.10.0-693.el7.x86_64 # 1 SMP Tue Aug 22 21:09:27 UTC 2017 x86 "64 GNU/Linux
Also view the details of the current system version.
[root@k8s-master ~] # cat / etc/redhat-release CentOS Linux release 7.4.1708 (Core)
3. Uptime command
The uptime command views the load information of the system. Including the system time, the system running time, the current end user, and the pressure of the system in the last 1 minute, 5 minutes, 15 minutes. The lower the load value, the better, do not exceed 1 for a long time, and the production environment should not exceed 5.
[root@k8s-master] # uptime 11:15:53 up 14 min, 2 users, load average: 0.00,0.04,0.05
4. Free command
Displays memory usage information in the current system. The format is [free-h]
[root@k8s-master] # free-h total used free shared buff/cache availableMem: 15G 4.4G 6.7G 739m 4.4G 9.8GSwap: 0B 0B 0B
5. Histroy command
The histroy command is used to display historically executed commands in the format [history-c]
Execute the history command to show the current user on the local computer
Records of the last 1000 commands executed in the. You can also use "! encode a number" to repeat a command.
[root@k8s-master ~] # history 1 ls 2 cd / 3 ls 4 hostname 5 ls 6 cd mysql/ 7 ls 8 cd data/
three。 Working directory switch command
The linux that is used in the course of work is hardly graphically installed. In order to reduce expenses. We basically use command terminal mode. Naturally, it is not as easy to change the working directory as in the windows system. The working directory even if the user is currently in the location.
1. Pwd command
The pwd command displays the absolute path format of the current working directory [pwd option]
[root@k8s-master ~] # pwd/root
2. Cd command
The cd command switches the work path. This is probably the most commonly used command in linux.
[root@k8s-master ~] # cd / home/ [root@k8s-master home] #
3. Ls command
The ls command displays file information. Format [ls options]
The-l parameter allows you to view file properties
[root@kubemaster home] # lsconfig docker software test.yaml [root@kubemaster home] # ls-ltotal 12drwxr-xr-x 4 root root 35 Feb 13 09:46 configdrwx--x--x 11 root root 130 Mar 11 16:37 dockerdrwxr-xr-x 4 root root 30 Jan 10 14:08 software-rw-r--r-- 1 root root 234 Sep 6 2018 test.yaml
four。 File directory management command
1. Mkdir command
The mkdir command is used to create a blank directory in the format [mkdir options directory]
You can use the-p parameter to create a directory recursively.
[root@kubernetes ~] # mkdir-p / a/b/c [root@kubernetes ~] # cd / a/b/c [root@kubernetes c] # pwd/a/b/c
2. Cp command
The cp command is used to copy a file or directory in the format cp [option] source file destination file
[root@kubernetes ~] # cp install.log x.log [root@kubernetes ~] # lsinstall.log x.log
3. Mv command
The mv command is used to cut or rename a file in the format of mv [option] source file [destination path | destination file name]
[root@kubernetes ~] # mv x.log linux.log [root@kubernetes ~] # lsinstall.log linux.log
4. Rm command
The rm command is used to delete a file or directory in the format of rm [options] file
When you delete a file on a Linux system, you will be asked by default if you want to delete it, if you do not want to always
When you see this repeated confirmation, you can force deletion by following the-f parameter after the rm command.
[root@kubernetes ~] # rm install.logrm: remove regular empty file 'install.log'? Y [root@kubernetes ~] # rm-f linux.log [root@kubernetes ~] # ls [root@kubernetes ~] # what is a Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
After reading the above, do you have any further understanding of the commonly used Linux commands? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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
© 2024 shulou.com SLNews company. All rights reserved.