Skip to content

Instantly share code, notes, and snippets.

@miftahafina
Last active May 28, 2021 03:59
Show Gist options
  • Save miftahafina/fa897a30bc740add8c64e50f62925ccf to your computer and use it in GitHub Desktop.
Save miftahafina/fa897a30bc740add8c64e50f62925ccf to your computer and use it in GitHub Desktop.
Tar Linux Cheat Sheet
# Membuat arsip
tar -cvf arsip.tar ~/nama-folder
tar -cvzf arsip.tar.gz ~/nama-folder
tar -cvjf arsip.tar.bz2 ~/nama-folder
# Ekstrak arsip
tar -xvf arsip.tar
tar -xvf arsip.tar.gz
tar -xvf arsip.tar.bz2
tar -xvf arsip.tar.bz2 -C ~/folder-hasil-ekstrak
# Menampilkan daftar isi arsip
tar -tvf arsip.tar
tar -tvf arsip.tar.gz
tar -tvf arsip.tar.bz2
# Ekstrak sebuah file dari arsip
tar -xvf arsip.tar namafolder/namafile.md
tar -zxvf arsip.tar.gz namafolder/namafile.md
tar -jxvf arsip.tar.bz2 namafolder/namafile.md
# Ekstrak beberapa file dari arsip
tar -xvf arsip.tar "namafolder/namafile1.md" "namafolder/namafile2.md"
tar -zxvf arsip.tar.gz "namafolder/namafile1.md" "namafolder/namafile2.md"
tar -jxvf arsip.tar.bz2 "namafolder/namafile1.md" "namafolder/namafile2.md"
# Ekstrak beberapa file dengan pattern
tar -xvf arsip.tar --wildcards '*.md'
tar -zxvf arsip.tar.gz --wildcards '*.md'
tar -jxvf arsip.tar.bz2 --wildcards '*.md'
# Menambahkan file ke arsip
tar -rvf arsip.tar namafile3.md
tar -rvf arsip.tar namafolder2
tar -rvf arsip.tar namafolder2/namafile3.md
Ket: hanya bisa untuk .tar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment