2017-10-7linux Basics (5) Basic commands
in the previous section, we talked about how to set up the locale after installation, and how the terminal type and how to switch from the character terminal to the graphics terminal, then the graphical terminal we are very common, for example, Windows is a graphics terminal, we call this GUI
, and the main use of Linux is the character terminal, which we call the command line interface CLI
, then the main thing in the following chapters is CLI
interface and some basic commands.
One, CLI interface
in Windows, the vast majority of users are using GUI
interface, whether it is the client or the server, it is very easy to use, and the learning line is very flat, so for the client most of it is to choose it for ordinary users to operate, and on the server side, Linux is the best choice, because the graphical interface on Linux is just an application, Can be installed also can be uninstalled, and for the service side, install graphical interface is a trouble, but also insecure, occupy a lot of service resources, so CLI
is the main use of Linux in the application interface, especially on the server side, resources and efficiency is the most important.
1.1 Command Line interface
After we install Linux, enter the user name and password will see the interface, the approximate format is as follows:
[[email protected] ~]# COMMAND
The above format is called the command line interface format, the details are as follows:
USERNAME: currently logged in user;
@: delimiter, no special meaning;
HOSTNAME: The current host name, not the full format, if not set the hostname, the default is localhost, the whole process is localhost.localdomain;
~: The directory in which the user is currently located (current directory), also known as the Working directory (working directory), usually a relative path;
#: Command prompt, a total of two, one is an administrator prompt #, the other is a normal user prompt $;
#: Administrator account, root, with the highest privileges, can perform all operations;
$: Ordinary users, non-root users, do not have administrative rights, can not perform system management class operations;
It is important to note that we do not want to root
Administrator's identity to log on to Linux, because the permissions are very large, so we recommend to use a non-administrator account to log on to the system, if you want to perform administrative operations, the general administrator is not authorized, to perform administrative operations need to temporarily switch the administrator, the operation completed can be returned, this is also a method.
ii. Basic Commands
We've talked about a few basic commands before, so let's get back to it:
# TTY: View the current terminal equipment;
# ifconfig or # IP Addr list: View the IP address of the active interface;
# StartX: Start the graphics terminal;
the above is the basic command of the reply, then we now introduce some new command base commands, now CentOS 7 and the previous version is very different, no hierarchy, and by the original init
the systemd
switch becomes , which is described in later articles, and now describes how Linux shuts down and restarts commands.
In CentOS 7 and 6, for example, the commands for shutting down here are different, the functions that can be implemented are shutdown, the command is as follows:
CentOS 7:
# SYSTEMD Poweroff
*:
# Power off
# Halt
Note: * Indicates that any version is generic, including CentOS 7.
Next, the restart command is described:
CentOS 7:
# Systemctl reboot
*:
# reboot
and there is ping
. Commands and echo
command, Echo is echoing, so ping is the connectivity between the target host of the probing network and the current host, as in the following example:
[[email protected] ~]# Ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) bytes of data.
Bytes from 192.168.1.1:icmp_seq=1 ttl=128 time=23.2 ms
Bytes from 192.168.1.1:icmp_seq=2 ttl=128 time=5.95 ms
Bytes from 192.168.1.1:icmp_seq=3 ttl=128 time=6.29 ms
Bytes from 192.168.1.1:icmp_seq=4 ttl=128 time=5.94 ms
Bytes from 192.168.1.1:icmp_seq=5 ttl=128 time=5.54 ms
Bytes from 192.168.1.1:icmp_seq=6 ttl=128 time=6.43 ms
^c
---192.168.1.1 ping statistics---
6 packets transmitted, 6 received, 0% packet loss, time 5013MS
RTT Min/avg/max/mdev = 5.549/8.897/23.206/6.405 ms
^C
is the shortcut key Ctrl + C, meaning to terminate the current process operation, if the termination of the words will always ping, then we use -c
option to solve this problem, such as I only let it ping4, examples are as follows:
[Email protected] ~]# PING-C4 192.168.1.1
PING 192.168.1.1 (192.168.1.1) bytes of data.
Bytes from 192.168.1.1:icmp_seq=1 ttl=128 time=71.6 ms
Bytes from 192.168.1.1:icmp_seq=2 ttl=128 time=37.2 ms
Bytes from 192.168.1.1:icmp_seq=3 ttl=128 time=6.13 ms
Bytes from 192.168.1.1:icmp_seq=4 ttl=128 time=7.78 ms
---192.168.1.1 ping statistics---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
RTT Min/avg/max/mdev = 6.139/30.706/71.681/26.693 ms
OK, so that's all of it, so in the next section we'll talk about the syntax format of the command.
This article from "MARCRF Blog" blog, reproduced please contact the author!
2017-10-7linux Basics (5) Basic commands