Timeline for Why do we use "./" (dot slash) to execute a file in Linux/UNIX?
Current License: CC BY-SA 2.5
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 6, 2019 at 2:59 | comment | added | Carl Walsh | On Windows 10 PowerShell is the default shell now, and it also requires ./ to run an executable in the current path | |
| Feb 17, 2011 at 1:53 | comment | added | mattdm | Red Hat Linux 9? Time to upgrade! | |
| Nov 30, 2010 at 8:57 | vote | accept | Renjith G | ||
| Nov 30, 2010 at 8:57 | |||||
| Nov 30, 2010 at 8:48 | comment | added | Renjith G | Red Hat Linux release 9 (Shrike) Kernel 2.4.20-8 on an i686 [renjithg@cvsserver renjithg]$ touch .a.out;ls -lA total 3 -rw-rw-r-- 1 renjithg renjithg 0 Nov 30 13:46 .a.out -rwxrwxr-x 1 renjithg renjithg 11669 Nov 30 13:46 a.out -rw-rw-r-- 1 renjithg renjithg 218 Aug 24 2009 aray.c [renjithg@cvsserver renjithg]$ | |
| Nov 30, 2010 at 8:37 | comment | added | Rohan Monga | that is how you specify the path in Unix, <dir>/<file> so you are basically saying execute a file in the current directory, which is indicated by ./test | |
| Nov 30, 2010 at 8:37 | comment | added | Simon Whitaker | / is the path separator in Linux, so you use it to separate the directory (.) from the filename (a.out). Without it you have .a.out which is a valid filename in its own right. (Try touch .a.out; ls -lA to see this.) | |
| Nov 30, 2010 at 8:35 | comment | added | Renjith G | Thanks.My doubt is why do you need ./ at the start.... I got the use of "." (to poit the current directory) but why "/" after that? | |
| Nov 30, 2010 at 8:32 | history | answered | Simon Whitaker | CC BY-SA 2.5 |