Mint näemmä viisveisaa miehen kertomasta -f valisimesta. Herjaa vain "-f: command not found". Miten Mintissä time-käskyn formaatin saa valittua?
time-formaatti
Anonyymi-ap
32121
0Äänestä
Muut lukivat myös
Odottaa vastausta
Näihin keskusteluihin ei ole vielä vastattu. Ole ensimmäinen.
Vastaukset 32
Vanhimmat
Valitsemalla toimivan Windowsin.
Pysyisit siellä windows-palstoilla kun älyn lahjat ei riitä muuhun.
Etpä oikein älykkäältä vaikuta, kun et peruskomentoja osaa. Me MS-DOS-käyttäjät tiedämme kuinka tietokonetta käskytetään.
No kerroppa dossille tai wintöötille vastaava oi älyn jättiläinen.
Vastataan sitten itselle. Tuo time-käskyn formaatti näyttää toimivan vain sh:ssa. Zsh:sta en tiedä. Bash:sta sain aikaan vain sekunteja. Ne käätyvät helposti tunneiksi, minuuteiksi ja sekunneiksi käskyllä "TZ=UTC0 printf '%(%H:%M:%S)T\n' $aika".
Sille windows-pullistelijalle tiedoksi, että Linuxin time-käsky mittaa prossessin kuluttamaa aikaa eikä sillä ole mitään tekemistä reaaliaika kellon asettamisen kanssa. Niin, tämä oli sellainen peruskomento....
On tuo linkkura vaikea.
Vaikea mutta sillä saa aikaiseksi jotain, mikä on vain märkä uni wintousilla.
Esimerkiksi mitä?
"Niin, tämä oli sellainen peruskomento...."
Millaista se liuskan käyttö oikein on jos peruskomentokin on täysin käsittämätöntä jargonia?
Ei ole välttämättä kaltaisillesi yksinkertaisille ihmisille.
Taidatkin olla ammatti-valittaja? Kärsivällisyys riitä opetteluun?
$ man time
NAME
time - run programs and summarize system resource usage
SYNOPSIS
time [ -apqvV ] [ -f FORMAT ] [ -o FILE ]
[ --append ] [ --verbose ] [ --quiet ] [ --portability ]
[ --format=FORMAT ] [ --output=FILE ] [ --version ]
[ --help ] COMMAND [ ARGS ]
...
-f FORMAT, --format FORMAT
Use FORMAT as the format string that controls the output of
time. See the below more information.
...
The format string usually consists of `resource specifiers'
...
The resource specifiers, which are a superset of those recognized by
the tcsh(1) builtin `time' command, are:
% A literal `%'.
C Name and command line arguments of the command being
timed.
D Average size of the process's unshared data area, in
Kilobytes.
E Elapsed real (wall clock) time used by the process, in
[hours:]minutes:seconds.
F Number of major, or I/O-requiring, page faults that
occurred while the process was running. These are faults
where the page has actually migrated out of primary
memory.
I Number of file system inputs by the process.
K Average total (data+stack+text) memory use of the
process, in Kilobytes.
M Maximum resident set size of the process during its
lifetime, in Kilobytes.
O Number of file system outputs by the process.
P Percentage of the CPU that this job got. This is just
user + system times divided by the total running time.
It also prints a percentage sign.
R Number of minor, or recoverable, page faults. These are
pages that are not valid (so they fault) but which have
not yet been claimed by other virtual pages. Thus the
data in the page is still valid but the system tables
must be updated.
S Total number of CPU-seconds used by the system on behalf
of the process (in kernel mode), in seconds.
U Total number of CPU-seconds that the process used
directly (in user mode), in seconds.
W Number of times the process was swapped out of main
memory.
X Average amount of shared text in the process, in
Kilobytes.
Z System's page size, in bytes. This is a per-system
constant, but varies between systems.
c Number of times the process was context-switched
involuntarily (because the time slice expired).
e Elapsed real (wall clock) time used by the process, in
seconds.
k Number of signals delivered to the process.
p Average unshared stack size of the process, in Kilobytes.
r Number of socket messages received by the process.
s Number of socket messages sent by the process.
t Average resident set size of the process, in Kilobytes.
w Number of times that the program was context-switched
voluntarily, for instance while waiting for an I/O
operation to complete.
x Exit status of the command.
EXAMPLES
To run the command `ls -Fs' and show just the user, system, and total
time:
time -f "\t%E real,\t%U user,\t%S sys" ls -Fs
000
Komento on siis varsin simppeli käyttää.
Onko ohjelmapaketti time asennettu?
Mahtoiko olla? Oletko edes lukenut viestiketjua?
Time on sekä ohjelma että komentotulkin komento. Mikäli time ohjelmaa ei ole asennettu niin komentotulkki suorittaa yksinkertaisemman sisäisen time komennon.
Homma taitaa mennä niin että kun annetaa time komento niin komentotulkki ajaa sisäisen timen. Mikäli mukana on optioita niin sisäinen time ei niitä ymmärrä ja komentotulkki ajaa ulkoisen time ohjelman. Mikäli ohjelmaa ei ole niin komentotulkki antaa virheilmoituksen.
Shell Built-ins vs. GNU BinaryShell Built-in: Shells like Bash and Zsh have their own built-in time keyword. It times pipelines and entire command lines.
...
GNU Utility: The standalone GNU time program lives at /usr/bin/time
Jep. Bash:n SECONDS toimi scripteissä helpommin kuin time. Loppujen lopuksi.
time --help
Usage: ./time [OPTIONS] COMMAND [ARG]...
Run COMMAND, then print system resource usage.
-a, --append with -o FILE, append instead of overwriting
-f, --format=FORMAT use the specified FORMAT instead of the default
-o, --output=FILE write to FILE instead of STDERR
-p, --portability print POSIX standard 1003.2 conformant string:
real %e
user %U
sys %S
-q, --quiet do not print information about abnormal program
termination (non-zero exit codes or signals)
-v, --verbose print all resource usage information instead of
the default format
--help display this help and exit
-V, --version output version information and exit
Commonly usaged format sequences for -f/--format:
(see documentation for full list)
%% a literal '%'
%C command line and arguments
%c involuntary context switches
%E elapsed real time (wall clock) in [hour:]min:sec
%e elapsed real time (wall clock) in seconds
%F major page faults
%M maximum resident set size in KB
%P percent of CPU this job got
%R minor page faults
%S system (kernel) time in seconds
%U user time in seconds
%w voluntary context switches
%x exit status of command
%Tt exit type (normal/signalled)
%Tx numeric exit code IF exited normally
%Tn numeric signal code IF signalled
%Ts signal name IF signalled
%To 'ok' IF exited normally with code zero
Default output format:
%Uuser %Ssystem %Eelapsed %PCPU (%Xavgtext+%Davgdata %Mmaxresident)k
%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
Your shell may have its own version of time, which usually supersedes
the version described here. Please refer to your shell's documentation
for details about the options it supports.
GNU Time website: <https://www.gnu.org/software/time/>
Full documentation at: <https://www.gnu.org/software/time/manual>
E-mail bug reports to: bug-time@gnu.org
Kerroin jo kysyneeni mieheltä.
Onneksi on graafisesti käytettävä toimiva Windows.
Windows wi kyllä ole toiminut enää vuosiin, koska microsoft rikkoo sitä jatkuvasti.
Ja miten se tähän liittyy? Nämä wintoys-puppelit on kuin niitä kesäisin liikkuvia uskon käännyttäjiä. Kukaan ei halua niitä riesakseen. Eikä wintoys-puppeleita.
Kuinka paljon on Windowsin käyttäjiä maailmassa?
Kuinka paljon on mikkisoftalla pakkokäännyttäjiä?
Jos ajat time -f ..., komentotulkki luulee, että -f on oma komentonsa. Kokeile /usr/bin/time -f '...' komento — eli käytä GNU:n time-ohjelmaa shellin mahdollisen sisäänrakennetun time-komennon sijaan.
Kysy Time-lehden toimituksesta.
Eihän komennolle annetut optiot, eli valitsimet, vaikuta millään tavalla siihen löytyykö kyseistä komentoa vai ei. Toi aloituksessa mainittu virhe tarkottaa sitä, että suoritettavaa työkalua itessään ei löydy joten sen nimi on kirjotettu väärin, sen eteen on laitettu virheellinen hakupolku tai sen asentavaa ohjelmapakettia ei ole asennettu.
T. miksuh
Tämän nyt pitäisi olla jokaiselle itsestäänselvää, mutta sanon tämän silti. Alottajan kannattaa muistaa, että itse komennon / työkalun nimen ja sen perään laitettavien optioiden väliin pitää laittaa vähintään uyksi välilyönti. Jos ne kirjottaa yhteen pötköön niin sillon se tulkitaan suoritettavan komennon / työkalun nimeksi ja sillon sitä ei tietenkään löydy Tämä on kyllä niin alkeellinen asia, että jos tästä on kiinni niin sitten suosittelisin opettelemaan sen komentorivin käytön..
T. miksuh
Sen kunniaksi keittelen Presidentti-kahvit!
PS. kannattaa kokeilla joskus "which"-komentoa.
Niin ja muuten. Jos käytössä on Bash -shelli niin sillon time on oletuksena shellin sisäänrakennettu avainsana, joka ohittaa järjestelmän ulkoisen time -komennon. Kun Bash -sehellissä suoritetaan komento time, se ei siis oletuksena suorita ulkoista työkalua vaan shellin sisäisen komennon. Tämän voi todeta antamalla shellissä komento:
type time
T. miksuh
Niin ja Bashin sisäiselle time -avainsanalle ei voi antaa optioita, mutta sen tulostusmuotoa voi muuttaa ympäristömuuttujan avulla.
T. miksuh