LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-14-2009, 12:12 AM   #1
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Rep: Reputation: 15
What is the difference between ./ls and . ./ls?


Could you help me ?
 
Old 09-14-2009, 12:19 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
. = current dir
.. = parent dir

Just try it...
 
Old 09-14-2009, 12:19 AM   #3
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Be more clear what you want to ask ?
What i understand
. refer current directory
.. refer parenrt directory

thnks
 
Old 09-14-2009, 12:23 AM   #4
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Original Poster
Rep: Reputation: 15
Hi,
I presumed that ls was from /bin/ls. I wanted to execute it. So I used . ./ls like executing a script command. But failed.
Then I used ./ls. It was successful. What was the principle? Who could help me ?
 
Old 09-14-2009, 12:27 AM   #5
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
If you present in /bin directory and execute
./ls
if will surely execute file ls

thnks
 
Old 09-14-2009, 12:33 AM   #6
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Original Poster
Rep: Reputation: 15
Sorry, I made you misunderstood.
I used two linux, one as a client, another as a nfs server.
The client mounted the shared directory with noexec.
The server copied the /bin/ls to the shared directory named ls.
Usually, if I EXECUTED the ls file in the the shared directory, it should be denied with the noexec option.
So I used . ./ls in the shared directory, it showed that command could not be found.
But I used ./ls. it could work.
Then I really what to know the difference between ./ls and . ./ls?
Thanks!
 
Old 09-14-2009, 12:58 AM   #7
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Original Poster
Rep: Reputation: 15
Hi,
./<filename> to run binary file.
. ./<filename>to run script.
The topic could be closed.
 
Old 09-14-2009, 01:04 AM   #8
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
do you maen
.<space>./ls
if yes then it is not appropiate command
and if
../ls
that means it parent directory of current working directory, there is a executable file ls , that you want execute in current directory

thnks
 
Old 09-14-2009, 01:07 AM   #9
jcky
Member
 
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by vishesh View Post
do you maen
.<space>./ls
if yes then it is not appropiate command
and if
../ls
that means it parent directory of current working directory, there is a executable file ls , that you want execute in current directory

thnks
. ./<filename> could execute script file.
 
  


Reply


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
#What's the difference between these? user2002 Linux - Newbie 6 05-20-2016 08:14 AM
shell script to find the difference betwwn two file and place the difference to other kittunot4u Linux - General 3 07-19-2010 05:26 AM
difference between *.ko and *.so alenD Linux - Newbie 10 11-09-2007 10:50 AM
What is the difference? drewski *BSD 5 05-21-2003 04:13 PM
What's the Difference New2Linux1978 Linux - Newbie 4 05-14-2003 07:58 PM


All times are GMT -5. The time now is 08:25 PM.

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