Debian dir so wie bei Suse machen

FreeBSD, Gentoo, openSUSE, CentOS, Ubuntu, Debian
mf-scripts
Posts: 34
Joined: 2006-10-30 00:09
 

Debian dir so wie bei Suse machen

Post by mf-scripts »

Ich hatte gerade das Vergnüngen an einem Suse Server etwas zu ändern. Dabei ist mir aufgefallen, dass die "dir" funktion dort viel schöner ist. Man sieht, ob es eine Datei oder ein Verzeichnis ist (farbig dargestellt) und wann die datei geändert wurde, sowie die Rechte.
Wenn ich "dir" auf meinem Debian Server aufrufe stehen die Dateien/Ordner da alle in einer Reihe hinter einander und man sieht nicht, ob es ein Ordner oder Datei ist. Gibt es eine Möglichkeit das dort genauso zu machen?
juergen
Posts: 133
Joined: 2004-03-30 14:44
 

Re: Debian dir so wie bei Suse machen

Post by juergen »

Code: Select all

ls --color=auto
mf-scripts
Posts: 34
Joined: 2006-10-30 00:09
 

Re: Debian dir so wie bei Suse machen

Post by mf-scripts »

juergen wrote:

Code: Select all

ls --color=auto
Thx, aber kann man das auch automatisieren, sodass ich das nicht immer eingeben?
juergen
Posts: 133
Joined: 2004-03-30 14:44
 

Re: Debian dir so wie bei Suse machen

Post by juergen »

alias ls='ls --color=auto'
mf-scripts
Posts: 34
Joined: 2006-10-30 00:09
 

Re: Debian dir so wie bei Suse machen

Post by mf-scripts »

thx :)
djcrackman
Posts: 207
Joined: 2005-06-02 11:58
 

Re: Debian dir so wie bei Suse machen

Post by djcrackman »

Und den Alias in /etc/profile eintragen ;).
mf-scripts
Posts: 34
Joined: 2006-10-30 00:09
 

Re: Debian dir so wie bei Suse machen

Post by mf-scripts »

djcrackman wrote:Und den Alias in /etc/profile eintragen ;).
Was soll das bringen?
User avatar
daemotron
Administrator
Administrator
Posts: 2643
Joined: 2004-01-21 17:44
 

Re: Debian dir so wie bei Suse machen

Post by daemotron »

MF-Scripts wrote:Was soll das bringen?

Code: Select all

man alias
Log Dich mal wieder aus und noch mal ein... dann weißt Du, warum Du das besser in /etc/profiles einträgst (je nach Distribution kommen auch noch andere Dateien in Fragen, z. B. /etc/bash/bashrc oder ~/.bashrc)
mf-scripts
Posts: 34
Joined: 2006-10-30 00:09
 

Re: Debian dir so wie bei Suse machen

Post by mf-scripts »

No Manual Entry for alias

Ist das normal das in /etc/profiles nichts drin steht?
Wie muss ich das da rein schreiben?

alias ls='ls --color=auto'
wenn ich das eintrage, klappt das nicht

EDIT: Nach dem Eintragen in ~/.bashrc hat es geklappt :)
User avatar
daemotron
Administrator
Administrator
Posts: 2643
Joined: 2004-01-21 17:44
 

Re: Debian dir so wie bei Suse machen

Post by daemotron »

MF-Scripts wrote:alias ls='ls --color=auto'
wenn ich das eintrage, klappt das nicht
Sollte aber eigentlich. Hast Du danach ein

Code: Select all

source /etc/profile
ausgeführt?
mf-scripts
Posts: 34
Joined: 2006-10-30 00:09
 

Re: Debian dir so wie bei Suse machen

Post by mf-scripts »

jfreund wrote:
MF-Scripts wrote:alias ls='ls --color=auto'
wenn ich das eintrage, klappt das nicht
Sollte aber eigentlich. Hast Du danach ein

Code: Select all

source /etc/profile
ausgeführt?
Nö, aber hast du mein Edit nciht gelesen? ;)
lucki2
Posts: 427
Joined: 2006-10-03 01:31
 

Re: Debian dir so wie bei Suse machen

Post by lucki2 »

Ach, bitte(von Vanilla Debian Sarge):
/etc/skel/.bashrc:

Code: Select all

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'
fi

bzw /root/.bashrc

Code: Select all

# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
Wenn Du andere Farben haben willst mußt Du eben Deine Farbdefinition als Parameter mit geben

Code: Select all

dircolors -p > meineSchoenenFarben
dann ändere Das obige einfach:

Code: Select all

eval "`dircolors  meineSchoenenFarben`"
User avatar
Joe User
Project Manager
Project Manager
Posts: 11190
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: Debian dir so wie bei Suse machen

Post by Joe User »

Wo wir schon dabei sind:

Code: Select all

gentoo ~ # cat /etc/bash/bashrc
# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen !


# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!
        return
fi

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.  #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting.  #139609
shopt -s histappend

# 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.
use_color=false
safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
if [[ -f /etc/DIR_COLORS ]] ; then
        match_lhs=$(</etc/DIR_COLORS)
elif type -p dircolors >/dev/null ; then
        match_lhs=$(dircolors --print-database)
else
        match_lhs=""
fi
[[ $'n'${match_lhs} == *$'n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
        if [[ ${EUID} == 0 ]] ; then
                PS1='[\033[01;31m]h[\033[01;34m] W $[\033[00m] '
        else
                PS1='[\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

gentoo ~ # cat /etc/skel/.bashrc
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen !


# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!
        return
fi

# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
if [[ -f ~/.dir_colors ]] ; then
        eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
        eval $(dircolors -b /etc/DIR_COLORS)
fi

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

# Change the window title of X terminals
case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\"'
                ;;
esac

gentoo ~ # cat /etc/skel/.bash_profile
# /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc

gentoo ~ #
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.