Pagina 1 di 1

[Risolto] Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 11:42
da eduardolp3
Cosa ho combinato?!?!?!?

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 11:56
da maxbigsi
hai modificato il file sudoers? AmministrazioneSistema/Sudo

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 12:07
da eduardolp3
No, mai fatto qualcosa del genere. Come faccio a sistemare questo pasticcio?

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 12:38
da Mdfalcubo
Ubuntu o Elementary?

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 15:21
da eduardolp3
Elementary 0.4 Loki.

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 15:50
da daigo
Magari hai fatto casini con .bashrc nella tua home, posta il contenuto del file, magari qualcuno ti sa dire.

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 16:23
da thece
Mi sa che hai fatto saltare qualche impostazione nei Settings del tuo DE. Non penso ne nel file /etc/passwd , ne tantomeno nel file ~/.bashrc .
Comunque, per il file /etc/passwd basta controllare cosa c'è scritto con

Codice: Seleziona tutto

cat /etc/passwd | grep $USER
per il file ~/.bashrc eventualmente basta ripristinarlo dal template (che dovrebbe essere /etc/skel/.bashrc), quindi dovrebbe bastare un

Codice: Seleziona tutto

cp /etc/skel/.bashrc ~/.bashrc

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 18:03
da daigo
io ho fatto una prova adesso, mettendo

Codice: Seleziona tutto

cd /
in fondo a .bashrc ho il tuo stesso output il terminale si apre in /

Codice: Seleziona tutto

ubuntu@ubuntu:/$ ls
bin    core  home            lib         media  proc  sbin  sys  var
boot   dev   initrd.img      lib64       mnt    root  snap  tmp  vmlinuz
cdrom  etc   initrd.img.old  lost+found  opt    run   srv   usr  vmlinuz.old

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 18:07
da thece
... ovviamente ... è che quel comando non dovrebbe proprio esserci in quel file ... al limite un

Codice: Seleziona tutto

cd ~
ma comunque neanche questo dovrebbe esserci

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 18:09
da daigo
si, non dovrebbe esserci.....ma chissà cosa ha fatto lui? non è che trafficando ce lo ha messo?

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 18:10
da thece
daigo [url=http://forum.ubuntu-it.org/viewtopic.php?p=4962877#p4962877][img]http://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto:si, non dovrebbe esserci.....ma chissà cosa ha fatto lui? non è che trafficando ce lo ha messo?
Assolutamente si. Far aprire il terminale sulla root directory lo si può ottenere in tanti modi

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 19:28
da eduardolp3
thece [url=http://forum.ubuntu-it.org/viewtopic.php?p=4962827#p4962827][img]http://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto:Mi sa che hai fatto saltare qualche impostazione nei Settings del tuo DE. Non penso ne nel file /etc/passwd , ne tantomeno nel file ~/.bashrc .
Comunque, per il file /etc/passwd basta controllare cosa c'è scritto con

Codice: Seleziona tutto

cat /etc/passwd | grep $USER
per il file ~/.bashrc eventualmente basta ripristinarlo dal template (che dovrebbe essere /etc/skel/.bashrc), quindi dovrebbe bastare un

Codice: Seleziona tutto

cp /etc/skel/.bashrc ~/.bashrc
Grazie per le risposte,
vorrei dire che non sono un utente esperto ma capisco fin dove posso andare. Non ho mai pasticciato in quella zona li, non capisco cosa può essere successo. Adesso che mi viene in mente, da qualche tempo vedo che quando metto la password di root al posto del solito spazio in bianco vengono degli asterischi tanti quanti sono il numero di caratteri della mia password.

Codice: Seleziona tutto

eduardolp3@eduardolp3-elementary:/$ cat /etc/passwd | grep $USER
eduardolp3:x:1000:1000:eduardolp3,,,:/home/eduardolp3:/bin/bash
eduardolp3@eduardolp3-elementary:/$ cp /etc/skel/.bashrc ~/.bashrc
eduardolp3@eduardolp3-elementary:/$ 
Il contenuto del file .bashrc

Codice: Seleziona tutto

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# We use preexec and precmd hook functions for Bash
# If you have anything that's using the Debug Trap or PROMPT_COMMAND 
# change it to use preexec or precmd
# See also https://github.com/rcaloras/bash-preexec

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

# If this is an xterm set more declarative titles 
# "dir: last_cmd" and "actual_cmd" during execution
# If you want to exclude a cmd from being printed see line 156
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\$(print_title)\a\]$PS1"
    __el_LAST_EXECUTED_COMMAND=""
    print_title () 
    {
        __el_FIRSTPART=""
        __el_SECONDPART=""
        if [ "$PWD" == "$HOME" ]; then
            __el_FIRSTPART=$(gettext --domain="pantheon-files" "Home")
        else
            if [ "$PWD" == "/" ]; then
                __el_FIRSTPART="/"
            else
                __el_FIRSTPART="${PWD##*/}"
            fi
        fi
        if [[ "$__el_LAST_EXECUTED_COMMAND" == "" ]]; then
            echo "$__el_FIRSTPART"
            return
        fi
        #trim the command to the first segment and strip sudo
        if [[ "$__el_LAST_EXECUTED_COMMAND" == sudo* ]]; then
            __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND:5}"
            __el_SECONDPART="${__el_SECONDPART%% *}"
        else
            __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND%% *}"
        fi 
        printf "%s: %s" "$__el_FIRSTPART" "$__el_SECONDPART"
    }
    put_title()
    {
        __el_LAST_EXECUTED_COMMAND="${BASH_COMMAND}"
        printf "\033]0;%s\007" "$1"
    }
    
    # Show the currently running command in the terminal title:
    # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
    update_tab_command()
    {
        # catch blacklisted commands and nested escapes
        case "$BASH_COMMAND" in 
            *\033]0*|update_*|echo*|printf*|clear*|cd*)
            __el_LAST_EXECUTED_COMMAND=""
                ;;
            *)
            put_title "${BASH_COMMAND}"
            ;;
        esac
    }
    preexec_functions+=(update_tab_command)
    ;;
*)
    ;;
esac

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 20:23
da daigo
su ubuntu è così

Codice: Seleziona tutto

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: martedì 28 febbraio 2017, 21:33
da eduardolp3
Secondo te posso usare quello di Ubuntu, oppure cambiare con il file di una Live di elementari?

Allora... :nono:

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: mercoledì 1 marzo 2017, 10:46
da thece
eduardolp3 [url=http://forum.ubuntu-it.org/viewtopic.php?p=4962939#p4962939][img]http://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Secondo te posso usare quello di Ubuntu, oppure cambiare con il file di una Live di elementari?
Sicuramente puoi usare quello di Ubuntu, ma se usi quello fornito dalla tua distro (il cui template è /etc/skel/.bashrc ) è meglio.
Comunque il tuo "problema" non è dovuto al file .bashrc che stai usando, l'impostazione l'hai sicuramente cambiata in qualche altro posto. Forse nelle impostazioni del tuo terminale?

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: mercoledì 1 marzo 2017, 11:11
da eduardolp3
thece [url=http://forum.ubuntu-it.org/viewtopic.php?p=4963019#p4963019][img]http://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto:
eduardolp3 [url=http://forum.ubuntu-it.org/viewtopic.php?p=4962939#p4962939][img]http://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Secondo te posso usare quello di Ubuntu, oppure cambiare con il file di una Live di elementari?
Sicuramente puoi usare quello di Ubuntu, ma se usi quello fornito dalla tua distro (il cui template è /etc/skel/.bashrc ) è meglio.
Comunque il tuo "problema" non è dovuto al file .bashrc che stai usando, l'impostazione l'hai sicuramente cambiata in qualche altro posto. Forse nelle impostazioni del tuo terminale?
Ma hai visto che stamattina è tornato tutto apposto, da solo?!?!?
Grazie comunque.
Devo mettere risolto visto che il problema si è soluzionato da solo?!?!?

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: mercoledì 1 marzo 2017, 11:17
da thece
eduardolp3 [url=http://forum.ubuntu-it.org/viewtopic.php?p=4963027#p4963027][img]http://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Ma hai visto che stamattina è tornato tutto apposto, da solo?!?!?
Grazie comunque.
Devo mettere risolto visto che il problema si è soluzionato da solo?!?!?
Da solo ... non credo. Forse è stato questo comando

Codice: Seleziona tutto

cp /etc/skel/.bashrc ~/.bashrc
che hai dato e ha ripristinato il file .bashrc dal template. Magari effettivamente c'era qualcosa che non andava in quel file, ma non avendolo riportato non lo sapremo mai

Re: Terminale parte dalla cartella FILE DI SISTEMA

Inviato: mercoledì 1 marzo 2017, 11:50
da eduardolp3
Ok, metto risolto.
Grazie!