• Find ILO IP on a HP server with Linux

    If you forgot what iLO IP has been defined on your linux server and you are working remotely on it, don’t worry, you can still retrieve it with a common tool called¬†ipmitool – available on most of the distros with standard packages:

    [admin@myserver /]# ipmitool lan print
    Set in Progress : Set Complete
    Auth Type Support :
    Auth Type Enable : Callback :
    : User :
    : Operator :
    : Admin :
    : OEM :
    IP Address Source : Static Address
    IP Address : 10.10.50.20
    Subnet Mask : 255.255.255.0
    MAC Address : 1a:2b:3c:4d:56:78
    SNMP Community String :
    BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
    Default Gateway IP : 10.10.50.254
    802.1q VLAN ID : Disabled
    802.1q VLAN Priority : 0
    RMCP+ Cipher Suites : 0,1,2,3
    Cipher Suite Priv Max : XuuaXXXXXXXXXXX
    : X=Cipher Suite Unused
    : c=CALLBACK
    : u=USER
    : o=OPERATOR
    : a=ADMIN
    : O=OEM
    

    If you’re getting such an error when you are using the command:

    [admin@myserver /]# ipmitool lan print
    Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
    

    This means you just need to enable some modules before:

    [admin@myserver /]# modprobe ipmi_devintf
    [admin@myserver /]# modprobe ipmi_si
  • Quit telnet – Escape character

    Stuck with a telnet session that refuses to give you hand back on console?
    No worries… You just have to know the correct command to sort this out!

    When you are opening a telnet connection, you probably got something like:

    user@server# telnet 127.0.0.1 80
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is '^]'.
    

    So, if you want to quit, you just have to use the “escape character” as indicated. But this character is not designed to be typed with 2 characters like “^” and then “]” – you have to use a direct command that can be different depending on your OS:

    • Windows: Ctrl + $
    • Linux: Ctrl + Alt Gr + ]
    • Mac OS: Ctrl + $

    And press Enter once you inserted this escape character so you can get the standard telnet prompt and be able to type quit to exit the prompt.

    This will result in a command like:

    ^]
    telnet> quit
    Connection closed.
    user@server#
    

    And here you go – you’re out of telnet ūüôā !

  • Display time with history command

    When you are using the¬†history¬†command on a UNIX system, by default, you’re only getting an action list with numbers but no date and/or time to complete this history. For that, you have to define an environment variable¬†HISTTIMEFORMAT¬†that will describe how you want to display the timestamp for each command.

    To display the timestamp temporarily (during session), you can just export the variable before sending the command:

    $export HISTTIMEFORMAT="%d/%m/%y %T " ; history
    

    You will get:

    2021  01/04/17 11:54:04 systemctl list-units
    2022  01/04/17 11:54:10 systemctl list-unit-files
    2023  01/04/17 11:54:15 cd /etc/
    2024  01/04/17 11:54:33 ls -lsta
    2025  01/04/17 11:54:33 ps auxw | grep apache
    2026  01/04/17 11:54:35 date
    2027  01/04/17 11:54:35 cd ..
    2028  01/04/17 11:54:37 cd /var/log
    2029  01/04/17 11:54:37 ls -lsta
    2030  01/04/17 11:54:40 cat messages
    2031  01/04/17 15:48:44 history
    2032  01/04/17 15:48:51 export HISTTIMEFORMAT="%d/%m/%y %T " ; history
    

    If you want to keep that display for a future session, you have to add this variable to your bash profile and reload your profile:

    $echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
    $source ~/.bash_profile