Author Topic: [ solved ] How do I create a link to a text file  (Read 918 times)

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2450
  • Any Bugs in site?
[ solved ] How do I create a link to a text file
« on: May 27, 2011, 04:19:43 AM »
I am timidly exploring in LXDE and trying out some minor things. I have started the habit of, as one of the first things, creating a file to record my explorations.  Initially I have been creating the file in/on the desktop but find this is not the best place.  When I wipe an OS I keep a copy of Documents ad Downloads as well as Pictcures if I remember  ;D. I don't keep a copy of the Desktop.
 
Have created a simple text document in /home/gert/Documents I would like to create a link on the desktop to this document.  Right clicking on the file did not enlighten me.

Any suggestions?
« Last Edit: May 28, 2011, 07:57:20 AM by wedgetail »
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline aguila

  • Hero Member
  • *****
  • Posts: 1210
  • soaring high = no Windows here :-D
Re: How do I create a link to a text file
« Reply #1 on: May 27, 2011, 06:09:59 AM »
Code: [Select]
cd /home/gert/Desktop
ln -s /home/gert/Documents/simple-text-file explorations

EDIT: added option "-s" for creating a symlink instead of a hard link.
« Last Edit: May 27, 2011, 06:19:33 AM by aguila »
All that is is good. PCLinuxOS is.

Thinkpad X61 Tablet, Core2Duo 1.66 MHz, 4 GB Ram, Intel onboard Graphics, Plextor PX-256M3 256 GB SSD; Thinkpad R61i, Core2Duo 1.66 MHz, 2 GB Ram, Intel onboard graphics, 120 GB HDD

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8608
  • Aurum nostrum non est aurum vulgi.
Re: How do I create a link to a text file
« Reply #2 on: May 27, 2011, 06:29:20 AM »
And instead of constantly opening and closing your txt file, you can just use echo -e using \\n for line breaks and \ immediately followed by any (some) symbols ending it with >> your_text.file.

Oh gosh, I hope I didn't confuse you.  8)
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8608
  • Aurum nostrum non est aurum vulgi.
Re: How do I create a link to a text file
« Reply #3 on: May 27, 2011, 06:33:10 AM »
Or you can try this:

$ cd Documents/
$ touch my_text
$ echo -e This is some text\\nFollowed by another line of more text. >> my_text
$ cat my_text

The repeat lines 3 and 4.

Simple but darn useful.
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2450
  • Any Bugs in site?
Re: How do I create a link to a text file
« Reply #4 on: May 27, 2011, 07:22:12 AM »
aguila
I did think of the symlinks but I could not figure out how the icon would show up in the desktop. Thanks anyway.

Archie
Ahhh a fellow cli jockey  ;D  Well I am only an apprentice as I forgot about those \\n and \  etc I will catch up with them. As to confusion, you will have to try better on that score  :D

Thanks for the examples as you may have sown the seeds for some little script to create a simple text file with a special paragraph divider line which would include the date plus the filename.  I am getting a bit tired of repeating again and again: date-filename.glk (I have my own file extensions for text files.  The extension married to a nice standout icon so I know instantly that this is one of my text files.

Oooops I am in the wrong OS, have better get back to LXDE and try these suggestions.
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8608
  • Aurum nostrum non est aurum vulgi.
Re: How do I create a link to a text file
« Reply #5 on: May 27, 2011, 08:45:26 AM »
I have personal files that do not have extensions. You know, aliases are another awesome trick. Take for example, I have a habit of clearing Konsole's history after I'm done. Instead of having to type $ his<tab> -c, all I do is $h-. Or $ ch brings me back to my /home folder.

Nice, I like personal icons. A little something for you to play with ... based on DarkFuture -> click.
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline aguila

  • Hero Member
  • *****
  • Posts: 1210
  • soaring high = no Windows here :-D
Re: How do I create a link to a text file
« Reply #6 on: May 27, 2011, 10:45:16 AM »
Hi wedgetail,

was wondering already - 1500 posts and still no CLI junkie? :D

Icon shows up in KDE, doesn't it show in LXDE?

Strictly KDE here, so I couldn't test.
All that is is good. PCLinuxOS is.

Thinkpad X61 Tablet, Core2Duo 1.66 MHz, 4 GB Ram, Intel onboard Graphics, Plextor PX-256M3 256 GB SSD; Thinkpad R61i, Core2Duo 1.66 MHz, 2 GB Ram, Intel onboard graphics, 120 GB HDD

Offline johnmart

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1108
  • Make Love Not War
Re: How do I create a link to a text file
« Reply #7 on: May 27, 2011, 12:12:26 PM »
Wedgetail,
This may be of no interest to you if you only have a file or two, but Baskets is made for that (in the repo). If you have many files to link to, they can be organised in groups (baskets). You can link files, locations url's too.
Don't worry, cli all th way.  ;)  ;D
Acer Aspire, Intel core2 2.20GHz, ‎Graphics nVidia ‎G98M [GeForce G 105M], 2gb ram, Wireless Intel Link 5100

Why, any 5 year old child could understand this.
Somebody bring me a 5 year old.
Groucho

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2450
  • Any Bugs in site?
Re: How do I create a link to a text file
« Reply #8 on: May 27, 2011, 04:52:25 PM »
aguila
My humble apology, after a good nights sleep, then reading your latest post I started thinking. If it worked in kde which I did not even test, I went back and read your link suggestion.  As I am probably more a KDE man I have just checked it in KDE and it works fine. I think I had ignored your first line:  
Quote
cd /home/gert/Desktop

I will soon be back and test that in LXDE.    :-[

Edit:
Yes it works fine, I am happy.

johnmart
I will get back and have a look at that, next time I get an urge to try "What if I install this ......." or similar. Thanks for the tip.

I was going through all my OS test systems as something suspect with my KDE or the PC, came across LXDE with a "long delay start" and had to redo initrd while I was there decided to have a closer look.

The Monospace Font 11pt is a stand out, very crisp on my Acer X243HD LCD, I will have to come back and look at that.

However I had better install the latest LiveCD iso as I think I am on a very old version.
« Last Edit: May 27, 2011, 05:07:14 PM by wedgetail »
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12802
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: How do I create a link to a text file
« Reply #9 on: May 27, 2011, 06:38:08 PM »
Quote
ln -s /path/to/the/actual\ file.txt /path/to/the/link\ file.txt

ln - link
-s - make it soft
/path/to/the/actual\ file.txt - what
/path/to/the/link\ file.txt - where

Noticed the \ in the path? It's before the space in the file name. If You dont use spaces in file names but _ or - instead - You can skip the \ ;).

Hope this helps.

Andy

Offline parnote

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 4445
  • The truth is out there ... PCLinuxOS!
Re: How do I create a link to a text file
« Reply #10 on: May 27, 2011, 08:10:09 PM »
wedgetail,

Kind of off topic, but since you're "timidly exploring LXDE," be sure to check out the magazine's Gtk+ Lightweight Desktops Special Edition. I'm sure you'll find all kinds of useful information to help you explore LXDE and get the most out of it.

I now return you to regularly scheduled programming ...  ;D ;D ;D

parnote
PCLinuxOS Magazine Chief Editor

Linux Registered User #485009

In a world without walls, who needs Windows?

PCLinuxOS Wiki: Contribute tips/tricks/how-to's!

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2450
  • Any Bugs in site?
Re: How do I create a link to a text file
« Reply #11 on: May 27, 2011, 08:45:34 PM »
AndrzejL
Thank you for your post, when I get back into LXDE later today I will see if that will wipe my tears away, I thought I had got it right but there was something odd and in my muddling I managed to loose 'something'. (Very factual eh  ;D) I will do better later when I get to my records file.

parnote
thanks, I forgot that too, but I certainly will check it out. Much appreciated.  First thoug I will re-install LXDE, as I have recently downloaded iso's for a number of the OS. Because of my suspect pc behaviour I am starting over again from the beginning. Good training too.

(work in progress ...)

Hmmm, any of you chaps connected the serial konsole to these OS?
« Last Edit: May 28, 2011, 12:06:30 AM by wedgetail »
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2450
  • Any Bugs in site?
Re: How do I create a link to a text file
« Reply #12 on: May 28, 2011, 07:56:52 AM »
AndrzejL
I got it right first time, created a link on the desktop (with a different name) to the original file in the ~/Documents  directory (not so smart, as link properties did not tell me the original name.  I deleted the the link icon/name and the original file still there (yeah yeah just to be safe, I am suspicous)

Finally I created a Link Name which is the original name less the extension I use. 

Will mark it solved   :)
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12802
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: [ solved ] How do I create a link to a text file
« Reply #13 on: May 28, 2011, 09:44:49 AM »
Cool beans ;). Link vs wedgetail 0:1 ;)...

Andy

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2450
  • Any Bugs in site?
Re: [ solved ] How do I create a link to a text file
« Reply #14 on: May 28, 2011, 06:43:00 PM »
 ;D ;D that won't last long, but makes you feel good for little while.
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen