How to show full path of a file including the full filename in Mac OSX terminal?
'ls' can show the file name, e.g
ls config.inc.php
config.inc.php
'pwd' show current folder full path, e.g
pwd
/Application/XAMPP/xamppfiles/phpmyadmin
Is there a command can put them together, would be able to show:
/Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php
macos command-line
add a comment |
'ls' can show the file name, e.g
ls config.inc.php
config.inc.php
'pwd' show current folder full path, e.g
pwd
/Application/XAMPP/xamppfiles/phpmyadmin
Is there a command can put them together, would be able to show:
/Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php
macos command-line
add a comment |
'ls' can show the file name, e.g
ls config.inc.php
config.inc.php
'pwd' show current folder full path, e.g
pwd
/Application/XAMPP/xamppfiles/phpmyadmin
Is there a command can put them together, would be able to show:
/Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php
macos command-line
'ls' can show the file name, e.g
ls config.inc.php
config.inc.php
'pwd' show current folder full path, e.g
pwd
/Application/XAMPP/xamppfiles/phpmyadmin
Is there a command can put them together, would be able to show:
/Application/XAMPP/xamppfiles/phpmyadmin/config.inc.php
macos command-line
macos command-line
asked Feb 15 '14 at 0:30
Rob LRob L
311137
311137
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
From here:
https://stackoverflow.com/a/4031502/804713
macports and homebrew provide a coreutils package containing greadlink
(GNU readlink). credit to Michael Kallweitt post in mackb.com
brew install coreutils
greadlink -f file.txt
1
This was driving me nuts. I was thinking why-f
wouldn't work on non-GNU and how to make it work. This works. Thanks
– sdkks
Oct 13 '17 at 10:14
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
add a comment |
There are many ways to do that; here is one example that may work for you:
claw:~ jonv$ echo `pwd`/`ls config.in.php`
/Users/jonv/config.in.php
If you want more examples, there are a bunch on this post at stackoverflow.
1
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
add a comment |
In Mac OSX, do the following steps:
cd
into the directory of the target file.- Type either of the following terminal commands.
Terminal
ls "`pwd`/file.txt"
echo $(pwd)/file.txt
- Replace
file.txt
with your actual file name. - Press Enter.
add a comment |
You can also use the "find" command for listing all files with complete path:
find DirectoryName -type f
or just the following:
find . -type f
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
add a comment |
Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327
Create alias which simply is a function call that combines pwd
and ls $1
. You can then add this to your .bash_profile
if you choose.
alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'
Example of use:
lsf registry.lock
-> /tmp/registry.lock
I chose lsf
for "list full" or "list file", makes sense to me but feel free to modify.
add a comment |
The following will find a file within the working directory that matches file.txt
and return its absolute path
find `pwd` -name file.txt
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f717105%2fhow-to-show-full-path-of-a-file-including-the-full-filename-in-mac-osx-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
From here:
https://stackoverflow.com/a/4031502/804713
macports and homebrew provide a coreutils package containing greadlink
(GNU readlink). credit to Michael Kallweitt post in mackb.com
brew install coreutils
greadlink -f file.txt
1
This was driving me nuts. I was thinking why-f
wouldn't work on non-GNU and how to make it work. This works. Thanks
– sdkks
Oct 13 '17 at 10:14
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
add a comment |
From here:
https://stackoverflow.com/a/4031502/804713
macports and homebrew provide a coreutils package containing greadlink
(GNU readlink). credit to Michael Kallweitt post in mackb.com
brew install coreutils
greadlink -f file.txt
1
This was driving me nuts. I was thinking why-f
wouldn't work on non-GNU and how to make it work. This works. Thanks
– sdkks
Oct 13 '17 at 10:14
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
add a comment |
From here:
https://stackoverflow.com/a/4031502/804713
macports and homebrew provide a coreutils package containing greadlink
(GNU readlink). credit to Michael Kallweitt post in mackb.com
brew install coreutils
greadlink -f file.txt
From here:
https://stackoverflow.com/a/4031502/804713
macports and homebrew provide a coreutils package containing greadlink
(GNU readlink). credit to Michael Kallweitt post in mackb.com
brew install coreutils
greadlink -f file.txt
edited May 23 '17 at 12:41
Community♦
1
1
answered Sep 18 '15 at 19:36
stephenbezstephenbez
47643
47643
1
This was driving me nuts. I was thinking why-f
wouldn't work on non-GNU and how to make it work. This works. Thanks
– sdkks
Oct 13 '17 at 10:14
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
add a comment |
1
This was driving me nuts. I was thinking why-f
wouldn't work on non-GNU and how to make it work. This works. Thanks
– sdkks
Oct 13 '17 at 10:14
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
1
1
This was driving me nuts. I was thinking why
-f
wouldn't work on non-GNU and how to make it work. This works. Thanks– sdkks
Oct 13 '17 at 10:14
This was driving me nuts. I was thinking why
-f
wouldn't work on non-GNU and how to make it work. This works. Thanks– sdkks
Oct 13 '17 at 10:14
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
Note that this also works for directories
– Paul Berg
Sep 30 '18 at 10:40
add a comment |
There are many ways to do that; here is one example that may work for you:
claw:~ jonv$ echo `pwd`/`ls config.in.php`
/Users/jonv/config.in.php
If you want more examples, there are a bunch on this post at stackoverflow.
1
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
add a comment |
There are many ways to do that; here is one example that may work for you:
claw:~ jonv$ echo `pwd`/`ls config.in.php`
/Users/jonv/config.in.php
If you want more examples, there are a bunch on this post at stackoverflow.
1
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
add a comment |
There are many ways to do that; here is one example that may work for you:
claw:~ jonv$ echo `pwd`/`ls config.in.php`
/Users/jonv/config.in.php
If you want more examples, there are a bunch on this post at stackoverflow.
There are many ways to do that; here is one example that may work for you:
claw:~ jonv$ echo `pwd`/`ls config.in.php`
/Users/jonv/config.in.php
If you want more examples, there are a bunch on this post at stackoverflow.
edited May 23 '17 at 11:33
Community♦
1
1
answered Feb 15 '14 at 0:55
yoonixyoonix
573310
573310
1
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
add a comment |
1
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
1
1
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
Most good answers on in stackoverflow.com/questions/5265702/… don't work out of the box on OS X, however.
– Quentin Pradet
Jun 9 '15 at 8:29
add a comment |
In Mac OSX, do the following steps:
cd
into the directory of the target file.- Type either of the following terminal commands.
Terminal
ls "`pwd`/file.txt"
echo $(pwd)/file.txt
- Replace
file.txt
with your actual file name. - Press Enter.
add a comment |
In Mac OSX, do the following steps:
cd
into the directory of the target file.- Type either of the following terminal commands.
Terminal
ls "`pwd`/file.txt"
echo $(pwd)/file.txt
- Replace
file.txt
with your actual file name. - Press Enter.
add a comment |
In Mac OSX, do the following steps:
cd
into the directory of the target file.- Type either of the following terminal commands.
Terminal
ls "`pwd`/file.txt"
echo $(pwd)/file.txt
- Replace
file.txt
with your actual file name. - Press Enter.
In Mac OSX, do the following steps:
cd
into the directory of the target file.- Type either of the following terminal commands.
Terminal
ls "`pwd`/file.txt"
echo $(pwd)/file.txt
- Replace
file.txt
with your actual file name. - Press Enter.
answered Mar 24 '16 at 6:12
MowzerMowzer
4873917
4873917
add a comment |
add a comment |
You can also use the "find" command for listing all files with complete path:
find DirectoryName -type f
or just the following:
find . -type f
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
add a comment |
You can also use the "find" command for listing all files with complete path:
find DirectoryName -type f
or just the following:
find . -type f
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
add a comment |
You can also use the "find" command for listing all files with complete path:
find DirectoryName -type f
or just the following:
find . -type f
You can also use the "find" command for listing all files with complete path:
find DirectoryName -type f
or just the following:
find . -type f
answered Jan 22 '18 at 10:07
MireiaMireia
291
291
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
add a comment |
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
This does not return the absolute path (which seems to be what OP was looking for)
– Ad N
Nov 8 '18 at 14:56
add a comment |
Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327
Create alias which simply is a function call that combines pwd
and ls $1
. You can then add this to your .bash_profile
if you choose.
alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'
Example of use:
lsf registry.lock
-> /tmp/registry.lock
I chose lsf
for "list full" or "list file", makes sense to me but feel free to modify.
add a comment |
Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327
Create alias which simply is a function call that combines pwd
and ls $1
. You can then add this to your .bash_profile
if you choose.
alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'
Example of use:
lsf registry.lock
-> /tmp/registry.lock
I chose lsf
for "list full" or "list file", makes sense to me but feel free to modify.
add a comment |
Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327
Create alias which simply is a function call that combines pwd
and ls $1
. You can then add this to your .bash_profile
if you choose.
alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'
Example of use:
lsf registry.lock
-> /tmp/registry.lock
I chose lsf
for "list full" or "list file", makes sense to me but feel free to modify.
Didn't like any of the given solutions so I made up my own based off of https://stackoverflow.com/a/22684652/953327
Create alias which simply is a function call that combines pwd
and ls $1
. You can then add this to your .bash_profile
if you choose.
alias lsf='function _lsf(){ echo "$(pwd)/$(ls $1)"; };_lsf'
Example of use:
lsf registry.lock
-> /tmp/registry.lock
I chose lsf
for "list full" or "list file", makes sense to me but feel free to modify.
answered Jan 25 at 1:03
FGregFGreg
1508
1508
add a comment |
add a comment |
The following will find a file within the working directory that matches file.txt
and return its absolute path
find `pwd` -name file.txt
add a comment |
The following will find a file within the working directory that matches file.txt
and return its absolute path
find `pwd` -name file.txt
add a comment |
The following will find a file within the working directory that matches file.txt
and return its absolute path
find `pwd` -name file.txt
The following will find a file within the working directory that matches file.txt
and return its absolute path
find `pwd` -name file.txt
answered Feb 7 at 0:12
markmark
331313
331313
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f717105%2fhow-to-show-full-path-of-a-file-including-the-full-filename-in-mac-osx-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown