I am trying to run a Foxitreader. I have run a tar on it. But why do I need to execute the setup with Why do I have to run a file beginning with './' in Downloads? What does that mean?
./FoxitReader.enu.setup.1.1.0.0225(r205262).x64.run
Foxit distributes its Foxit PDF reader as a compressed archive (file ending .tar.gz: .tar indicates it is an archive, .gz indicates it is zipped).
Once you decompressed the file you have this .run file. This is a binary file that can be executed on the command line.
The prefix ./
tells your shell to look for the file in the current directory as the .
is an identifier for "the current directory". You can check the directory you are in with the pwd
command.
In Linux and Unix like systems. the symbol .
means the current directory and the symbol ..
means the past directory
so ./X
( X is binary file) tells your terminal should execute the X file binary
.gz
is suffix for compressed file like X.gz
.tar
is suffix for archives files like X.tar
we have other compressor commands in Linux like bzip2
(with prefix .bz2
) but usually, we use gzip to compress files
For more information about tar see here
For more information about gzip see here
Compared to Windows, the tar
file is just an archive, like zip
is.
So what you've done is, you have unpacked the executable from the archive. This is like extracting a .zip
file to get an .exe
file on Windows.
But, like on Windows, here you need to run the executable to actually run the program.
You can run this executable (saved in the current folder) with ./FoxitReader.enu.setup.1.1.0.0225(r205262).x64.run
. Again, this is equivalent to running an exe file.
For the question: "why do I need ./
to run an executable?" — you don't always need it.
For example, when you type ls
or cp
or whatever, you run an executable. The thing is, the terminal needs to know where to find this program.
By default, when you don't type the path to the executable, the terminal searches for it in configured folders.
So, when you type ls
, the terminal:
ls
is$PATH
variable (setting)ls
in /bin/ls
But, the $PATH
setting doesn't usually have the current directory in it. That means you have to write the path to the executable, and the current folder has a special name .
, in the same way as a parent folder is ..
.
Without specifing that the FoxitReader "exe" is in the current (or a different directory) [with ./
or Downloads/
etc.], it wouldn't find it and wouldn't run it.
tar
delivers a package in a "crate". Therun
file contains the understanding of how to open the "crate", and unpack the contents onto the right "shelves" (which might be different on some machines or distros). – Paul_Pedant Feb 12 '22 at 16:23