Linux Getting started with the world of programs-operating system
In the previous chapter, we discussed why to build a compilation environment, so many of the fairy appearance, I believe you can also remember to build the environment for the cause of the compilation. In the discussion, unknowingly put the Linux operating system to bring up, in fact, the use of Windows to teach may be a little more convenient. After all, we are familiar with it, but we are programmed on the phone, the mobile phone can not use the tools on Windows, so Windows is not used, and had to go to the embrace of the Linux system.
In this chapter, I will briefly describe the commands that are used under Linux. Finally put forward a little bit of practice.
The Linux system configured in the previous chapter is the Ubuntu (Bantu) system, which originally had an interface that was much more flashy than the Windows system, but the system configured in the previous chapter had no interface. Because if with the interface, there will be a lot of mobile phones can not afford to run. So in order to let the configuration is not high mobile phone can also practice, deliberately selected only the Ubuntu core system.
There are many Linux commands, and they are very powerful. In this chapter, I'll cover only a few basic commands.
The commands to be introduced are:
- File and folder operations commands
- Vim Editor Commands
- Other System commands
File and folder operations commands
Command |
Function |
Pwd |
View current directory path |
Ls |
List all folders and files in the current directory |
Cd |
Enter a directory |
Cd.. |
Go to the top level directory |
Mkdir |
Create a Directory |
RmDir |
Delete a non-empty directory (folders and files cannot be found in the directory) |
Touch |
Create a blank file |
Rm |
Delete a file |
CP File 1 File path |
Copy the file 1 to the file path |
Rename old file name new file name |
Rename a file (old file name changed to new file name) |
MV Files 1 Files 2 |
File Cut command (cut file 1 to file 2)) |
Vim Editor Commands
On Linux, all the operations are done through the terminal. In writing the program, you need to enter the code into a file, because there is no graphical interface, no mouse, so the first touch when the operation will feel a little trouble. But it took a long time to get used to it.
Vim is a command-line text Editing tool, using the vi file name, enter after the file can be edited.
The Vim editor is available in three modes, and different commands can be placed in different modes.
- Action mode: Action mode is mainly used in some common text operations, such as moving the cursor, copy the text, paste, cut operation. Keystrokes entered in action mode are not displayed in the editor.
- Edit mode: The edit mode is just like the normal text editor, and the keystrokes entered are all entered into the editor.
- Command mode: Provides some powerful features of the editor.
Command |
Function |
Esc |
Enter action mode (common) |
h or arrow key ← |
Move the cursor to the left (active in action mode) (common) |
l or direction key → |
Move the cursor to the right (active in action mode) (common) |
J or Arrow key ↓ |
Move cursor down (active in action mode) (common) |
K or arrow key ↑ |
Move cursor up (active in action mode) (common) |
0 (number 0) (common) |
Moves the cursor to the beginning of the current line ( valid in action mode) |
$ (common) |
Moves the cursor to the end of the current line (valid in action mode) |
GG (Common) |
Moves the cursor to the beginning of the first line of the file (valid in action mode) |
G (Common) |
Moves the cursor to the last line of the file (valid in action mode) |
H |
Move the cursor to the top row of the screen (active in action mode) |
M |
Move the cursor to a line in the middle of the screen (active in action mode) |
L |
Move the cursor to the bottom line of the screen (active in action mode) |
/String |
Find and navigate to the location where the string appears, |
Digital GG (Common) |
For example, 20GG is to move the cursor to line 20th 11gg is to move the cursor to line 11th (Active in action mode) |
W (Common) |
Move the cursor to the beginning of the next space (active in action mode) |
B (Common) |
Moves the cursor to the beginning of the previous space (valid in action mode) |
X (Common) |
Cut one character below the current cursor |
DD (Common) |
Cut one line |
Yy |
Copy a row |
P (Common) |
Paste content after the current cursor position |
P (uppercase) (common) |
Paste the contents before the current cursor |
J |
Merges the current row and the next row into a single line |
R |
Replace the character under the current cursor (you can enter a character to replace it) |
I |
Enter edit mode and type in the previous character at the current cursor |
A |
enters edit mode and enters the next character at the current cursor |
I |
Enter edit mode and enter at the beginning of the current line |
A |
go to edit mode and enter at the end of the current line |
O |
Enter edit mode , starting at the next line of the current line |
O |
Enter edit mode , starting at the top line of the current line |
: (colon) |
Enter Command mode |
W |
Save File |
Q |
Exit the VIM editor |
Q! |
Force exit from the Vim editor without saving the file |
These commands are described in more detail in << 's Linux private dishes >> this book:
Or you can go to the bird's website. read: http://linux.vbird.org/
Other System commands
Apt-get is an advanced Package manager on Ubuntu, and many of the software under Ubuntu can be installed with this command. This command has a lot of parameters, passing in different parameters will do different things
Parameters |
Function |
Update |
Re-fetch the package list () |
Upgrade |
To update |
Install software name |
Install a software |
Remove software Name |
Uninstalling software that has already been installed |
Autoremove |
Automatic removal of all unused packages |
002-Learn C language on your Android phone-linux Getting started with the program World Portal-operating system