Skip to content

Wednesday, December 23rd, 2009

New Linux User

EXPLANATION: What Does ‘./’ Mean in GNU/Linux?

September 28, 2005 by Jon  
Filed under Explanation

In Windows or DOS the current directory is included in the path search. In GNU/Linux, it is not implicity included.

For example, if you are in the directory C:\TEMP on a Windows machine, and the path is C:\WINDOWS;C:\WINDOWS\SYSTEM and you attempted to run an application in the C:\TEMP directory – it would succeed. This is because Windows added the current directory (C:\TEMP) to its search path.

Conversely, if you are in the directory \home\fred\temp on a GNU/Linux machine, and the path is \usr\bin:\usr\sbin and you attempted to run an application in the \home\fred\temp directory – it would fail. This is because GNU/Linux does not add the current directory (\home\fred\temp) to its search path.

The dot-slash means ‘current directory’. Therefore, preceeding a file name with the dot-slash (./) tells GNU/Linux that the application indicated resides in the current directory. Therefore, in the above example (using foo.sh as an example application) typing ./foo.sh in the /home/fred/temp directory would succeed.

As would qualifying the full path, /home/fred/temp/foo.sh

You can also use the ./ to indicate the current directory during other operations such as file copying and moving.

  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Reddit
  • Yahoo! Buzz
  • Slashdot
  • E-mail this story to a friend!

Comments

2 Responses to “EXPLANATION: What Does ‘./’ Mean in GNU/Linux?”
  1. Mike D'agostino says:

    Good definition to above. I have another question… What does “. ./script_name.sh” mean before running a script file? I know it means to runf script file in present directory, but what is the first “.” mean before the ” ./script_name.sh” ?

  2. Fevrin says:

    Mike, “../” is used to signify the parent directory of the current directory. So if you run “../script_name.sh”, the computer will look for that file in the directory in which the current directory resides. With “../” and “./” you can get really fancy and perform commands in the terminal on files several directories away, although this wouldn’t be very intuitive.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


About Us | Advertise with us | Blog for EveryJoe | Privacy Policy | Terms of Use
Get This Theme | Sitemap


All content is Copyright © 2005-2009 b5media. All rights reserved.