Laruence's Linux Private food-Basic Learning (third edition) (6)
Chapter 2 First Login and online man page
1. First login to the System
First, let's talk aboutFirst login to the CentOS 5. x Interface. The session in the login option can be operated on the entire Linux system using different graphical interfaces. By default, at least two graphical interfaces, GNOME and KDE, are provided.
Later I talked aboutGNOME operations and Cancellation. The personal master folder is under/home. The resource manager of GNOME is actually called "parrot ". Objects whose names start with the decimal point "." are hidden objects. If you log out, your account is not shut down.
Next, let's talk aboutKDE operations and Cancellation. The resource manager in KDE is called Konqueror ). To restart X window, log out and log on again or press [Alt] + [Ctrl] + [Backspace].
Also talked aboutSwitching between X Window and Command Line Mode. The command line mode is usually called terminal interface (terminal or concole ). By default, Linux provides six Terminal ports for users to log on. The switching mode is [Alt] + [Ctrl] + [F1] ~. [F6]. [F1] ~ [F6] Name ttf1 ~ The operation environment interface of ttf6, where [Alt] + [Ctrl] + [F7] is the GUI desktop. The default logon mode for Linux is divided into two types (if you want to change the content of the file/etc/inittab ):
1) the logon environment of the plain text interface (run level 3. At this time, there is no graphic Window environment. To switch, you can use the startx command.
2) the logon environment of the graphic interface (run level 5.
Last talkLog on to Linux. If you enter the password, it is not displayed. The information displayed after correct logon is as follows: [why @ www ~] $ _, The leftmost why shows the current user's account, and the @ www is the host name, rightmost ~ Is a variable that represents the "current directory", $ is the normal user's prompt (if it is a root user, the prompt is #). When you want to log out of Linux, enter the command exit.
2. execute commands in Command Line Mode
The program obtained after logging on to the command line mode is called shell, because this program is responsible for communicating with the user at the outermost layer.
First, let's talk aboutStart to execute the command. The command style is as follows: command [-options] parameter1, parameter2..., note the following:
1) no matter how many spaces are left blank, It is a space.
2) When the command is very long, you can use a backslash (\) to transfer the [Enter] symbol, so that the command can continue to the next line.
3) English letters are case-insensitive.
4) The first input data is definitely a command or executable file.
By default, terminal interfaces cannot output data in Chinese encoding. You can change the supported language to English to display the correct information, but this change is only useful for this time.
Then I talked aboutBasic command operations. Three commands are described here:
1) command for displaying date and Time: date. Note that, in addition to the minus sign (-), the parameters after the command also carry a forward sign (+) in some special cases ).
2) run the "cal" command to display the calendar. The basic syntax is cal [[month] year]. You can also know that some commands have special parameters. If an incorrect parameter is input, the command will receive an error message.
3) Easy-to-use calculator: bc. By default, only integers are output. to output all decimals, scale = number must be executed, where number is the number of digits after the decimal point. If you want to leave bc and return to the command prompt, enter quit.
Next, let's talk aboutImportant hotkeys: [Tab], [Ctrl]-c, [Ctrl]-d.
1) Click the [Tab] button. Provides the "command completion" and "file completion" functions. If it is followed by the first command of a string of commands, it is "command completion ". If it is connected to the second command of a string of commands, it is "file completion ".
2) [Ctrl]-c. Can interrupt the current program.
3) [Ctrl]-d. It usually indicates the end of the keyboard input (EOF). It can also be used to replace the exit input.
FinallyView error information.
3. Online help man page and info page in Linux
First, let's talk aboutMan page. Man is short for manual. The interface displayed after entering the man command is called man page. At this time, you can press the Space key or [Page Up] and [Page DOwn] To go DOwn or Up to flip the Page, you can press the "q" key to leave the man environment. The man page data is usually stored in the/usr/share/man directory. The number after the data is queried indicates:
1 |
Commands or executable files that can be operated by the user in the shell Environment |
2 |
System Kernel callable functions and tools |
3 |
Some common functions and function libraries, most of which are C function libraries |
4 |
Description of other files, usually files under/dev |
5 |
Configuration file or the format of some files |
6 |
Games |
7 |
Conventions and protocols, such as Linux file system, network protocol, and ASCII code |
8 |
Available management commands of the system administrator |
9 |
Files related to kernel |
Man page is roughly divided into the following parts:
NAME |
Brief command and data name descriptions |
SYNOPSIS |
Brief Introduction to command execution syntax |
DESCRIPTION |
Complete description |
OPTIONS |
All available options listed in the SYNOPSIS Section |
COMMANDS |
When this program (software) is being executed, the commands that can be executed in this program (software) |
FILES |
Some files used or referenced or connected to this program or data |
SEE ALSO |
This command or data has other instructions |
EXAMPLE |
Examples for Reference |
BUGS |
Related errors? |
You can use/string to query down string strings, and use? String: query string up. During the Query Process, n can continue the next query, and N can reverse query.
Use man-f xxx to query xxx-related commands, and use man-k xx to query commands that contain the xx keyword. The query order is recorded in the/etc/man. conf configuration file. The description file first queried will be displayed first, and the smaller one will be found first.
Then I talked aboutInfo page. Split file data into paragraphs, and each section is written on its own page. On each page, there is a "HYPERLINK" similar to the webpage to jump to different pages, each Independent page becomes a node ). However, the premise is that the description file of the target data to be queried must be written in Info format. The files supporting the info command are stored in the/usr/share/info/directory by default. After entering the info page, press N, P, and U to go to the next node, the previous node, and the previous node. Press the [Tab] key to move between the hyperlinks.
Last talkOther useful documents). There are a lot of instructions in the/usr/share/doc directory. The data in this directory is mainly based on software packages.
4. Ultra-simple text editor: nano
You can directly add a file name to open an old or new file. The exponential sign (^) represents the [Ctrl] key, and M represents the [Alt] key.
5. Correct shutdown Method
You can run the "who" command to check who is online. You can run the "netstat-a" command to check the online status of the network. You can run the "ps-aus" command to check the background program.
First, let's talk aboutSynchronize data to disk: sync. On the text interface, enter sync to write unupdated data in the memory to the hard disk, which can be used before shutdown or restart. However, the tool is usually automatically called when the command is shut down or restarted.
Then I talked aboutThe usual shutdown command: shutdown. There are many usage cases. shutdown immediately is shutdown-h now. For other usage cases, see man shutdown.
Next, let's talk aboutRestart and shutdown: reboot, halt, poweroff. Reboot is a restart. shutdown can be stopped only after one service is closed based on the currently started service. halt can perform a special function of shutting down the hardware in the current system.
Last talkSwitch execution level: init. The other four levels are:
1) run level 0: Shut down. So init 0 can also be shut down.
2) run level 3: pure command line mode.
3) run level 5: contains the graphic interface mode.
4) run level 6: restart.
6. troubleshooting during startup
First, let's talk aboutFile System Error. The root directory is not damaged, the root directory is damaged, and the hard disk is damaged.
Last talkForgot root Password. Describes how to use the grub boot loader to solve this problem.