Yuav Hloov PATH Hloov Li Cas ntawm Linux: 5 Kauj Ruam (nrog Duab)

Cov txheej txheem:

Yuav Hloov PATH Hloov Li Cas ntawm Linux: 5 Kauj Ruam (nrog Duab)
Yuav Hloov PATH Hloov Li Cas ntawm Linux: 5 Kauj Ruam (nrog Duab)

Video: Yuav Hloov PATH Hloov Li Cas ntawm Linux: 5 Kauj Ruam (nrog Duab)

Video: Yuav Hloov PATH Hloov Li Cas ntawm Linux: 5 Kauj Ruam (nrog Duab)
Video: Kev Hlub Ntxuav Kev Chim - Part 1 2024, Hlis ntuj nqeg
Anonim

Cov txheej txheem ua haujlwm feem ntau siv kev hloov pauv ib puag ncig txhawm rau txheeb xyuas ntau yam kev teeb tsa hauv ntiaj teb uas cuam tshuam rau ib feem ntawm qhov system, lossis los tswj cov ntawv thov. PATH qhov sib txawv yog ib qho ntawm qhov hloov pauv ib puag ncig, thiab feem ntau siv tsis muaj tus neeg siv kev paub. Qhov sib txawv no tuav cov npe ntawm cov npe uas yuav siv los ntawm daim ntawv thov (tshwj xeeb yog cov plhaub) txhawm rau tshawb nrhiav cov lus txib.

Kauj ruam

Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 1
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 1

Kauj Ruam 1. Paub cov ntsiab lus ntawm PATH sib txawv los ntawm kev nkag mus rau qhov hais kom ua "ncho $ PATH" hauv lub plhaub qhov rai

Koj yuav pom cov npe ntawm cov npe raws li qhov piv txwv hauv qab no:

  • uzair@linux: ~ $ ncha $ PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games
  • Nco tseg: phau ntawv teev npe hauv $ PATH kuj sib txawv tau muab cais los ntawm ":".
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 2
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 2

Kauj Ruam 2. Ntxiv cov npe ":

/sbin "thiab":/usr/sbin "ib ntus rau PATH cov npe nrog cov lus txib hauv qab no:

uzair@linux: ~ $ export PATH = $ PATH:/sbin/:/usr/sbin/

Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 3
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 3

Kauj Ruam 3. Muab cov ntsiab lus ntawm PATH sib txawv los lees paub tias qhov kev hloov pauv tau tshwm sim

  • uzair@linux: ~ $ ncha $ PATH/tsev/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
  • Nco ntsoov tias cov kev hloov pauv saum toj no tsuas yog ib ntus thiab yuav ploj mus thaum lub khoos phis tawj rov pib dua.
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 4
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 4

Kauj Ruam 4. Sim khiav lub app uas nyob hauv PATH tshiab kom ntseeg tau tias koj qhov kev hloov pauv tsis ua teeb meem

Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 5
Hloov Txoj Kev Hloov pauv hauv Linux Kauj Ruam 5

Kauj Ruam 5. Hloov PATH qhov sib txawv mus tas li los ntawm kev nkag tib kab rau hauv ~/.bashrc cov ntaub ntawv

Pom zoo: