I installed jupiter and I use the radiance theme so the icon doesnt look right, so I found this answer on how to change it How can I change the icon for Jupiter?. It mentions needing superuser access and I figured using sudo in terminal would be eaiser than enabling root or whatever I need to do, but I can't find anything on here that explains how to extract a tar.bz file to a directory in terminal.
Method 1: Extracting the Files, Then Copying Them as Root
Navigate in the Terminal to wherever the file is located. For example, if it's located in the
Downloads
folder inside your home folder, run this command:The
~
character in this context is an abbreviation for the full name of your home folder. (For instance, if your username isjeff
, it is an abbreviation for/home/jeff
.)Now extract the archive with
tar
. Since that file is a.gz
archive, you'll use thez
flag to telltar
this:x
means to extract.v
means to list the files as it extracts them (you can leave this off if you like).z
means togunzip
it (as the.tar
archive is itself compressed withgzip
--that's what the.gz
extension designates).f
means to extract it here in the filesystem (and the need for it is an artifact of the older common use oftar
, to create and extract tape archives).The archive you just extracted contains three files (you saw their filenames if you kept the
v
flag in the command). Their names arebolt1.png
,bolt2.png
, andbolt4.png
. So now, copy these files to/usr/share/pixmaps
. This is the part that requiresroot
privileges, so this is where you should usesudo
:You had extracted them as your own (non-
root
) user, which gave you ownership over them. Butroot
should own the files in/usr/share/pixmaps
, which is why you should use the--no-preserve=ownership
argument tocp
. Since you are copying the files asroot
in a directory owned byroot
, the copy you make will be owned byroot
as is proper.Method 2: Copying and Extracting the Archive as Root
You might find it simpler to do everything as
root
. Thenroot
will own the files initially, becauseroot
will extract them. The easiest way to do this is to put the archive in the destination folder (if it's not already there).Supposing the file is located in
Downloads
:Please note that you could instead have used
mv
instead ofcp
to move it instead of copying it (provided that the source and target folders are on the same partition).Now go to the target folder and extract the archive:
You should probably remove the archive, because it's not good to have extraneous files in
/usr/share/pixmaps
:Method 3: Just Extracting the Archive as Root
If you like, you can keep the archive wherever you downloaded it, and just extract it to
/usr/share/pixmaps
asroot
. (Thanks to adempewolff for suggesting I present this method.)This works because
tar
will, by default, extract the archive to whatever folder you are in, rather than to the folder the archive is in (if they are different).Other Methods
You can easily make a variation of Method 1 where you extract the files graphically with the Archive Manager, then copy them in the Terminal with
sudo
. But you can also do both asroot
, by running Nautilus (the file browser) asroot
. If you do this, you can perform any file management task with Nautilus, and any programs you launch from Nautilus will also run asroot
. You have to be careful with this, because you can damage your system by making a mistake (just as you can by running the wrong command withsudo
), and because it would be particularly bad to forget that this Nautilus window was running asroot
rather than normally.To run graphical programs as
root
, don't usesudo
directly. Instead, usegksu
. So, to run Nautilus asroot
, you could press Alt+F2 and run:If you do this, make sure to close the Nautilus window when you're done, and to only use it for tasks where you know you need to be
root
(like making changes to the contents of/usr/share/pixmaps
).You could even do a variation of Method 2 or Method 3 where you don't copy anything as
root
, but instead extract the archive asroot
graphically, by running the Archive Manager asroot
. To do this, press Alt+F2 and run:However, most users find it easier to extract files by launching the Archive Manager from within Nautilus, because then it opens knowing what archive you want it to use. (You can pass the name of the archive as part of the
file-roller
command...but at this point you start to lose the ease-of-use benefit of GUI over command-line.)Suggested Resources
To learn more about extracting files with
tar
, seeman tar
.If the archive had been
.tar.bz2
, you would usej
instead ofz
. If it had been.xz
, you would useJ
instead. For all other information, see that manual page.To learn more about performing administrative tasks in Ubuntu, see the community documentation on
sudo
androot
, and alsoman sudo
andman gksu
(orman kdesudo
if you're using Kubuntu).The community documentation on File Compression is worth a read, to learn more about archives and file compression. (Technically these are two related and overlapping but different things. For example: A
.tar
file is an archive. A.gz
file is compressed.)Most of the time you use
tar
it will probably not be to create and restore backups, but it can be useful for that, plus, understanding how that works enhances your understanding of whattar
can and cannot do and how to use it. If this interests you, see the community documentation on backing up your system withtar
.