Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason, gedit does not launch. Here is the output it gives:

chris@Chris-Ubuntu-Laptop:~$ gedit

Descriptive, Let us try the help.

chris@Chris-Ubuntu-Laptop:~$ gedit --help

So that does not work either. I have tried having it open a file. GUI launch techniques fail too. Synaptic and terminal based efforts to reinstall fail. The one thing that works is using sudo. I do not want to run as a super user though, so I don't accidently break something (doesn't seem to be helping :D). Oh yes, I noticed this when I was running a shell script that I have been testing. Here it is:


##Copyright 2012 Christopher David King
##This program is free software: you can redistribute it and/or modify
##it under the terms of the GNU General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##This program is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##GNU General Public License for more details.
##You should have received a copy of the GNU General Public License
##along with this program.  If not, see <>.

##usage: [-h]|[--help]|[-u] [filename] [mode]
##Helps to create new scripts. It will open them in a text editor of your choice (gedit by default) and give it the permissions you want (777 by default.)
##-u, uninteractive, will automatically overwrite scripts, and will fail if a file name is not supplied
##-h Display this help.
##--help Display this help.

if [ -w ~/bin ]; then cd ~/bin; fi #Work in the user's bin folder.

usage() #This is for help
    cat <<- _EOF_
    usage: [-h|--help] [-q|--quite] [filename] [text_editor] [mode]

    Helps to create new scripts. It will open them in a text editor of your choice (gedit by default) and give it the permissions you want (777 by default.)


    -q, --quiet Will not prompt user for input. Will fail if no filename given. Will automatically overwrite files if necesary.
    -h, --help Display this help.
if [ "$1" = "-q" ] || [ "$1" = "--quiet" ]; then

case $1 in
    "" ) if [ "$interactive" = "0" ]; then
            echo -n "What will you name your script? >" #In case they forgot, we do not want to crash
            read name
        echo "No file supplied." 1>&2
        exit 1

    "-h" | "--help") usage
                     exit 0;;
    * ) name=$1;;


mode=777 #A default
command="gedit +2 -b" #Also a default

case $2 in
    [0-8][0-8][0-8] ) mode=$2; shift;; #I will adapt it in the future to accept more values of chmod

case $2 in
    "" ) :;;
    * ) command=$2

if [ -f $name ] && [ "$interactive" = "0" ]; then
    echo -n "The file \"$name\" exists. Do you want to overwrite it? (y/n)>"
    read response
    if [ $response = 'n' ]; then
        echo "Exiting"
        exit 0

echo -e "#/bin/bash\n\nexit 0" > $name #add in the first line of any shell script
$command $name #Go to line 2, since the first was already done for them. Also, make sure gedit doesn't close when the terminal does, and it doesn't block the terminal.
chmod $mode $name

exit 0

I hope that didn't break it.

share|improve this question
up vote 3 down vote accepted

Looks like you have a bogus gedit on your $PATH, could be created by that script. Try type gedit to find out which gedit is actually launched.

share|improve this answer
I think it was. After finding a file in my bin folder, and doing some editing, I got this. chris@Chris-Ubuntu-Laptop:~$ gedit I am not a gedit imposter. chris@Chris-Ubuntu-Laptop:~$ I am going to put in a safeguard for that. (Seriously, this is a major linux vulnerability Imagine what I could of put in there.) – PyRulez Nov 14 '12 at 22:49
It's not a vulnerability, more a case of "doctor, it hurts when I do this" - "well, don't do that then" :) – Dennis Kaarsemaker Nov 14 '12 at 22:56
Well no, I mean my script isn't quite an attack in its own form, but it could be developed into an attack on other systems. For example, making a program, have it create a script called synaptic make it do rm \* or something like that. Not good. – PyRulez Nov 14 '12 at 23:07
That's why by default $PATH consists of directories only writable by root. When you start adding entries to $PATH, it is assumed that you understand the (risk of) what you're doing. – Dennis Kaarsemaker Nov 14 '12 at 23:11
Okay, that makes it better. And I assume you need sudo to change $PATH. – PyRulez Nov 14 '12 at 23:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.