Find the answer to your Linux question:
Results 1 to 4 of 4
Hey guys this may be a stupid question but ive searched on google and suprisingly i cnt find nething. but back to the matter at hand. what command would i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2006
    Posts
    6

    text file creation in the terminal


    Hey guys this may be a stupid question but ive searched on google and suprisingly i cnt find nething.

    but back to the matter at hand. what command would i use to make a simple text file in the terminal. but what im really trying to do is create a file on the desktop that will open a url to a website when u open it. i know u can go it using a GUI but im making a vowel that for the first month of using linux im going to do everything through the terminal lol.

    anyone know what 2 do?

  2. #2
    Just Joined! SweetLou's Avatar
    Join Date
    Nov 2004
    Posts
    68
    You could just use vi

    #man vi

  3. #3
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    To create an empty file you can use touch
    Code:
    touch nameoffile
    To just put a string into a new file you could say
    Code:
    echo test you want in the file > destination.txt
    Text editing can be done with vi/vim as mentioned above or with emacs. Both seem difficult to use, but believe me if you give it the little time at the start to find out how they work, you may find yourself using them more than gui text editors. They are quite powerful.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    To put the file on your desktop, navigate to /home/emblinex/Desktop before creating the file. Or if you've already made it somewhere else, just move it to the /home/emblinex/Desktop directory with the mv command.

    The content for a file that opens a specific URL in a Web browser just needs to have the browser's launch command, followed by the URL. So to open LinuxForums in Firefox,
    Code:
    #!/bin/sh
    /usr/bin/firefox http://www.linuxforums.org
    That first line is put at the top of all shell scripts, to identify them to the system as scripts (text files that are passed to the shell as commands).

    You'll need to make it executable with the chmod command. After that, you can double-click it on your desktop or dot-slash it in a terminal to run it.
    Stand up and be counted as a Linux user!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •