Get the full path to a file

realpath examplefile.txt
Useful in scripts when the file is passed in as an argument. Eg. filepath=$(realpath $1)
Sample Output
/full/path/to/examplefile.txt

5
By: root
2009-02-04 15:41:44

2 Alternatives + Submit Alt

What Others Think

kitchen remodeling san antonio I really enjoyed reading your article. I found this as an informative and interesting post, so I think it is very useful and knowledgeable.
yeoyeo · 37 weeks and 1 day ago
Searching for the fresh flower can be so difficult sometime but you don't need to go over the roof or anywhere else, just click here www.instaflora.net/en-gb/delivery-flowers-russia and get your favorite flower on your door step with easy website
Falk1993 · 17 weeks and 4 days ago
Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. supreme saunas
jackson2321 · 8 weeks and 6 days ago
Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. credit
KayGasaway · 8 weeks and 5 days ago
Extremely intriguing online journal. A lot of web journals I see nowadays don't generally give anything that I'm keen on, however I'm most definitely inspired by this one. Recently felt that I would post and let you know. Door installation Companies
jackson2321 · 8 weeks and 2 days ago
I want to say thanks for beautiful blog sharing with us. Your blog really great resource to update my knowledge. Outdoor sauna
jackson2321 · 7 weeks and 5 days ago
I want to say thanks for beautiful blog sharing with us. Your blog really great resource to update my knowledge. Outdoor sauna
jackson2321 · 7 weeks and 5 days ago
I was impressed with the site that you created, so memotipasi many people to be more advanced, there also kunjugi me, as a comparison N95 Mask
KayGasaway · 7 weeks and 4 days ago
A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work ??
jackson2321 · 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: