[Risolto] Alias per Linux Mint

Il ritrovo della comunità dove confrontarsi e discutere sulle notizie dal mondo dell'informatica, di Ubuntu e di tutto quello che la riguarda, novità, pettegolezzi e quant'altro.
Avatar utente
tesseratto
Prode Principiante
Messaggi: 54
Iscrizione: sabato 4 luglio 2009, 15:49

[Risolto] Alias per Linux Mint

Messaggio da tesseratto »

Salve gente,
Sapete come si impostano gli alias su Linux Mint?
Non riesco proprio a trovare il file alias.bash o qualcosa di simile.
Neanche con man -k alias..
:-\
Ultima modifica di tesseratto il sabato 28 novembre 2009, 21:15, modificato 1 volta in totale.
Avatar utente
telperion
Rampante Reduce
Rampante Reduce
Messaggi: 5407
Iscrizione: lunedì 10 luglio 2006, 18:20

Re: Alias per Linux Mint

Messaggio da telperion »

tesseratto ha scritto: Salve gente,
Sapete come si impostano gli alias su Linux Mint?
Non riesco proprio a trovare il file alias.bash o qualcosa di simile.
Neanche con man -k alias..
:-\
devi aprire il file ~/.bashrc

e decommentare le righe

Codice: Seleziona tutto

# 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

Codice: Seleziona tutto

# 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

per avere il file ~/.bash_aliases
Avatar utente
tesseratto
Prode Principiante
Messaggi: 54
Iscrizione: sabato 4 luglio 2009, 15:49

Re: Alias per Linux Mint

Messaggio da tesseratto »

Non ce l'ho questo file...
Devo forse crearlo e mettere le righe che mi hai detto tu? O ve ne sono altre?


vincenzo2342@pcvi ~ $ locate -b bashrc
/etc/bash.bashrc
/usr/share/base-files/dot.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc
vincenzo2342@pcvi ~ $ cat /etc/bash.bashrc
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

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

# 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

use_color=false

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS.  Try to use the external file
# first to take advantage of user additions.  Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?}  # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors  ]] && match_lhs="${match_lhs}$(/dev/null \
        && match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
        # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
        if type -P dircolors >/dev/null ; then
                if [[ -f ~/.dir_colors ]] ; then
                        eval $(dircolors -b ~/.dir_colors)
                elif [[ -f /etc/DIR_COLORS ]] ; then
                        eval $(dircolors -b /etc/DIR_COLORS)
                fi
        fi

        if [[ ${EUID} == 0 ]] ; then
                PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
        else
                PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
        fi

        alias ls='ls --color=auto'
        alias grep='grep --colour=auto'

else
        if [[ ${EUID} == 0 ]] ; then
                # show root@ when we don't have colors
                PS1='\u@\h \W \$ '
        else
                PS1='\u@\h \w \$ '
        fi
fi

# Try to keep environment pollution down, EPA loves us.
unset use_color safe_term match_lhs

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#    ;;
#*)
#    ;;
#esac

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

# sudo hint
if [ ! -e $HOME/.sudo_as_admin_successful ]; then
    case " $(groups) " in *\ admin\ *)
    if [ -x /usr/bin/sudo ]; then
cat ".
See "man sudo_root" for details.

EOF
    fi
    esac
fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found ]; then
function command_not_found_handle {
        # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
  /usr/bin/python /usr/lib/command-not-found -- $1
                  return $?
else
  return 127
fi
}
fi

/usr/bin/mint-fortune
Avatar utente
telperion
Rampante Reduce
Rampante Reduce
Messaggi: 5407
Iscrizione: lunedì 10 luglio 2006, 18:20

Re: Alias per Linux Mint

Messaggio da telperion »

vedi

/usr/share/base-files/dot.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc

dovrebbe essere questo
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc

copialo nelle home come .bashrc
Avatar utente
tesseratto
Prode Principiante
Messaggi: 54
Iscrizione: sabato 4 luglio 2009, 15:49

Re: Alias per Linux Mint

Messaggio da tesseratto »

Fatto. Ma non coincide col tuo file. Non ci sono le righe che mi hai detto di decommentare.

Codice: Seleziona tutto

#########################################################################
#            .bashrc: Personal initialisation file for bash             #
#########################################################################

# This file is executed by interactive shells (ie, shells for which you
# are able to provide keyboard input).  It is the best place to put shell
# aliases, etc.
#
# [JNZ] Modified 23-Sep-2004
#
# Written by John Zaitseff and released into the public domain.


# Variable settings for your convenience

export LANG=en_AU.UTF-8				# We are in Australia
export LC_ALL=en_AU.UTF-8
export TIME_STYLE=$'+%b %e  %Y\n%b %e %H:%M'	# As used by ls(1)
export EDITOR=emacs				# Everyone's favourite editor
export CVSROOT=:ext:cvs.zap.org.au:/data/cvs
export CVS_RSH=ssh

# Useful aliases, defined whether or not this shell is interactive

alias cls=clear
alias ls="ls -v"
alias dir="ls -laF"
alias lock="clear; vlock -a; clear"
alias e="emacs -nw"


# Run the following only if this shell is interactive

if [ "$PS1" ]; then

    export IGNOREEOF=5			# Disallow accidental Ctrl-D

    # Set options, depending on terminal type
    if [ -z "$TERM" -o "$TERM" = "dumb" ]; then
        # Not a very smart terminal
        export PS1="[ \u@\h | \w ] "
    else
        # Assume a smart VT100-based terminal with colour

	# Make sure the terminal is in UTF-8 mode.  This is a hack!
	/bin/echo -n -e '\033%G'

	# Make ls(1) use colour in its listings
        if [ -x /usr/bin/dircolors ]; then
            alias ls="ls -v --color=auto"
            eval $(/usr/bin/dircolors --sh)
        fi

	# Set the terminal prompt
        if [ $(id -u) -ne 0 ]; then
            export PS1="\[\e[7m\][ \u@\h | \w ]\[\e[0m\] "
        else
            # Root user gets a nice RED prompt!
            export PS1="\[\e[41;30m\][ \u@\h | \w ]\[\e[0m\] "
        fi
    fi
fi
Avatar utente
telperion
Rampante Reduce
Rampante Reduce
Messaggi: 5407
Iscrizione: lunedì 10 luglio 2006, 18:20

Re: Alias per Linux Mint

Messaggio da telperion »

Allora facciamola facile:
cancella .bashrc in home

poi creane uno nuovo e mettici dentro gli alias

esempio

Codice: Seleziona tutto

# Useful aliases, defined whether or not this shell is interactive

alias cls=clear
alias ls="ls -v"
alias dir="ls -laF"
alias lock="clear; vlock -a; clear"
alias e="emacs -nw"
salvalo e dovrebbe bastare.
Apri un nuovo terminale o riavvia la sessione.
Avatar utente
tesseratto
Prode Principiante
Messaggi: 54
Iscrizione: sabato 4 luglio 2009, 15:49

Re: Alias per Linux Mint

Messaggio da tesseratto »

Perfetto.
Grazie tante telperion.
Scrivi risposta

Ritorna a “Bar Ubuntu”

Chi c’è in linea

Visualizzano questa sezione: Google [Bot], Hackecattivo e 10 ospiti