Beginners in linux
Compared with windows, linux is more stable than windows. It generally acts on the server operating system.
# while windows is mostly used in client systems
Windows system, each partition is a directory, such as c, d, e
So it has three root directories, while linux has one and only one root directory, and all the files are stored in the root directory
A brief introduction to the linux file directory
/: root directory / / all files are stored in the root directory
/ boot: the location of the startup file of the system
/ dev: hardware devices, such as CD-ROM drive, floppy disk, keyboard, etc.
/ bin: commands used by ordinary users
/ sbin: commands used by the administrator
/ var: location where log files are stored
/ tmp: temporary file storage location
/ etc: configuration file for the system
/ root: administrator's home directory
/ home: home directory for ordinary users
# next, let's introduce cd. Pwd ls
Cd: change the directory / / if you want to enter a / boot directory, type in the terminal command: cd / boot if you want to exit, type: cd.
Cd. : remain the same as the current directory / / if you are now under / root, type cd at the terminal command line. If so, it will remain in this directory and will not make any changes.
Cd.. Return to the previous level
Cd ~: returns the current user's home directory
Cd -: return to the directory where you were last time: if you enter cd / boot to enter the / boot directory, continue to type cd / etc, and then type cd-finally you will go back to the / boot directory
# pwd: displays the current working directory
Example: if you type cd / etc/passwd into / etc/psswd on the command line and enter pwd, it will display / etc/passwd: this is the current working directory
Ls: shows all the files in the current directory / / that is, query the files in the current directory
Example: cd / boot
Ls / / this will list all the files under the boot
# continue to introduce the modification of hostname in linux
One is to modify the configuration file directly, and the other is to enter the command directly.
For example, I want to change my host name to teacher.tedu.com
On the command line, enter: hostnamectl set-hostname teaher.tedu.com / / modify the hostname
Hostnametl / / query hostname
The following method is to modify the configuration file directly because the hostname file is stored in / etc/hostname
Enter echo teacher.tedu.com > / etc/hostname / / on the command line to append the hostname teacher.tedu.com to the hostanme file
# here's how to modify ip address, gateway, dns on the command line
First, query the name of your network card. Typing: ifconfig: on the command line will display all the network card names.
There is only one physical network card, if it is eth0
On the command line, enter: nmcli connection modify etho ipv4.method manual ipv4.address "192.168.1.1 connection.autoconnect yes 24" connection.autoconnect yes / / modify the ip address to 192.168.1.1
Nmcli connection modify eth0 ipv4.gateway 192.168.1.254 / / modify the gateway address
Nmcli connection modify eth0 ipv4.dns 8.8.8.8 / / modify dns
Nmcli connection up eth0 / / activate the network card eth0
# set the ip address, gateway and dns of the network card above
# Let's introduce another way to modify dns: modify the configuration file
Because the dns file exists under / etc/resolv.conf, you can append it directly to the / etc/resolv.conf file.
For example, I want to change dns to 8.8.8.8.
You can enter: echo nameserver 8.8.8.8 > / etc/resolv.conf on the command line
Cat / etc/resolv.conf / / query dns address
Finally, a brief introduction to cat
Cat is a query command that generally queries txt files and files in which contents can be written, while ls generally lists all files that exist in a directory, including txt files
Nmcli connection show / / query all network card connections
Nmci connection status / / list the status of the device
# that's all for today and continue tomorrow
_ _____________________
End