Pipes — joining commands · Pipe — menggabungkan perintah
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Halaman ini memerlukan browser terbaru (dengan dukungan SharedArrayBuffer). Silakan perbarui Chrome, Edge, Firefox, atau Safari ke versi terbaru.
English
The big idea: pipes
- This is what makes the shell powerful. A pipe
|sends one command's output straight into the next command:
catproduces the lines;sortreceives them and puts them in order. No file in between.
Bahasa Indonesia
Gagasan besar: pipes
- Inilah yang membuat shell menjadi kuat. Pipe
|mengirimkan output satu perintah langsung ke perintah berikutnya:
cat fruits.txt | sort
catmenghasilkan baris-baris tersebut;sortmenerimanya dan menyusunnya secara berurutan. Tidak ada file di antaranya.
English
Build a chain
- You can join as many as you like, like an assembly line:
sortorders the lines, thenuniqremoves neighbouring duplicates — so you get each fruit once.
Bahasa Indonesia
Bangun rantai
- Anda dapat menggabungkan sebanyak yang Anda inginkan, seperti jalur perakitan:
cat fruits.txt | sort | uniq
sortmengurutkan baris-baris, laluuniqmenghapus duplikat bertetangga — sehingga Anda mendapatkan setiap buah hanya sekali.
English
Small tools, big results
- Each command does one job well. Pipes let you combine them to answer real questions:
- "How many different fruits are there?" — sort, dedupe, then count. That is the Unix way.
Bahasa Indonesia
Alat kecil, hasil besar
- Setiap perintah melakukan satu pekerjaan dengan baik. Pipe memungkinkan Anda menggabungkannya untuk menjawab pertanyaan nyata:
cat fruits.txt | sort | uniq | wc -l
- "Berapa banyak buah berbeda yang ada?" — urutkan, hilangkan duplikat, lalu hitung. Itulah cara Unix.
English
Common mistakes
|sends one command's output into the next.- Order matters:
sort | uniq, not the other way round.
Bahasa Indonesia
Kesalahan umum
|mengirimkan output satu perintah ke perintah berikutnya.- Urutan itu penting:
sort | uniq, bukan sebaliknya.
Explore · Jelajahi
Pipes join commands · Pipe menggabungkan perintah
A pipe feeds one command's output into the next's input. · Pipe mengalirkan output satu perintah ke input perintah berikutnya.
Send the output of cat fruits.txt into wc -l with a pipe |, to count the lines. · Kirim output dari cat fruits.txt ke wc -l dengan pipe |, untuk menghitung baris.
List each fruit once, in order. Pipe sort into uniq: cat fruits.txt | sort | uniq. · Daftarkan setiap buah sekali, berurutan. Pipe sort ke uniq: cat fruits.txt | sort | uniq.