SATOHOST
No Result
View All Result
Chủ Nhật, Tháng Một 17, 2021
  • Login
  • vps giá rẻ
  • cpanel nulled
  • bitcoin exchange script
  • Home 1
Subscribe
SATOHOST
  • vps giá rẻ
  • cpanel nulled
  • bitcoin exchange script
  • Home 1
No Result
View All Result
SATOHOST
No Result
View All Result
Home Blog

Creating A tar File in Linux Via Command Line Options

admin by admin
Tháng Sáu 3, 2019
in Blog
6 min read
0
152
SHARES
1.9k
VIEWS
Share on FacebookShare on Twitter

How do I create a tar file under Linux using command line options?

You need to use the tar command to create an archive (also known as tar ball) under Linux operating systems. The tar command can create and manipulate archive files. It can even extract files from zip, ar, cpio, shar, ISO 9660 cdrom images, pax and other archives.

What is an archive?

[donotprint][/donotprint]

An archive is nothing but you bundle (put) many files together into a single file on a single tape or disk. You can restore individual files from the archive on any Unix-like systems.

Linux tar command syntax

The syntax is as follows to create a tar file:

tar -cvf output.tar /dirname

tar -cvf output.tar /dirname

OR

tar -cvf output.tar /dirname1 /dirname2 filename1 filename2

tar -cvf output.tar /dirname1 /dirname2 filename1 filename2

OR

tar -cvf output.tar /home/vivek/data /home/vivek/pictures /home/vivek/file.txt

tar -cvf output.tar /home/vivek/data /home/vivek/pictures /home/vivek/file.txt

OR

tar -cvf /tmp/output.tar /home/vivek/data /home/vivek/pictures /home/vivek/file.txt

tar -cvf /tmp/output.tar /home/vivek/data /home/vivek/pictures /home/vivek/file.txt

Where,

  • -c : Create a tar ball.
  • -v : Verbose output (show progress).
  • -f : Output tar ball archive file name.
  • -x : Extract all files from archive.tar.
  • -t : Display the contents (file list) of an archive.

Linux tar Command Examples

Create a tar ball called /tmp/data.tar for /home/vivek/data directory, enter:

tar -cvf /tmp/data.tar /home/vivek/data

tar -cvf /tmp/data.tar /home/vivek/data

To View a Tar Ball Contains (list file inside a tar ball)

Type the following command:

tar -tvf /tmp/data.tar

tar -tvf /tmp/data.tar

To Extract a Tar Ball

Type the following command to extract /tmp/data.tar in a current directory, enter:

tar -xvf /tmp/data.tar

tar -xvf /tmp/data.tar

Type the following command to extract resume.pdf file from an archive called data-backup.tar in a current directory, enter:

tar -xvf data-backup.tar resume.pdf

tar -xvf data-backup.tar resume.pdf

Type the following command to extract pic1.jpg, file1.doc, and foo.mov files from an archive called data-backup.tar in a current directory, enter:

tar -xvf data-backup.tar pic1.jpg file1.doc foo.movf

tar -xvf data-backup.tar pic1.jpg file1.doc foo.movf

Type the following command to extract /tmp/data.tar in a directory called /home/sales/data, enter:

tar -xvf /tmp/data.tar -C /home/sales/data

tar -xvf /tmp/data.tar -C /home/sales/data

How To Backup Files To a Tape Device /dev/st0?

You need to use the combination of mt and tar command to control magnetic tape drive operation.

## Backup /home/ directories to a tape drive called /dev/st0
tar -czf /dev/st0 /home/

## Backup /home/ directories to a tape drive called /dev/st0
tar -czf /dev/st0 /home/

See our previous tutorial “Linux Tape Backup With mt And tar Command Howto” for more information. I also suggest that you read Linux tar(1) command man page for all other syntax and options.

# Additional correction by Khaled Z; Editing by VG – log #

Share on Facebook Twitter

(adsbygoogle = window.adsbygoogle || []).push({});

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Tags: blog
admin

admin

Related Posts

Blog

LINUX BACKUP & RESTORE FULL OS

Tháng Mười Hai 16, 2020
Blog

VPS Ram 4GB Chỉ 199k/tháng Miễn Phí Gsuite,

Tháng Tám 29, 2020
Blog

Tài Khoản Google Drive Unlimited 2020 50k – Google Drive Không Giới Hạn – Google drive unlimited 2020

Tháng Bảy 11, 2020
Bán tài khoản MOVO CASH USA ACCOUNT (VCC+VBA)
Blog

Bán tài khoản MOVO CASH USA ACCOUNT (VCC+VBA)

Tháng Bảy 11, 2020
Blog

Hướng dẫn kích hoạt bản quyền Windows Server 2012 R2 không cần crack

Tháng Sáu 10, 2020
Hướng dẫn cài đặt và cấu hình Openstack toàn tập từ A-Z
Blog

Hướng dẫn cài đặt và cấu hình Openstack toàn tập từ A-Z

Tháng Sáu 4, 2020
Hướng dẫn Tự Tạo Ứng Dụng Họp Online Phòng Học Online Miễn Phí với Jitsi
Blog

Hướng dẫn Tự Tạo Ứng Dụng Họp Online Phòng Học Online Miễn Phí với Jitsi

Tháng Tư 13, 2020
Hướng dẫn sử dụng Remote Desktop để truy cập VPS
Blog

Hướng dẫn sử dụng Remote Desktop để truy cập VPS

Tháng Tư 12, 2020
Download Kali Linux 2020.1
Blog

Download Kali Linux 2020.1

Tháng Tư 12, 2020
vps giá rẻ
  • Trending
  • Comments
  • Latest
Hướng dẫn cài DirectAdmin Nulled mới nhất 2020

Hướng dẫn cài DirectAdmin Nulled mới nhất 2020

Tháng Sáu 10, 2020
Wowza Streaming Engine 4.7.7 Crack Linux/Windows

Wowza Streaming Engine 4.7.7 Crack Linux/Windows

Tháng Mười Một 15, 2020
Nén và giải nén trong linux centos 6 centos 7 nén zip, tar.gz và tar.bz2.

Khuyến mãi vps 50k/tháng SSD 50Gb

Tháng Sáu 15, 2019
Bán tài khoản MOVO CASH USA ACCOUNT (VCC+VBA)

Bán tài khoản MOVO CASH USA ACCOUNT (VCC+VBA)

Tháng Bảy 11, 2020

Cpanel Nulled Cpanel/whm Nulled on Centos VPS/Dedicated Servers

Tháng Mười 8, 2020
Hướng dẫn cài đặt và cấu hình Openstack toàn tập từ A-Z

Hướng dẫn cài đặt và cấu hình Openstack toàn tập từ A-Z

Tháng Sáu 4, 2020

LINUX BACKUP & RESTORE FULL OS

0

Milestones & Timeline

0

The Economics of Websites

0

The Landing Page Guide

0

The Next Big Thing

0

UX Design Is Easy

0

LINUX BACKUP & RESTORE FULL OS

Tháng Mười Hai 16, 2020

VPS Ram 4GB Chỉ 199k/tháng Miễn Phí Gsuite,

Tháng Tám 29, 2020

Tài Khoản Google Drive Unlimited 2020 50k – Google Drive Không Giới Hạn – Google drive unlimited 2020

Tháng Bảy 11, 2020
Bán tài khoản MOVO CASH USA ACCOUNT (VCC+VBA)

Bán tài khoản MOVO CASH USA ACCOUNT (VCC+VBA)

Tháng Bảy 11, 2020

Hướng dẫn kích hoạt bản quyền Windows Server 2012 R2 không cần crack

Tháng Sáu 10, 2020
Hướng dẫn cài đặt và cấu hình Openstack toàn tập từ A-Z

Hướng dẫn cài đặt và cấu hình Openstack toàn tập từ A-Z

Tháng Sáu 4, 2020
  • vps giá rẻ
  • cpanel nulled
  • bitcoin exchange script
  • Home 1
Call us: 0975757375

© 2020

No Result
View All Result
  • vps giá rẻ
  • cpanel nulled
  • bitcoin exchange script
  • Home 1

© 2020

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In