Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-16-2015, 10:15 AM   #1
LQ Newbie
Registered: May 2015
Posts: 2

Rep: Reputation: Disabled
Smile Why ./home/Desktop is incorrect and ./Desktop is correct?

I'm learning about Linux, started yesterday. I have a question which didn't clear from the book and Google. The question is what is the difference between ./ and / in terminal? I'm asking this because when i give command for example - ./home/yogesh/Desktop/Books it is showing bash: ./home/yogesh/Desktop : No such file or directory but on removing the dot it's showing /home/yogesh/Desktop/Books: Is a directory.
Again on giving command like /Desktop it showing /Desktop :No such file or directory but on adding dot before / it is giving ./Desktop: is a directory.
What is the difference between ./ and / ?
I'm sorry if i asked something foolish but I have to know it anyway. Thankyou in advance and sorry for my bad English.
Old 05-16-2015, 10:49 AM   #2
Registered: Apr 2012
Distribution: Gentoo
Posts: 570

Rep: Reputation: 133Reputation: 133
/ is the topmost directory of the filesystem (the very root)
./ stands for your current location (either your home directory or where did you navigated with "cd" command)
When you open terminal usually you starting at your home directory (/home/yogesh). So if you want to list Books directory content you have to type it either
ls /home/yogesh/Desktop/Books
ls ./Desktop/Books
The last will be correct if you at your home directory (/home/yogesh)

Last edited by Teufel; 05-16-2015 at 10:50 AM.
Old 05-16-2015, 11:07 AM   #3
LQ Guru
Registered: Dec 2011
Distribution: Slackware
Posts: 7,806
Blog Entries: 10

Rep: Reputation: Disabled

You can also use ./ to launch a script.

./ name of script
Study command-line when you have the time.
Old 05-16-2015, 11:12 AM   #4
LQ Newbie
Registered: May 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for the reply but i did'nt get it.Why ./home/yogesh is wrong and /home/yogesh is correct ?
Old 05-16-2015, 11:16 AM   #5
Registered: Aug 2002
Posts: 16,113

Rep: Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865
Actually if you look at the output of the ls -a you will see two objects represented by dots . and .. The single . means the directory itself and .. means its parrent directory. In a nutshell the . does not contain a trailing / (look at the output of the pwd command) therefore to run a command in the current working directory you need ./

An example of the .. is if you want to move one directory up in the tree i.e from /home/yogesh/Desktop/ to /home/yogesh/ quickly you would run the command
cd ..

/home/yogesh is an absolute path where as ./home/yogesh would expand to be the /current_working_directory/home/yogesh.

Last edited by michaelk; 05-16-2015 at 11:20 AM.
Old 05-16-2015, 12:12 PM   #6
Registered: Apr 2012
Distribution: Gentoo
Posts: 570

Rep: Reputation: 133Reputation: 133
Originally Posted by Yogesh24 View Post
Thanks for the reply but i did'nt get it.Why ./home/yogesh is wrong and /home/yogesh is correct ?
It's wrong because there is no "home" subdirectory in your current working directory.
Old 05-16-2015, 01:42 PM   #7
Senior Member
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,699
Blog Entries: 23

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
okay, a quick intro in the file system...
say, the filesystem is a tree, that is upside down (weird, but, ride with me), then the upper most part is..."/", just that.
You could put everything in there and be done, but, that's messy, and Linux would NOT function that way. Neatness is the middle name of Linux...
All the users have a folder for their stuff (MP3's - legal I hope - pics, documents...) and since "home sweet home" goes the same for Linux, all the users have their "home" in the ..."home" folder. Located at the topmost level and thus directly attached to the root - as the slash is called...
INSIDE every "home" folder are the folders...of the users...
Correctness (and completeness) dictates mentioning the whole address:

...but...why go tru that when peter lives accross the street?

In brief...

is what you feed a program that is "somewhere" on the drive, so it needs the wolde "address"...but...if the player "lives in the same folder...

...will do just as well...the "dot" in front basically means..."the guy that lives in this street"...

This picture clarifies all, if cory wanted to run at something in her folder, she'd enter

but if that program is in the lib folder, she'd have to enter

Hope that clarifies some and...welcome to Linux...


Last edited by ButterflyMelissa; 05-16-2015 at 01:49 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ubuntu-desktop vs. kubuntu-desktop vs. xubuntu-desktop vs. lubuntu-desktop vs. unity Kenny_Strawn Ubuntu 18 05-13-2011 09:20 AM
Desktop showing the contents of home folder on desktop in fedora 8 khalchian Linux - Newbie 2 08-18-2009 08:45 AM
create a shortcut in /home/username/Desktop but not still not appear on desktop! swgiant Linux - Newbie 1 09-27-2008 11:51 AM
Desktop displays '/home/*user*' instead of '/home/*user*/desktop' campbell226 Linux - Desktop 2 08-05-2008 06:15 AM
Correct desktop resolution. Incorrect screensaver & lock resolution mybootorg Linux - General 6 05-03-2006 02:39 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration