Getting started with Linux
Basic concepts of Linux
1: kernel
To put it simply, the
Linux kernel module of the program that operates the computer hardware has the following: storage management, CPU and process management, file system, device management and driver, network communication, and system initialization and booting, system calls, etc.
2: Release
The release version is to make a package of the kernel and application software
3: Disk partition
Disk partition is to divide a disk space into several areas, and then you can specify the role of each area. It
should be noted that there is a swap partition in Linux, and its main function is to use it when the physical space is full. swap swap partition
4: File system
In each partition of the Linux system, files are stored and organized according to a certain method. This method is called a file system. When
we use a file system to save data, we don’t need to care about the actual data saved on the disk. What is the address of the data block, you only need to remember the directory and file name that this file belongs to. The following is the role of each file in the Linux system, that is, the directory structure:
Linux installation
Let’s take a virtual machine to install CentOS7 as an example to install the Linux system:
CentOS7 mirror address: Click to download , or you can use the following link to download from Tencent Weiyun: Link: https://share.weiyun.com/BUZ6ETlK Password: 546ws6
Install CentOS7 in a virtual machine
1:
First choose to create a new virtual machine
2:
Then select custom
3:
Keep clicking Next, to the following figure, choose to install the operating system later
4:
The following is to name the virtual machine and choose where to install the virtual machine
5:
Set the number of processors and cores
6:
Keep clicking Next, the settings inside can be selected by default, and you can set
them again in the future. Then right-click the virtual machine and select the ISO image file we downloaded in the virtual machine settings.
7:
Then you will enter the installation interface of CentOS, just wait
8:
Select language, select simplified Chinese here
9:
The following are some settings of the virtual machine, here can be the default, and then click to start the installation
10:
Set a password for the root user, and then wait for the installation to complete
11:
After the installation is complete, click Restart
12:
Enter the user name and the password you just set to enter the system
CentOS setup network
1:
First click edit in the virtual machine to enter the virtual network editor
2:
Then select NAT mode
3:
Click NAT settings, remember the gateway IP here
4:
Use the dhclient command and ip addr to obtain the IP address
5:
Use vi /etc/sysconfig/network-scripts/ifcfg-ens33 to modify the IP address, ens33 is obtained from the IP address obtained above, and can be modified according to the actual situation.
Then click the i on the keyboard to enter the file editable state
and then change BOOTPROTO=dhcp to BOOTPROTO =static, change ONBOOT=no to ONBOOT=yes
and add the following content at the end of the file
IPADDR=192.168.15.128
NETMASK=255.255.255.0
GATEWAY=192.168.15.2
DNS1=192.168.15.0 After
editing, press ESC to exit, and then enter: Save wq and exit editing.
Finally, use systemctl restart network.service to restart the network, and then use the dhclient -r command, and again use the dhclient and ip addr commands to obtain the IP address. You can see that the IP has become the one you just set
Linux basic operating commands
File directory operation command
man:The help command in Linux. Through this command, you can view Linux command help, configuration file help, and programming help.
The following information will appear when you directly enter man. When you use man, you need to follow specific instructions, and then You can see the help information for specific instructions
ls : View the contents of the current working directory
ll: Equivalent to ls -l
cd: Switch current working directory
pwd: View the path of the current working directory
cp:Used to copy directories or files to the specified location
. The first one is the current file, and the latter one is the copied file
rm:Deleting files or directories
When deleting a folder, the following problems will occur, you can use the rm -d -r -f command to delete
mv:To move a file or directory, and to rename it, use this command to
move out.log
to rename out.log
mkdir: Create a directory
Process operation command
ps: Show running processes
kill: end process
free: Show memory usage
top:Real-time display of system resource usage. Task manager similar to window system
sudo: Run the program as an administrator
its: Switch to admin user
exit: Log out user login
poweroff: Shut down
reboot: Reboot
Text operation command
we: Edit text file
cat: Print out the contents of the file
more: View the content of the file in pages (only page backward)
less: View the contents of the file in pages (pages can be turned back and forth)
tail: Output the content of the file from the specified point (use the -f option of the tail command to easily view the log file that is changing)
grep: Find a string, usually used in conjunction with other commands
Linux permission operation
User and group operation commands
useradd: Add a new user
usermod: Modify user information
userdel: delete users
groupadd: Add a new user group
groupmod: Modify the attributes of a user group
groupdel Delete an existing user group
Permission operation
chmod: Modify file or directory permissions
chown: Modify the owner of a file or directory
chgrp:Modify the group belonging to a file or directory
.
Look at the picture above: drwxr-xr-x and -rw-r–r--The
first position (d) represents a file or a directory, and the next three (rwx) refer to The permissions that the current user has, the next three (rx) are the permissions of the current user group, and the last three (rx) are the permissions of other user groups
Concluding remarks
There are many basic commands for Linux, and the commonly used ones are basically those above. If you want to learn more, you can check the rookie tutorial: Linux Commands