It's been a long time since the last article was published. In the past six months, although the code is not much, but in contact with the computer some other knowledge, including the database, the network, the feeling can digest, write code level and have a certain improvement. Next, we will publish a few articles, a brief introduction to some of the techniques I know.
Installation and use of 1.PostgreSQL
PostgreSQL is a very useful open source free database, powerful, especially for the GIS practitioners, and PostGIS with the combination can have a very strong spatial database function.
Its official website: https://www.postgresql.org/
Official Help: Https://help.ubuntu.com/community/PostgreSQL
The first is the need to upgrade the software accessories, which is also described earlier:
1 apt-get update2 apt-get upgrade
The next step is to download PostgreSQL with the following command:
sudo Install PostgreSQL
During installation, a postgres default account is created automatically, and various SQL commands can be executed under the account.
To access this account, the command is as follows:
sudo -i-u postgres
You can now see that the command line has become a postgres account.
In the current Postgres user mode, you can use the Create, delete database. The command is as follows:
Createdb database_namedropdb database_name
In this mode, the main operation is the database.
After the database is created, to execute SQL statements against the tables in the database, you need to enter the database's operating interface. The command is as follows:
Psql database_name
At this point you can see that the command line has changed:
database_name=#
After that, you can enter the SQL statement.
It is important to note that each SQL statement must end with a semicolon or it will not be executed.
If you need to exit such a mode, enter the previous Postgres user's mode, just enter the following command:
\q
2. Viewing and closing of processes
The process of completing the review is primarily using the PS command. The options included are:
-e: View All Processes
-aux: See all the processes again
A,-a: Viewing the current user's process
What I use the most is:
PS -aux
If you want to end a process, you can use the KILL command, using the following:
Kill Pid
The PID can be followed by the specific process.
3. Editor's God Vim Primer
At the moment I've only learned the most basic uses of vim, but that's not enough, and this part is going to be constantly updated.
Vim is divided into normal mode, insert mode, command mode, visual mode, and replacement mode.
Normal mode is a different mode to create a transit station, want to enter the other mode is the first need to enter the normal mode. This is also the most important mode. The method is to press the ESC key.
In normal mode, you can use a variety of shortcut keys to complete some simple word processing tasks:
H,j,k,l are left, move up, move down, Move Down
x Delete the letter where the cursor is located
C Delete the letter at the cursor position and enter insert mode
DD Delete (cut) the bank
CC Delete Bank and enter insert mode
YY Copy Bank
PP Paste Bank
Any one of these shortcuts is a number that represents the number of executions before they are added. For example: Move up 10 rows of =10j and delete the bank's 10 lines =10DD
DW deletes the first word starting at the cursor (excluding the cursor letter)
De deletes the first word starting from the cursor (including the cursor letter)
d$ Delete starts from the cursor until the end of the bank
Cw,ce Delete the first word from the cursor and enter insert mode
C $ Delete starts from the cursor until the end of the bank and enters insert mode
GG arrives at the first line of the document
G arrives at the last line of the document
Ctrl+g View the current number of rows
/{0} Enter a specific string in/after which you can find a matching string closest to the cursor, press N to find the next, press N to find the previous
The way to remember the functions of the above letters is to associate English words, for example:
C=clear
D=delete
W=word
Y,p=copy
Insert mode is the normal writing mode. The way to enter insert mode from normal mode is as follows:
I start typing before the cursor letter
I start typing from the bank
A starts typing after the cursor letter
A from the bank last input
o Input from below bank
O input from above bank
Command mode can handle file-related commands. The way to enter command mode is to enter in normal mode: you can
: W Save File
: q! Exit does not save
: Wq Save and exit
: Sp/home/test.txt split screen Open home directory under Text.txt file
Lenovo Memory:
W=write
Q=quit
Sp=seperate
The visual mode is mainly used to select. Enter by entering V in normal mode. After similar to the normal mode, the control HJKL moves, selects the specific content, then uses the d,y and so on can realize the deletion, the cut, the copy and so on function.
The replacement pattern is similar to Word's substitution pattern, where the input letter replaces the original letter. Ways to enter replacement mode from Normal mode:
R replaces the letter where the cursor is located
R replaces all letters starting with the cursor
Ubuntu Learning Summary (ii) Use of PostgreSQL, process view off, editor of God vim Introduction