blog

mihalis's picture

Using tar

This blog post will try to show you how to use the tar utility.

Look at the contents of the code directory:

$ ls -l code/
total 24
-rw-r--r--@ 1 mtsouk staff 50 Nov 16 18:12 generatePassword.go
-rw-r--r--@ 1 mtsouk staff 50 Nov 16 18:12 randomNumbers.go
-rw-r--r--@ 1 mtsouk staff 50 Nov 16 18:12 stack.go

You can create a new tar file as follows:

$ tar zcvf code.tar.gz code
a code
a code/generatePassword.go
a code/randomNumbers.go
a code/stack.go
$ ls -l code.tar.gz
-rw-r--r-- 1 mtsouk staff 494 Nov 24 22:38 code.tar.gz

The preceding file is also compressed using the gzip utility because of the z option.
You can list the contents of an existing tar file (t) as follows:

$ tar ztvf code.tar.gz
drwxr-xr-x 0 mtsouk staff 0 Nov 10 20:32 code/
-rw-r--r-- 0 mtsouk staff 50 Nov 16 18:12 code/generatePassword.go
-rw-r--r-- 0 mtsouk staff 50 Nov 16 18:12 code/randomNumbers.go
-rw-r--r-- 0 mtsouk staff 50 Nov 16 18:12 code/stack.go

You can extract (x) an existing tar file as follows:

$ tar zxvf code.tar.gz
x code/
x code/generatePassword.go
x code/randomNumbers.go
x code/stack.go

Tags: 
mihalis's picture

Why I write

As you might have noticed, I write a lot and there are many reasons that I do so:

  • I like the writing process!
  • I enjoy writing, especially when I finish writing about a topic.
  • When I write about something, I learn more things about it.
  • I like helping other people learn new things.
  • Although writing is not an easy task, It feels natural to me after so many years. However, it was not that easy in the beginning.

One more thing that I forgot to mention: from time to time I read my writings!

Tags: 
mihalis's picture

Go Systems Programming TOC

1: GETTING STARTED WITH GO AND UNIX SYSTEMS PROGRAMMING
2: WRITING PROGRAMS IN GO
3: ADVANCED GO FEATURES
4: GO PACKAGES, ALGORITHMS, AND DATA STRUCTURES
5: FILES AND DIRECTORIES
6: FILE INPUT AND OUTPUT
7: WORKING WITH SYSTEM FILES
8: PROCESSES AND SIGNALS
9: GOROUTINES - BASIC FEATURES
10: GOROUTINES - ADVANCED FEATURES
11: WRITING WEB APPLICATIONS IN GO
12: NETWORK PROGRAMMING

You can get an even more detailed TOC at https://www.packtpub.com/networking-and-servers/go-systems-programming

mihalis's picture

Source code of Go Systems Programming

You can find the Go code of the "Go Systems Programming" book at https://github.com/PacktPublishing/Go-Systems-Programming

Image: 
mihalis's picture

Go Systems Programming book is available!

After lots of writing, the Go Systems Programming book is available for purchase!
You can find more information and order the book at https://www.packtpub.com/networking-and-servers/go-systems-programming

Image: 
Tags: 

Pages

Subscribe to RSS - blogs