Results 1 to 7 of 7

Thread: Permission denied while trying to open a file with Terminal

  1. #1
    Join Date
    Oct 2013
    Beans
    3

    Permission denied while trying to open a file with Terminal

    Hello there, just learning linux/ubuntu

    The problem is, I'm playing with the terminal, so I created a file using the line "> test.txt", and the file is alright, but when I try to open it using "./test.txt" it returns the message "bash: ./test.txt: Permission denied". I'm pretty sure I got all the essentials packages and stuff, so dunno what's going on

    Thanks

    edit: I'm using 12.04 btw
    Last edited by CRze3wD; October 10th, 2013 at 11:16 PM.

  2. #2
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    11,791
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Permission denied while trying to open a file with Terminal

    CRze3wD; Hi ! Welcome to the forum .
    a) What are the file permissions ? :
    Code:
    ls -l test.txt
    b) Who owns the file ? (also from the above)
    c) is the file an executeable file ?(also from the above) or just a text file (from the file extension use of ".txt" ?
    d) is the file "test.txt" the same file to be executed located in your present working directory ?

    see:
    Code:
    man ls
    man chown
    man chmod
    man chgrp
    for the documentation and for continued discussion.

    security ->
    the strength of linux
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  3. #3
    Join Date
    Oct 2013
    Beans
    3

    Re: Permission denied while trying to open a file with Terminal

    barroso@ubuntu:~$ ls -l test.txt
    -rw-rw-r-- 1 barroso barroso 0 Oct 10 19:30 test.txt

    It's a text file, it opens with the gedit, but I can't open it with the terminal.
    edit: also, I can't open any file at all using the command "."
    Last edited by CRze3wD; October 10th, 2013 at 11:37 PM.

  4. #4
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Permission denied while trying to open a file with Terminal

    By default, bash will try to execute the file. You need an editor like nano, vi or gedit to open it:
    Code:
    vi ./test.txt
    Code:
    nano ./test.txt
    Code:
    gedit ./test.txt

  5. #5
    Join Date
    Oct 2013
    Beans
    3

    Re: Permission denied while trying to open a file with Terminal

    Thanks, that worked. Now the question, what kind of files would bash open?

  6. #6
    Join Date
    Jan 2009
    Location
    Belgium (Ghent)
    Beans
    481
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Permission denied while trying to open a file with Terminal

    For just reading use cat or for long files less or more
    For the first 10 lines use head for the last 10 lines use tail
    For options see the man-pages:
    man command
    Dutch speaking; understand English, writing is a bit difficult. Member of: http://forum.ubuntu-nl.org
    be Open be Free be Ubuntu Reg. User #485479
    Ubuntu 13.10 Saucy Salamander - Ubuntu 14.04 Trusty Tahr

  7. #7
    Join Date
    Jul 2005
    Location
    England
    Beans
    Hidden!

    Re: Permission denied while trying to open a file with Terminal

    Or you can make the system use the default application for any file with command exo-open filename from the folder containing the file (or use full pathway)

    PS: xdg-open filename also will work.
    DISTRO: Xubuntu 16.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo --- Wireless-Info

Bookmarks

Posting Permissions

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