Find the answer to your Linux question:
Results 1 to 5 of 5
When I'm at a Linux command prompt (for CentOS) and I enter the following at the $ sign "# comments for future reference." What log will have this comment? I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2011
    Posts
    9

    Entering interactive commands with the "#" sign


    When I'm at a Linux command prompt (for CentOS) and I enter the following at the $ sign "# comments for future reference." What log will have this comment? I went to /var/logs/ but I couldn't find it.

    In a bash script the # sign tells the interpreter to ignore what follows. I know the # command can be used to enter comments interactively. I just want to know where those comments typically go. It probably depends on the level of logging that is enabled.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,755
    As far as I know, this will not be logged anywhere. It is just a shell comment and will not be captured. IE, it goes into that great bit-bucket in the ether...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,446
    In general, /var/log is for daemons.

    Interactive bash commands are more focused on a user,
    so the bash history ("log", if you will) goes to your $HOME: ~/.bash_history
    ( ~ is short for your $HOME, e.g. /home/Pilot22 )

    I just checked, comments are indeed also stored.

    You can see the content of your bash history with
    Code:
    history
    and control its behaviour by setting some keys in ~/.bashrc
    (HISTCONTROL, HISTFILE, HISTFILESIZE, HISTIGNORE, HISTSIZE, HISTTIMEFORMAT)

    More details here
    Code:
    man bash
    You must always face the curtain with a bow.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,755
    Quote Originally Posted by Irithori View Post
    In general, /var/log is for daemons.

    Interactive bash commands are more focused on a user,
    so the bash history ("log", if you will) goes to your $HOME: ~/.bash_history
    ( ~ is short for your $HOME, e.g. /home/Pilot22 )

    I just checked, comments are indeed also stored.

    You can see the content of your bash history with
    Code:
    history
    and control its behaviour by setting some keys in ~/.bashrc
    (HISTCONTROL, HISTFILE, HISTFILESIZE, HISTIGNORE, HISTSIZE, HISTTIMEFORMAT)

    More details here
    Code:
    man bash
    Thanks Irithori (head smack here) - I didn't think about bash history. Just checked, and indeed you are correct!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #5
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,446
    No worries
    You must always face the curtain with a bow.

Posting Permissions

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