Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What do I type into the terminal to tell it where to go? I don't really understand how to move files using the terminal.

share|improve this question

The question is where to extract application files, so I'd recommend to extract it to a temporary folder inside /home directory and then copy it into a permanent location in the file system.

For deb files

Method 1: using dpkg

deb is the extension of the Debian software package format and the most often used name for such binary packages.

dpkg is the package manager for Debian. So using dpkg command you can list and extract deb packages.

  • Use dpkg -c to list the contents of a deb package:

    $ dpkg -c <file-name>.deb 
  • Use dpkg -x to extract the files from a deb package:

    $ dpkg -x <file-name>.deb </path/to/temp-dir>

Method 2: using ar

Debian packages are standard Unix ar archives that include two tar archives optionally compressed with gzip (zlib), Bzip2, lzma, or xz (lzma2): one archive holds the control information and another contains the program data.

Therefore .deb files always contains three files — debian-binary, control.tar.gz, and data.tar.gz.

Use ar and tar command to extract and view the files from the deb package.

  • To extract the contents of .deb archive to your /home directory:

    $ ar -vx <file-name>.deb
    x - debian-binary
    x - control.tar.gz
    x - data.tar.gz
  • To extract the contents of data.tar.gz file:

    $ tar -xvzf data.tar.gz </path/to/temp-dir>
  • To extract the files into the root directory tree, which should place everything where it should go, you can:

    $ tar -xvzf data.tar.gz /


deb files should be installed with dpkg, so to install the package, do:

sudo dpkg -i <file-name>.deb

If the deb file(s) are in another directory inside your /home directory, you can install it by:

cd <directory>
sudo dpkg -i *.deb

For Tar files

TAR(tape archive) is a file format (in the form of a type of archive bitstream) for archiving files.

  • To extract a tar file:

    tar -xvf file.tar
  • To extract a .tar.gz (gzip) file, (note -z option):

    tar -xzvf file.tar.gz
  • To extract .tar.bz2 (bzip2) file, (note -j option):

    tar -xjvf file.tar.bz2

By default files will be extracted into the current directory. To change the directory use -C option.

For example, to extract to /home/data:

tar -zxvf data.tar.gz -C /home/data
  • To view a detailed table of contents (list all files) for this archive:

    tar -tzvf data.tar.gz

Using a GUI tool: Archive Manager

You can use the Archive Manager GUI application to create, view, modify, or extract an archive.

  1. Press the Super key to Open the Dash and type Archive Manager. This will launch the Archive Manager window.

    enter image description here

  2. Click on Open and browse for the tar or deb file.

  3. Click on Extract and select the directory to where you want to extract the file.

    enter image description here

share|improve this answer

Not to minimize other excellent answers, I wanted to provide a very simple answer.

If the file ends with .tar.gz (or .tgz), move the file to the directory to which you want to extract it and cd to that directory. Then:

tar xzvf filename.tar.gz

If the filename ends with .tar.bz2 or .tbz, then change the z in the above command to a j.

Which directory?

Any directory you like. I normally use /tmp because everything there is automatically deleted on reboot. If the program is designed to be run directly after extracting it without running an installer, then the traditional location would be ~/bin.

share|improve this answer

It depends what the application is. If it's a .deb file, you can say:

sudo dpkg -i filename.deb

If it's a .tar.gz file, you can say:

tar zvxf filename.tar.gz
cd directory-name
make install
# (or ./install or similar)
share|improve this answer
Thanks, its a tar.gz file. now how do i extract using the terminal? right now the file is in my downloads folder – Const Nov 4 '12 at 2:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.