Yuav Ua Li Cas Tsim thiab Kho Cov Ntawv Cov Ntaub Ntawv hauv Linux Siv Terminal

Cov txheej txheem:

Yuav Ua Li Cas Tsim thiab Kho Cov Ntawv Cov Ntaub Ntawv hauv Linux Siv Terminal
Yuav Ua Li Cas Tsim thiab Kho Cov Ntawv Cov Ntaub Ntawv hauv Linux Siv Terminal

Video: Yuav Ua Li Cas Tsim thiab Kho Cov Ntawv Cov Ntaub Ntawv hauv Linux Siv Terminal

Video: Yuav Ua Li Cas Tsim thiab Kho Cov Ntawv Cov Ntaub Ntawv hauv Linux Siv Terminal
Video: Python! Extracting Text from PDFs 2024, Hlis ntuj nqeg
Anonim

Qhov wikiHow qhia koj yuav siv Terminal daim ntawv thov ntawm Linux los tsim cov ntawv ntawv. Tom qab ntawd, koj tuaj yeem siv ib qho ntawm Linux cov kev tsim kho cov ntawv hloov kho cov ntaub ntawv.

Kauj ruam

Ntu 1 ntawm 4: Qhib Terminal

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 1
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 1

Kauj Ruam 1. Qhib Terminal

Yuav ua li cas, nyem Ntawv qhia zaub mov, thiab saib rau Terminal app icon, uas yog lub npov dub nrog lub xim dawb "> _" cim sab hauv. Nyem lub cim thaum koj pom nws. Feem ntau, Lub davhlau ya nyob twg nyob rau ntawm qhov bar ntawm sab laug ntawm Cov Ntawv Qhia Qhov rai.

Koj tseem tuaj yeem nyem qhov tshawb fawb bar nyob rau sab saum toj ntawm Cov Ntawv Qhia zaub mov thiab ntaus hauv lub davhlau ya nyob twg kom pib tshawb nrhiav

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 2
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 2

Kauj Ruam 2. Ntaus ls rau hauv Terminal, tom qab ntawd nyem Enter

Lub davhlau ya nyob twg yuav qhib rau koj phau ntawv teev npe hauv tsev, tab sis qhov hais kom ua ls qhia tag nrho cov ntawv tais ceev tseg hauv koj phau ntawv teev npe tam sim no. Txhawm rau tsim cov ntawv sau hauv ib qho ntawm cov npe no, koj yuav tsum hloov pauv cov npe tam sim no.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 3
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 3

Kauj Ruam 3. Nrhiav cov npe uas koj xav thauj cov ntawv

Txhua lub npe teev npe nyob hauv qab ls hais kom ua (piv txwv li "Desktop") yog qhov chaw koj tuaj yeem mus.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal 4
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal 4

Kauj Ruam 4. Ntaus hauv cd phau ntawv teev npe

Koj yuav hloov lub npe "npe" nrog cov npe uas xav tau. Cov lus txib no hloov Terminal los ntawm cov npe tam sim no mus rau ib lub npe uas koj tsim.

  • Piv txwv li, ntaus cd Desktop los hloov qhov chaw ntawm Terminal hais kom mus rau Desktop directory.
  • Yog tias koj xav tsim cov ntawv sau hauv cov ntawv tshwj xeeb hauv cov npe xaiv, suav nrog "/" cim tom qab phau ntawv teev npe thiab ntaus lub npe ntawv. Piv txwv li, ntaus cd Cov Ntaub Ntawv/Lwm Tus los tsim "Lwm Tus" cov npe hauv Cov Ntawv Teev Npe.
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 5
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 5

Kauj Ruam 5. Nias Sau

Qhov no yuav ua tiav koj cov lus txib, thiab Terminal lub hom phiaj cov npe yuav hloov los ntawm cov npe hauv tsev mus rau cov npe uas koj tau teev tseg.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 6
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 6

Kauj Ruam 6. Xaiv qhov program kho cov ntawv

Koj tuaj yeem tsim cov ntawv yooj yim cov ntaub ntawv sai, lossis koj tuaj yeem siv Vim lossis Emacs los tsim thiab kho cov ntawv cov ntawv hauv qhov tob dua. Thaum koj nyob hauv cov npe uas koj xav kom koj cov ntawv sau ua, nws yog lub sijhawm los tsim koj cov ntawv cov ntawv.

Ntu 2 ntawm 4: Tsim Cov Ntawv Cov Ntaub Ntawv sai

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 7
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 7

Kauj Ruam 1. Hom

miv> filename.txt

mus rau Terminals

Koj yuav hloov "npe" nrog cov ntawv xav tau lub npe ntawv (piv txwv li "qauv").

Piv txwv li: thaum tsim cov ntawv hu ua "miv", ntaus miv> cat.txt

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 8
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 8

Kauj Ruam 2. Nias Sau

Yog li, cov ntawv sau tshiab nrog lub npe tshwj xeeb yuav tshwm nyob rau hauv cov npe tam sim no. Koj tus cursor yuav tshwm ntawm kab dawb paug hauv Terminal.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 9
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 9

Kauj Ruam 3. Sau cov ntawv sau

Koj tuaj yeem ntaus ib txwm zoo li lwm cov ntawv sau. Txhawm rau khaws cov kab ntawv tam sim no thiab txav mus rau kab tom ntej, nyem Enter.

Yog tias koj phau ntawv teev npe cov ntaub ntawv qhib, thov ob npaug nyem rau ntawm kab ntawv thaum nws zoo li qhib nws

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 10
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 10

Kauj Ruam 4. Nias Ctrl+Z

Qhov luv luv no khaws koj txoj haujlwm thiab xa koj rov qab mus rau Terminal kab lus txib kom koj tuaj yeem txuas ntxiv nkag mus rau cov lus txib.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 11
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 11

Kauj Ruam 5. Hom

ls -l filename.txt

mus rau Terminals

Koj yuav hloov "filename" nrog lub npe ntawm koj cov ntawv sau. Cov lus txib no yuav tshawb nrhiav koj cov ntaub ntawv, thiab xyuas kom lawv muaj kev nyab xeeb khaws cia hauv koj phau ntawv teev npe.

  • Piv txwv li: qhib cov ntaub ntawv npe "textfile", thov ntaus ls -ltextfile.txt.
  • Cov tsiaj ntawv hauv tus lej no yog tus ntawv me "L", tsis yog tus ntawv "i".
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 12
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 12

Kauj Ruam 6. Nyem Sau

Qhov no yuav qhia lub sijhawm, hnub tim, thiab lub npe ntawm koj cov ntaub ntawv mus rau kab tom ntej qhia tias koj tsim thiab khaws cov ntaub ntawv hauv koj phau ntawv teev npe.

Ntu 3 ntawm 4: Siv Vim

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 13
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 13

Kauj Ruam 1. Hom

vi filename.txt

mus rau Terminals

Qhov "vi" ib feem ntawm qhov lus txib no xaiv Vim li qhov kev hloov kho kab ntawv. Koj yuav hloov "npe" nrog lub npe ntawm cov ntawv tshiab uas koj xav tau.

  • Piv txwv li, rau cov ntaub ntawv npe "tamin", thov ntaus vi tamin.txt.
  • Yog tias koj cov npe tam sim no muaj cov ntaub ntawv nrog tib lub npe, cov lus txib no yuav qhib cov ntawv.
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 14
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 14

Kauj Ruam 2. Nias Sau

Cov ntaub ntawv tshiab yuav raug tsim thiab qhib hauv Vim editor. Koj yuav pom lub qhov rai Terminal dawb paug nrog lub cim (~) ntawm txhua kab, nrog rau cov ntawv sau npe nyob hauv qab ntawm lub qhov rais.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 15
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 15

Kauj Ruam 3. Nias tus yuam sij i ntawm cov keyboard

Qhov no yuav muab cov ntawv tso rau hauv "Ntxig" hom, thiab koj tuaj yeem nkag cov ntawv raws li xav tau.

koj yuav pom - NTSE- tshwm nyob rau hauv qab ntawm lub qhov rais thaum nias tus yuam sij Kuv.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 16
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 16

Kauj Ruam 4. Sau cov ntawv ntawm koj daim ntawv

Koj tuaj yeem ntaus ib txwm zoo li lwm cov ntawv sau. Txhawm rau khaws cov kab ntawv tam sim no thiab txav mus rau kab tom ntej, nyem Enter.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 17
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 17

Kauj Ruam 5. Nias tus yuam sij Esc

Tus yuam sij no feem ntau yog nyob rau ntawm kaum-sab laug ntawm lub computer keyboard. Lub pob no yuav muab Vim rau hauv "Command" hom (hais kom ua).

Koj yuav pom tus cursor tshwm nyob rau hauv qab ntawm lub qhov rais

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 18
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 18

Kauj Ruam 6. Hom

w: xav

mus rau Terminal thiab nias Nkag mus.

Cov lus txib no yuav khaws cov ntaub ntawv zoo li nws yog.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 19
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 19

Kauj Ruam 7. Hom

q: qav

mus rau Terminal thiab nias Nkag mus.

Qhov no yuav cia koj tawm Vim thiab rov qab mus rau lub davhlau ya nyob twg lub ntsiab interface. Koj cov ntawv sau tam sim no nyob hauv cov npe teev tseg.

  • Koj tuaj yeem tshawb xyuas cov ntawv cov ntawv los ntawm kev ntaus ls rau hauv Terminal thiab nias Enter thiab tom qab ntawd tshawb rau cov ntawv sau npe.
  • Koj kuj tseem tuaj yeem ntaus ntawv: wq kom txuag tau cov ntaub ntawv thiab tawm Vim hauv ib lo lus txib.
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 20
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 20

Kauj Ruam 8. Rov qhib cov ntaub ntawv los ntawm Terminal qhov rai

Raws li thaum tsim cov ntawv, ntaus vi filename.txt qhib cov ntawv. Lub sijhawm no, thaum koj qhib cov ntawv, koj yuav pom txhua qhov kev hloov pauv uas tau ua yav tas los.

Ntu 4 ntawm 4: Siv Emacs

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 21
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 21

Kauj Ruam 1. Hom

npe emacs.txt

mus rau Terminals

Koj yuav hloov "npe" nrog cov ntawv xav tau lub npe ntawv.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 22
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 22

Kauj Ruam 2. Nias Sau

Muab hais tias lub npe ntawm koj cov ntawv sau tsis sib xws nrog cov ntawv sau uas twb muaj lawm hauv cov npe tam sim no, cov ntawv tshiab yuav qhib rau hauv Emacs editor.

  • Piv txwv li, cov ntaub ntawv npe "newfile" tuaj yeem qhib los ntawm kev ntaus emacs newfile.txt.
  • Yog tias koj nkag lub npe ntawm cov ntaub ntawv uas twb muaj lawm hauv phau ntawv teev npe, cov lus txib no yuav qhib cov ntawv.
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 23
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 23

Kauj Ruam 3. Paub txog Emacs cov lus txib

Emacs los nrog ntau cov lus txib muaj txiaj ntsig uas tso cai rau koj saib cov ntaub ntawv, nrhiav cov ntaub ntawv cuam tshuam lossis pab, siv cov ntawv, thiab nkag siab koj cov cai. Cov lus txib no poob rau hauv ob pawg: Tswj cov lus txib thiab Meta cov lus txib.

  • Tswj Command sau zoo li no: C-. Txhawm rau tswj qhov kev hais kom ua, tuav tus yuam sij Ctrl thiab nias qhov xav tau tus lej tseem ceeb tib lub sijhawm. (piv txwv li Ctrl thiab A yuam sij).
  • Meta hais kom ua (los yog Kev khiav tawm) tau sau raws li hauv qab no: M- lossis ESC. Tsab ntawv "M" hais txog alt="Duab" lossis Esc qhov tseem ceeb ntawm cov keyboard vim tias tsis yog txhua lub khoos phis tawj muaj tus yuam sij Alt.
  • Cov lus txib Meta tau sau zoo li no: Ca b (lossis Ma b) thiab koj yuav tsum tuav Ctrl (lossis alt="Duab" lossis Esc) thaum nias thawj tus yuam sij (piv txwv li a), tom qab ntawd tso ob lub yuam sij thiab nias tam sim tus yuam sij thib ob ((b).
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 24
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 24

Kauj Ruam 4. Sau cov ntawv sau

Koj tuaj yeem ntaus ib txwm zoo li lwm cov ntawv sau. Txhawm rau txuag kab tam sim no thiab txav mus rau kab tom ntej, nyem Enter.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 25
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 25

Kauj Ruam 5. Nias Ctrl+X, ces nias S kom txuag koj cov ntaub ntawv.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 26
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 26

Kauj Ruam 6. Nias Ctrl+X, ces nias Ctrl+C.

Qhov no yuav cia koj tawm ntawm Emacs cov ntawv sau thiab rov qab mus rau phau ntawv teev npe hauv Terminal. Koj cov ntawv sau yuav tsum tau khaws tseg hauv qab lub npe koj xaiv thiab nyob hauv phau ntawv teev npe no.

Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 27
Tsim thiab Kho Cov Ntawv Cov Ntawv hauv Linux los ntawm Kev Siv Terminal Kauj Ruam 27

Kauj Ruam 7. Rov qhib cov ntawv

Txhawm rau ua qhov no, tsuas yog ntaus emacs filename.txt rau hauv Terminal. Tsuav koj nyob hauv cov npe tib yam li cov ntawv, cov ntawv sau yuav qhib hauv Emacs. Koj tuaj yeem txuas ntxiv kho, yog tias koj xav tau.

Lub tswv yim

  • Vim yog qhov program uas feem ntau siv tau ntawm txhua lub Linux version, thaum Emacs yog tus neeg siv yooj yim dua los kho kom yooj yim rau cov pib siv.
  • Koj tuaj yeem qhib qhov "Pab" qhov rai hauv Emacs los ntawm kev nias Ctrl+H, tom qab ntawd tso ob lub yuam sij thiab tam sim ntawd nias T. Cov ntawv qhia zaub mov Pab qhia ntxiv cov lus txib yuam sij thiab lwm yam haujlwm hauv Emacs editor uas tuaj yeem pab raws li koj sau.

Pom zoo: