How to run an executable without prepending ./
You have to run an execitable from current directory as ./executable
where .
represent the current directory.
If you are in ~/tools/web/visual-studio-code
directory to run the executable Code
you have to do two things,
- Check if the executable has execution permission. See How to make a file executable?
- Run the executable as,
./Code
Why do I need to type `./` before executing a program in the current directory?
How to run an executable from current directory without ./
before executiable:
Run the following command in a terminal,
echo "export PATH=$PATH:." >> ~/.bashrc
and run Code
from ~/tools/web/visual-studio-code
as
user@server:~/tools/web/visual-studio-code$ Code
How to run an executable from any directory without ./
before executiable:
echo "export PATH=$PATH:$HOME/tools/web/visual-studio-code" >> ~/.bashrc
and run Code
from anywhere,
user@server:~$ Code
Related videos on Youtube
Leo Zhu
Updated on September 18, 2022Comments
-
Leo Zhu over 1 year
I'm fairly new to Ubuntu and I do believe in jumping in head first into issues to learn. I know that I can run some GUI applications with Putty+Xming on headless Ubuntu Server. But I can't run Visual Studio Code My issue is not installing Visual Studio Code. I've installed through zip and through umake. Both with the same result.
user@server:~/tools/web/visual-studio-code$ ls Code libgcrypt.so.11 natives_blob.bin content_shell.pak libnode.so resources Credits_43.0.2357.65.html libnotify.so.4 snapshot_blob.bin icudtl.dat license.txt ThirdPartyNotices.txt libffmpegsumo.so locales user@server:~/tools/web/visual-studio-code$ Code No command 'Code' found, did you mean: Command 'ode' from package 'plotutils' (universe) Command 'node' from package 'node' (universe) Command 'node' from package 'nodejs-legacy' (universe) Code: command not found user@server:~/tools/web/visual-studio-code$
Anyone know if VS-Code can be opened this way?
-
Alec Teal almost 9 yearsPut it in your $PATH
-
-
Lightness Races in Orbit almost 9 yearsNote that putting
.
on thePATH
is a pretty terrible idea and you should generally just live with writing./Code
like everybody else.