PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Befehl mittels Pipe



kollerma
08.03.05, 20:03
Ich habe folgende Probleme:
Ich soll alle Unterverzeichnisse und ihre Größe so auflisten, dass das Verzeichnis, das die meisten Megabytes verwendet, als letztes steht.

Wie kann man das customized prompt ändern?

Ich bin absoluter UNIX-Neuling und bitte dringend um Hilfe...

Danke im voraus...

Matthias

geronet
08.03.05, 20:28
a) du | sort -g

b) mit PS1="sonstwas"

kollerma
08.03.05, 20:34
a) es wird allerdings die größe nicht angezeigt...

b) versteh ich leider nicht ganz...

Der Gestreifte
08.03.05, 20:39
a) Bei mir wird die Grösse mit angezeigt.

b) "Das costomized promt"?
Falls Du den Shell-Prompt (bash prompt) meinst, so wird Dir die Suchfunktion reichlich zu Tage fördern.
Alternative wäre /usr/doc/HOWTO/[Text-oderHTML-Version]/Bash-Prompt-HOWTO/

kollerma
08.03.05, 21:01
a) woran könnte das liegen, dass bei mir die größe nicht angezeigt wird?

Freekazonid
08.03.05, 21:06
a) du | sort -g


da steht aber auch nicht das verzeichnis das am groessten ist am untersten

@kollerma machma du -h dann erkennste auch das du auch die groessenangaben bekommst ;>

Der Gestreifte
08.03.05, 21:10
a) woran könnte das liegen, dass bei mir die größe nicht angezeigt wird?
Keine Ahnung.
Hast Du stichprobenartig überprüft, ob sortiert wird?
Wenn es sortiert wird, müssen in der Ausgabe von "du" Zahlen vorhanden sein, die an "sort" übergeben werden und "sort" sollte die dann auch nicht abschneiden.
Sieht die Ausgabe von "du" vernünftig aus?

kollerma
08.03.05, 21:26
a) ja mit du -h | sort -g sieht die ausgabe z.B.: so aus:
4.0K ./.mc/cedit
24K ./.mc
48K .

b) jetzt quält mir nur noch das customized prompt...
kann man, wenn man "man bash" eingibt, nach gewissen textteilen suchen? wenn ja, wie? das sind nämlich irre viele zeilen ;-)

Freekazonid
08.03.05, 21:32
in man bash wird ich auch net grade wg prompt gucken ;D

http://www.google.de/search?hl=de&q=bash+prompt+howto&btnG=Google-Suche&meta=


gaaanz viel zum guckn&lesen ;>

Der Gestreifte
08.03.05, 21:36
b) jetzt quält mir nur noch das customized prompt...
kann man, wenn man "man bash" eingibt, nach gewissen textteilen suchen? wenn ja, wie?Wie das geht, erfährst Du mit "man man". Um's abzukürzen: "/suchbegriff" sucht nach Begriffen in der manpage. Und weil die von der Bash so gross ist: mit "n" wird das nächste Vorkommen des Begriffs gefunden.
Ich glaub aber nicht, dass Du in der manpage gross fündig wirst.

Freekazonid
08.03.05, 21:42
naja ganz unbrauchbar ist man bash wg prompt ja nicht, aber fuern anfang isses net der burner wenn man nichtma weiss wie man wo den prompt setzt.
wenn du weisst wie man den prompt aendern kann (auch dauerhaft) is das hier ne gudde differenz um den prompt zu gestalten (von man bash)



PROMPTING
When executing interactively, bash displays the primary prompt PS1 when
it is ready to read a command, and the secondary prompt PS2 when it
needs more input to complete a command. Bash allows these prompt
strings to be customized by inserting a number of backslash-escaped
special characters that are decoded as follows:
\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format (e.g., "Tue May
26")
\D{format}
the format is passed to strftime(3) and the result is
inserted into the prompt string; an empty format results
in a locale-specific time representation. The braces are
required
\e an ASCII escape character (033)
\h the hostname up to the first `.'
\H the hostname
\j the number of jobs currently managed by the shell
\l the basename of the shell's terminal device name
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion
following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\A the current time in 24-hour HH:MM format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patchelvel (e.g., 2.00.0)
\w the current working directory
\W the basename of the current working directory
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number nnn
\\ a backslash
\[ begin a sequence of non-printing characters, which could
be used to embed a terminal control sequence into the
prompt
\] end a sequence of non-printing characters

The command number and the history number are usually different: the
history number of a command is its position in the history list, which
may include commands restored from the history file (see HISTORY
below), while the command number is the position in the sequence of
commands executed during the current shell session. After the string
is decoded, it is expanded via parameter expansion, command substitu-
tion, arithmetic expansion, and quote removal, subject to the value of
the promptvars shell option (see the description of the shopt command
under SHELL BUILTIN COMMANDS below).


btw was die leute immer mitm prompt haben :ugly: ein $ oder # reicht doch :>

Hun
08.03.05, 22:05
Wie das geht, erfährst Du mit "man man". Um's abzukürzen: "/suchbegriff" sucht nach Begriffen in der manpage. Und weil die von der Bash so gross ist: mit "n" wird das nächste Vorkommen des Begriffs gefunden.
Ich glaub aber nicht, dass Du in der manpage gross fündig wirst.

Das erfährst du nicht aus
man mansondern aus
man $PAGER


(falls $PAGER nicht gesetzt ist, /usr/bin/pager, was meist ein link auf more, less oder most ist)

Wenn klug******en, dann schon richtig.