Terminal yog ib daim ntawv thov uas muab rau koj nkag mus rau Mac sab hauv ua haujlwm ntawm kab hais kom ua (CLI). Siv cov app no ua rau koj muaj peev xwm ua tau ntau yam kev hloov pauv rau lub operating system uas tsis muaj los ntawm graphical user interface (GUI). Nws feem ntau tsis yog rau cov neeg siv khoom nruab nrab. Hloov chaw, nws ua haujlwm zoo rau cov neeg siv hluav taws xob thiab cov tsim tawm.
Tseem, yog tias koj xav paub, kab lus no qhia koj yuav ua li cas qhib Terminal ntawm Mac thiab siv cov lus txib yooj yim.
Cov lus qhia hauv kab lus no tau qhia siv macOS 10.15 Catalina. Cov lus txib yuav tsum siv rau hauv Terminal ntawm txhua lub computer Mac.
Terminal yog dab tsi?
Terminal yog emulator muab cov kab hais kom ua. Nws zoo ib yam li PowerShell hauv Microsoft Windows, uas hloov Command Prompt (MS-DOS) hauv xyoo 2017. macOS yog raws li Unix operating system thawj zaug tsim los ntawm AT&T rau Tswb System. Terminal siv lub plhaub Bash los ntawm lub neej ntawd.
Ib "plhaub" yog lwm lo lus rau kev sib txuas, txawm tias nws yog cov ntawv nyeem lossis tag nrho ntawm cov duab. Txij li thaum Terminal emulates cov kab hais kom ua ib puag ncig, lub plhaub tsim qhov pom kev cuam tshuam hauv qhov emulation. Rau macOS, lub plhaub qub yog Bash (Bourne-Dua Plhaub), txawm tias koj tuaj yeem hloov mus rau Z Plhaub (los yog zsh) siv cov lus txib.
Txhua yam koj pom hauv macOS stems los ntawm cov neeg siv graphical interface. Tsis yog nkag mus rau cov lus txib, koj muaj qhov rais tswj hwm los ntawm nas thiab keyboard. Touchscreens, gestures, cwj mem digital, thiab lwm yam ua rau kev sib cuam tshuam yooj yim dua. Vim li cas thab typing commands mus rau hauv ib tug laus-tsev kawm ntawv interface?
Cov lus piav qhia yooj yim yog koj tuaj yeem ua txhua yam siv cov lus txib, xws li hloov qhov chaw cia khoom rau koj lub screenshots, ua si ua si, ua Mac tham, qhia cov folders zais, thiab ntau dua. Qhov tseem ceeb tshaj, cov lus txib tau nrawm dua vim tias lawv tau ncaj qha.
GUI tsim tag nrho macOS windows thiab menus, txawm li cas los xij, lub hom phiaj yooj yim thiab yooj yim, tsis nrawm. Thaum koj tab tom rub cov ntaub ntawv los ntawm lub qhov rais mus rau qhov rais, siv kab hais kom ua tib yam txav yuav nrawm dua.
Yuav qhib Terminal
Terminal feem ntau nyob ntawm Dock. Lub cim zoo ib yam li cov kab lus hais kom ua kab lus nrog dawb > (ntau dua) lub cim teeb tsa tawm tsam keeb kwm dub.
Koj tuaj yeem nkag mus rau Terminal app los ntawm Launchpad.
-
Nias lub " foob pob hluav taws" icon nyob rau ntawm Dock. Qhov no qhib lub MacOS Launchpad.
-
Click the Other folder.
-
Click the Terminal app.
Command Basics
Ntawm no yog ob peb lub ntsiab lus pib pib. Lawv yog cov lus ua xws li luam, txav, thiab sau npe. Qee qhov no tsis siv hauv cov piv txwv hauv qab no. Hloov chaw, daim ntawv teev npe no tsuas yog qhia txog yuav ua li cas cov lus txib pib.
Tsis muaj qhov yooj yim "undo" rau cov lus txib davhlau ya nyob twg, yog li xyuas kom koj siv qhov no ua ntej yuav hloov pauv koj lub cev.
- cat - Sau cov ntsiab lus ntawm cov ntaub ntawv lossis folder
- cd - zoo li DOS, siv cov lus txib no los hloov cov npe
- cp - Luam ib cov ntaub ntawv lossis folder
- defaults - Cov lus txib no hloov chaw tsis tau teev nyob rau hauv Preferences
- ls - cov lus txib no teev cov npe cov ntsiab lus
- mkdir - Ua ib daim ntawv teev npe
- mv - Tsiv cov ntaub ntawv lossis folder
- nano - Qhib Terminal editor
- ssh - luv rau Secure Plhaub, cov lus txib no tsim kev ruaj ntseg encrypted kev sib txuas ntawm ob lub tswv.
- sudo - hloov kho koj cov lus txib nrog kev tswj hwm (superuser) cov cai thiab xav tau tus password. Ceev faj, txawm li cas los xij, raws li cov lus txib tsis raug tuaj yeem ua rau macOS puas thiab yuav tsum tau nruab tshiab.
Commands Kom Tau Koj Pib
Ntawm no yog cov lus txib lom zem thiab muaj txiaj ntsig los pib koj. Cov no suav nrog ua kom koj Mac tsaug zog, saib ASCII version ntawm Star Wars Episode IV, thiab ob peb lwm tus.
Txhawm rau ua cov lus txib no, koj yuav tsum ua kom tiav los ntawm nias tus yuam sij Enter. Peb tau sau tus yuam sij no hauv cov lus txib uas xav tau ntau dua ib qho nkag.
Saib Cov Ntsiab Lus ntawm Cov Ntaub Ntawv lossis Phau Ntawv Qhia
Qhov no yog qhov yooj yim yog tias koj xav pom cov ntsiab lus ntawm ZIP cov ntaub ntawv lossis ua tiav ua ntej nws tsis ntim. Ntxig koj cov ntaub ntawv lossis qhov chaw khaws cia tom qab ~ (tilde) cim.
cat ~/file/path/here
Txhob hloov tshiab zaus
Tus lej kawg yog suav nrog pes tsawg hnub uas Mac yuav tos los kuaj xyuas qhov hloov tshiab. MacOS feem ntau kuaj ib zaug ib lub lim tiam, yog li tus lej pib yog 7 thaum kawg. Hauv qhov piv txwv no, Mac yuav kuaj ib hnub ib zaug.
defaults sau com.apple. SoftwareUpdate ScheduleFrequency -int 1
Kawm koj Mac Awake
Vim koj Mac haus tsis tau kasfes, txoj hauv kev zoo tshaj plaws tom ntej kom nws tsaug zog yog pub nws cov lus txib caffeinated. Qhov no yuav yuam kom nws tsaug zog tas mus li.
Caffeinate
Txhawm rau nres, ntaus tus CTRL + C tus yuam sij.
Yog tias koj xav kom koj Mac tsaug zog rau lub sijhawm tshwj xeeb, siv cov piv txwv hauv qab no. Ntawm no peb xaiv 250,000 vib nas this (uas tsis yog peb hnub rau cov uas xav paub).
Caffeinate -t 250000
Saib cov ntawv nyeem ntawm Star Wars: Kev Cia Siab Tshiab
Nov yog kev lom zem xwb. Tej zaum koj yuav tsis zaum ntawm tag nrho cov yeeb yam, tab sis nws yog qhov zoo heev uas tau pom cov yeeb yaj kiab classic no siv cov yeeb yaj kiab ASCII zoo li koj nyob rau xyoo 1980s.
nc towel.blinkenlights.nl 23
Hloov lub Screenshot Format
defaults sau com.apple.screencapture type jpg
Hloov lub Default Screenshot Name
MacOS txuag cov screenshots nrog hnub thiab sijhawm teev nyob rau hauv cov ntaub ntawv npe. Siv cov lus txib no los tsim lub npe cov ntaub ntawv uas tsis yog dab tuag thiab ntev.
defaults sau com.apple.screencapture name "New Screen Shot Name"
Hloov qhov screenshot Txuag qhov chaw
Screenshots txuag rau lub desktop los ntawm lub neej ntawd. Siv cov lus txib no los hloov lub hom phiaj cia qhov chaw, zoo li ib daim nplaub tshev tshwj xeeb.
defaults sau com.apple.screencapture qhov chaw ~/your/location/here
nias tus Enter tus yuam sij.
killall SystemUIServer
Txhob Tso Duab Ntxoo Tso Duab Ntxoo
Yog tias koj thaij duab ntawm lub qhov rais qhib siv Command + Shift + 4 + Spacebar hais kom ua, MacOS ntxiv tus duab ntxoov ntxoo poob thaum koj nyem rau ntawm qhov rais ntawd. Yog tias koj tsis xav tau qhov txiaj ntsig no, siv cov lus txib hauv qab no:
defaults sau com.apple.screencapture disable-shadow -bool TRUE; killall SystemUIServer
Txhawm rau rov qhib cov nyhuv, ntaus cov lus txib no:
defaults sau com.apple.screencapture disable-shadow -bool FALSE; killall SystemUIServer
Chime Zoo li iPhone txuas rau fais fab
Nov yog kev lom zem me ntsis rau cov tswv iPhone.
defaults sau com.apple. PowerChime ChimeOnAllHardware -bool TRUE; qhib /System/Library/CoreServices/PowerChime.app
Txhawm rau kaw lub chime, ntaus cov hauv qab no thiab nias Enter:
defaults sau com.apple. PowerChime ChimeOnAllHardware -bool FALSE; killall PowerChime
Ua koj Mac hais lus
Qhov no ua haujlwm tsis muaj lub hom phiaj tsuas yog ua kom lom zem rau menyuam yaus nrog Mac lub suab tshuab. Koj tsis tas yuav cov lus hais hauv cov lus txib. (Nco ntsoov hloov cov kab lus hauv cov lus hais nrog txhua yam koj xav kom lub computer hais.)
Hais "Tau koj cov kab lus zoo ntawm no"
Download Files from the Internet
Tsis xav rub tawm cov ntaub ntawv siv browser? Siv txoj kev no xwb.
cd ~/Downloads/
Nias lub Enter thiab sau cov lus txib no. Nyem qhov Enter dua ib zaug koj tau nkag mus rau qhov hais kom ua.
curl -O