Results 1 to 5 of 5

Thread: My own log

  1. #1
    Join Date
    Mar 2011
    Beans
    2

    My own log

    Hello, I need to make my own log file:

    date - time
    commands
    date - time
    commands

    When I start new working session in terminal it must append new 'date - time' line to log file. Each command must be written to log file.

    Can you help me with this?

  2. #2
    Join Date
    Jan 2009
    Beans
    111

    Re: My own log

    Probably not the best forum for this

    Try using "script".

    Code:
    script mylog.log
    I guess you could add this to .bashrc to run when opening a shell, and use the -a option to append instead of replacing.

  3. #3
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: My own log

    and configure logrotate to rotate/compress the log.
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

  4. #4
    Join Date
    Mar 2011
    Beans
    2

    Re: My own log

    It is a task for Lab at the university. I need to use ~/.bashrc file. I think that I can use this string in the ~/.bashrc to start session in log file: date +%D >> mylog.log

    After this I think I need to catch every command and append it to the mylog.log. But how can I catch commands after I type Enter?

    I have tried to use "script" but I need to log only commands without output.

  5. #5
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: My own log

    Quote Originally Posted by Acruax View Post
    It is a task for Lab at the university. I need to use ~/.bashrc file. I think that I can use this string in the ~/.bashrc to start session in log file: date +%D >> mylog.log

    After this I think I need to catch every command and append it to the mylog.log. But how can I catch commands after I type Enter?

    I have tried to use "script" but I need to log only commands without output.
    write your own shell.
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •