LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-06-2013, 06:07 PM   #1
eldiener
Member
 
Registered: Nov 2006
Distribution: Mepis, CentOS, OpenSuse
Posts: 56

Rep: Reputation: 16
Output of full file path


Given a file in a directory, is there an easy way to copy the full file path so it can be pasted elsewhere ? From a console ? From a file manager ?
 
Old 04-06-2013, 06:12 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
There are at least two applications that let you interface with the x selection mechanism: xsel and xclip.

To get the full and actual path of a file, try readlink.

e.g. to copy the full path of a file to the selection for (middle-click) pasting:
Code:
readlink -f filename | xsel -i

Last edited by David the H.; 04-06-2013 at 06:13 PM.
 
Old 04-06-2013, 06:13 PM   #3
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,577
Blog Entries: 1

Rep: Reputation: Disabled
Using thunar here, I tried highlighting and Ctrl+c and my clipboard now contains this string
file:///home/jj/Documents/ftpcron.out

YMMV, but me thinks it may be possible in another DE.
 
Old 04-06-2013, 06:50 PM   #4
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,577
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by David the H. View Post
There are at least two applications that let you interface with the x selection mechanism: xsel and xclip.
Thanks David the H! This is exactly what I needed also.

I use to have these installed and use[d] 'em here and there. They work.

Last edited by Habitual; 04-06-2013 at 06:51 PM. Reason: s/hanks/Thanks//
 
Old 04-06-2013, 09:46 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,284

Rep: Reputation: 590Reputation: 590Reputation: 590Reputation: 590Reputation: 590Reputation: 590
How about:
Code:
echo $(pwd)/filename
The pwd prints the current working directory path...
 
  


Reply

Tags
file, path


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
Configuring GNOME to have Full File Path Text Fields in File Open Dialog Boxes bgoodr Linux - Desktop 3 11-29-2011 10:07 AM
How to get the full path of a file in C? Basel Programming 3 10-30-2010 11:52 PM
Get full path of a file get_to_know Programming 1 08-03-2009 01:34 AM
Listing files including full path in the output googlix Linux - General 9 11-24-2007 06:18 AM
full path of a file ttilt Linux - General 1 11-08-2005 07:02 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration