I am also a beginner in liunx. If there is any error, please point it out. Liunx: Ubuntu 14.04
I. liunx command Basics
Press CTRL + ALT + T to open the terminal in Ubuntu.
Basic liunx Command Format: Command [-options] parameter1 parameter2
1. The command is a "command" or an "Executable File". Common examples include ls, CD, and mkdir.
2. [-options] is the Setting Parameter of the command character, for example, LS-L, where-L is the corresponding options, which is both the Setting Parameter of the command and usually contains "-". Sometimes "--" is included in the front, for example, "-- help"
3. parameter1 and parameter2 are parameters attached to options or command parameters.
4. commands,-options, and parameters are separated by spaces. Shell is regarded as a grid regardless of the number of spaces.
5. After pressing the Enter key, the command will be executed immediately. Pressing the Enter key indicates that the input of a command is complete.
6. If the command is too long, you can use a backslash (\) to escape the carriage return symbol, so that the command can continue to the next line,
Others: In liunx, note that commands are case sensitive,
Ii. Basic command operations
1. display the languages currently supported by the system
Command: Echo $ Lang
[Email protected]: ~ $ Echo $ LANGzh_CN.UTF-8 # display languages supported by the current system #2. Modify the default language of the current system [email protected]-Lenovo-B460 :~ $ Lang = en_us [email protected]-Lenovo-B460 :~ $ Echo $ langen_us [email protected]-Lenovo-B460 :~ $ Lang = zh_CN.UTF-8 [email protected]-Lenovo-B460 :~ $ Echo $ LANGzh_CN.UTF-8 [email protected]-Lenovo-B460 :~ $
2. commands for displaying dates and times
Command: Date
[Email protected]: ~ $ Date Tuesday September 16, 2014 17:46:12 CST [email protected]-Lenovo-B460 :~ $ Date + % Y/% m/% d2014/09/16 [email protected]-Lenovo-B460 :~ $ Date + % H: % M17: 46 [email protected]-Lenovo-B460 :~ $ From the above we can see that the date command shows the current date of the system and the formatted display of the date. "+ % Y/% m/% d" is some parameters of the date command, these parameters can be queried using man or info commands.
Note: The preceding command execution process shows that the format of command parameters includes "+" in addition to "-" and.
3. calendar display command
Command: Cal [month] [year]
[Email protected]: ~ $ Cal October 14, 5 6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 25 26 27 28 29 30 [email protected]-Lenovo-B460: ~ $ Cal 2013 2013 August 1-August 1 5-August 6-August 6-August 5-August 6-August 5-August 1 2 3 4 5 1 2 2 6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9 13 14 15 16 18 19 10 11 12 13 14 15 16 11 12 13 13 14 15 15 16 20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 27 28 29 30 31 24 25 26 28 24 25 26 27 28 29 30 31 # Some month ........ .. [email protected]-Lenovo-B460 :~ $ Cal 05 2013 October 13, 5 6 1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 25 26 27 28 29 30 31 [email protected]-Lenovo-B460: ~ $ Cal 32 2013cal: 32 is neither a month number (1 .. 12) nor a name [email protected]-Lenovo-B460 :~ $
As shown in the preceding execution results, the corresponding prompt information is displayed when the Cal command executes the incorrect command you entered.
4. Easy to use Calculator
Command: BC
Some simple computation may occur during our program writing time. In liunx, BC is the simplest calculator.
[email protected]:~$ bcbc 1.06.95Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.This is free software with ABSOLUTELY NO WARRANTY.For details type `warranty‘. 20+103045/5978*45351015%21scale=315%20340/2314.78215/27.50045^220252^24
As shown in the preceding script, the operator is
+ Addition
-Subtraction
* Multiplication
/Division
^ Index
% Remainder
By the way, enter the quit command to exit.
2. Important hotkeys: [Tab], [Ctrl-C], and [Ctrl-D]
1. The [Tab] key provides the "command completion" and "file completion" functions during terminal execution.
2. The [Ctrl-C] key terminates the program execution function during terminal command execution.
3. The [Ctrl-D] key is equivalent to the exit command during terminal command execution, that is, exit the terminal.
3. Online help for the liunx System
Liunx online help can be divided into man page and info page.
1. Man page
Command Format: Man command
The exit command is Q.
You can try it on your own.
2. info page
Command Format: info command
The exit command is Q.
3. Ultra-simple text editor: Nano
Run the following command: Nano to open the file path:
For example:
Tip: The ^ indicates the crtl key corresponding to the keyboard, and the other M prompt indicates the Alt key (this figure does not exist, it will be known when it is applied)
Iv. correct methods for ON/OFF
The shutdown of the liunx system is very different from that of windows.
Because the Windows operating system is a single user, "fake many" tasks, so even if your computer is shut down, it will not affect others. But for the liunx operating system, because every program (or service) is executed in the background, many people work on your host at the same time behind the screen that you cannot see, your shutdown may cause data loss to others' work. To shut down the liunx system, do the following:
1. view the system Usage Status
Using the "netstat-a" command, you can see who is connecting to this host, and the Program executed in the background can use the "PS-Aux" command.
2. Notify online users of the shutdown time
You can use man or info to view the detailed parameters of the shutdown command.
3. The usual shutdown command: Shutdown
4. synchronize data to disk: sync
5. Shutdown and restart: reboot, halt, and poweroff
The functions of these three commands are similar. When you use the man reboot command, you will see the other two commands.
Generally, use: sync, sync, and reboot to restart the instance. Save the data before shutting down the instance.
Getting started with liunx Shell