Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The arrangement of basic knowledge of getting started with Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the basic knowledge arrangement of the introduction to Linux. The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the basic knowledge arrangement of the introduction to Linux.

[switching mode between graphics mode and text mode]

The Linux preset provides six command window terminals for us to log in. By default, we log in to the first window, that is, tty1, and the six windows are tty1,tty2. Tty6, you can press Ctrl + Alt + F1 ~ F6 to switch them. If you install a graphical interface, which is entered by default, you can press Ctrl + Alt + F1 ~ F6 to enter one of the command window interfaces. When you enter the command window interface and return to the graphical interface, just press Ctrl + Alt + F7 and you will be back. If you use a vmware virtual machine, the shortcut key for the command window toggle is Alt + Space + F1~F6. If you are in the graphical interface, press Alt + Shift + Ctrl + F1~F6 to switch to the command window.

[learn to use shortcut keys]

Ctrl + C: this is a shortcut to terminate the current command. Of course, you can enter a long string of characters. If you don't want it to run directly Ctrl + C, the cursor will jump to the next line.

Tab: this key is the most useful key, and it is also the one with the highest probability of hitting by the author. Because when you type a command halfway, it will help you make it up. Not only orders, but also can be completed when you type a directory. Try it if you don't believe it.

Ctrl + D: exit the current terminal, and you can also type exit.

Ctrl + Z: pause the current process, for example, if you are running a command and suddenly feel a problem and want to pause, you can use this shortcut key. After pausing, you can resume it using fg.

Input man ls is actually in the format of man + command

You will see the relevant help documentation. From the introduction of the command to the parameters and usage of the command are very detailed. Not bad.

[Linux system directory structure]

After logging in to the system, type ls / under the current command window and you will see

Ctrl + L: clear the screen and move the cursor to the first line.

[learn to query help documentation-man]

This man is usually used to view the help documentation for a command. For example:

Here is an explanation of these catalogs:

/ bin bin is the abbreviation of Binary. This directory contains the most frequently used commands.

/ boot here are some core files used to start Linux, including some connection files and image files.

/ dev dev is an abbreviation for Device (device). In this directory are the external devices of Linux, and the way to access devices in Linux is the same as to access files.

The / etc directory is used to store all the configuration files and subdirectories needed for system administration.

/ home user's home directory. In Linux, each user has his or her own directory, which is usually named after the user's account.

/ lib this directory stores the most basic dynamic link sharing library of the system, which is similar to the DLL file in Windows. Almost all applications need to use these shared libraries.

The / lost+found directory is usually empty, and some files are stored here when the system shuts down illegally.

/ media linux system will automatically identify some devices, such as USB flash drive, optical drive, etc., when identified, linux will mount the identified devices to this directory.

The / mnt system provides this directory to allow users to mount other file systems temporarily. We can mount the CD-ROM drive on / mnt/, and then enter the directory to view the contents of the CD-ROM drive.

/ opt this is the directory where additional software is installed for the host. For example, if you install an ORACLE database, you can put it in this directory. The default is empty.

/ proc this directory is a virtual directory, it is the mapping of system memory, we can access this directory directly to get system information. The contents of this directory are not on the hard disk but in memory. We can also modify some files directly. For example, you can use the following command to block the ping command of the host, so that others cannot ping your machine:

Echo 1 > / proc/sys/net/ipv4/icmp_echo_ignore_all.

/ root this directory is the system administrator, also known as the super-privileged user home directory.

/ sbin s means Super User, and here is the system management program used by the system administrator.

/ selinux this directory is unique to Redhat/CentOS, Selinux is a security mechanism, similar to windows's firewall, but this mechanism is more complex, this directory is to store selinux-related files.

/ srv this directory stores some data that needs to be extracted after the service is started.

/ sys this is a big change in the linux2.6 kernel. A new file system sysfs in kernel 2.6 is installed in this directory. The sysfs file system integrates the following three kinds of file system information: proc file system for process information, devfs file system for devices and devpts file system for pseudo-terminals. The file system is an intuitive reflection of the kernel device tree. When a kernel object is created, the corresponding files and directories are also created in the kernel object subsystem.

/ tmp this directory is used to store some temporary files.

/ usr this is a very important directory, where many of the user's applications and files are placed, similar to the program files directory under windows.

/ usr/bin: the application used by the system user.

/ usr/sbin: more advanced hypervisors and system daemons used by superusers.

/ usr/src: the default placement directory for kernel source code.

The / var directory contains things that are constantly expanding, and we are used to putting directories that are often modified in this directory. Including various log files.

In the linux system, there are several directories are more important, usually need to be careful not to delete or change the internal files at will. / etc: as mentioned above, this is the configuration file in the system, and if you change a file in this directory, the system may not be able to boot. / bin, / sbin, / usr/bin, / usr/sbin: this is the directory where the system preset execution files are placed. For example, ls is in the / bin/ls directory. It is worth mentioning that / bin, / usr/bin are instructions for system users (except root users), and / sbin, / usr/sbin are instructions for root. / var: this is a very important directory, there are many programs running on the system, then each program will have corresponding logs generated, and these logs will be recorded in this directory, specifically in the / var/log directory, and the default placement of mail is also here.

[how to turn off the computer correctly]

In fact, in the field of linux, it is mostly used on the server, and the shutdown operation is rarely encountered. After all, there is no end to running a service on the server, and it will be turned off unless it is forced to do so under special circumstances.

Linux is different from windows. Under Linux, because every program (or service) is executed in the background, there may be quite a number of people working on your host at the same time behind the screen you can't see, such as browsing the web, sending letters, sending files through FTP, and so on. If you press the power switch directly to shut down, other people's data may be interrupted! That would be nerve-racking! In addition, the biggest problem is that if the computer is not shut down properly, it may cause damage to the file system (because it is too late to write the data back to the file, so there will be problems with the files of some services! ).

If you want to turn off your phone, you must make sure that no other users are online in the current system. You can issue the command who, and if you want to see the online status of the network, you can issue the command netstat-a, while programs that depend on the background can execute the instruction ps-aux. Using these instructions can give you a little idea of the current usage status of the host! (these commands will be mentioned in later chapters, so you just need to know for now! )

The correct shutdown process is: sysnc? Shutdown? Reboot? Halt

The code is as follows:

Sync

Synchronize data from memory to hard disk.

The code is as follows:

Shutdown

Shutdown instructions, you can man shutdown to take a look at the help documentation. For example, you can run the following command to shut down:

The code is as follows:

Shutdown-h 10

The This server will shutdown after 10 mins' command tells you that the computer will shut down in 10 minutes and will be displayed on the current screen of the logged-in user.

The code is as follows:

Shutdown-h now

Turn off the computer immediately

The code is as follows:

Shutdown-h 20:25

The system will shut down at 20:25 today.

The code is as follows:

Shutdown-h + 10

Turn off the phone in ten minutes.

The code is as follows:

Shutdown-r now

The system restarts immediately.

The code is as follows:

Shutdown-r + 10

The system will restart in ten minutes.

Reboot means restart, which is equivalent to shutdown-r now

Halt shuts down the system, which is equivalent to shutdown-h now and poweroff

Finally, to sum up, whether you restart or shut down the system, you should first run the sync command to write the data in memory to disk. The commands for shutdown are shutdown-h now halt poweroff and init 0, and the commands for restarting the system are shutdown-r now reboot init 6. 0.

Thank you for your reading, the above is the content of "the basic knowledge of Linux introduction". After the study of this article, I believe you have a deeper understanding of the basic knowledge of Linux introduction, 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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report