Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dot slash vs nothing. What is the difference and what's better to use?

Just for curiosity.

What is the better method to use and what is the difference between them ?

<link rel=stylesheet href="./css/css.css">

vs

<link rel=stylesheet href="css/css.css">
like image 579
puaction Avatar asked Mar 31 '14 12:03

puaction


People also ask

Why do we use dot slash?

This is where the dot slash ./ notation comes in. It means “Look in the current directory.” When you use ./, you tell Ubuntu or Fedora or SUSE or whatever Linux distribution you're using to look in the current directory for the command you wish to run, and completely ignore what's on the application PATH.

What means dot slash?

A dot slash is a dot followed immediately by a forward slash ( ./ ). It is used in Linux and Unix to execute a compiled program in the current directory.

What does a dot mean in a file path?

.. (dot dot) This refers to the parent directory of your working directory, immediately above your working directory in the file system structure. If one of these is used as the first element in a relative path name, it refers to your working directory.

What do the two dots and the slash in the displayed reference mean?

The dot is the current directory and the slash is a path delimiter.


1 Answers

In a relative URI, there is no difference between them.

Going without the ./ will save you 2 bytes, so it is marginally better.


In a UNIX style shell, leaving the ./ off will search $PATH while including it will search the current directory. Some people might be including the ./ out of habit from working on the shell.

like image 176
Quentin Avatar answered Oct 27 '22 18:10

Quentin