RAK部落:Linux配置history命令显示操作时间、用户和登录 IP

RAK部落提醒大家在使用Linux系统时,可以通过一些相关的配置,会使Linux 在执行 history 命令时同步显示如下内容: 

  • 显示命令执行的时间 
  • 显示执行命令的用户名 
  • 显示执行命令的用户的源 IP

那么今天我们就来讲讲“Linux配置history命令显示操作时间、用户和登录 IP”的配置方法。

需要在 /etc/profile 文件中添加如下配置:

  1. ISTFILESIZE=4000 #默认保存命令是1000条,这里修改为4000条
  2. HISTSIZE=4000
  3. USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` #取得登录客户端的IP
  4. if [ -z $USER_IP ]
  5. then
  6. USER_IP=`hostname`
  7. fi
  8. HISTTIMEFORMAT="%F %T $USER_IP:`whoami` " #设置新的显示history的格式
  9. export HISTTIMEFORMAT

保存完之后,执行 source /etc/profile 使配置生效。

最终显示效果如下:

RAK部落:Linux配置history命令显示操作时间、用户和登录 IP
Linux系统

步骤进行到这里,我们Linux配置history命令显示操作时间、用户和登录 IP的配置方法就完全解决了,RAK部落分享的这篇文章是否有利于你呢?若跟随步骤出现任何问题或交流,可以在下方评论,RAK部落看到会第一时间帮助你解决。

原文链接:,转发请注明来源!

发表评论

  • 44 Responses to “RAK部落:Linux配置history命令显示操作时间、用户和登录 IP”
    • Abpicyr

      cialis full prescribing primary physician near me what if cialis doesnt work <a href="https://tadalafilkiva.com/#">generic cialis</a> - cheapest way buy cialis https://tadalafilkiva.com/# - long does cialis 20 mg work medi website

      回复
    • hydroxychloroquine 200mg coupons

      Great weblog here! Additionally your website loads up fast!

      What host are you the use of? Can I get your affiliate hyperlink for your host?
      I want my web site loaded up as fast as yours lol https://hydroxychloroquinej.jueriy.com/

      回复
    • JDwene

      <a href=http://www.cialisay.com>generic viagra</a> http://www.withoutbro.com

      回复
    • Oamburce

      Information clearly regarded.. <a href=https://www.goldkamagra.com>kamagra oral jelly kaufen deutschland</a> kamagra oral jelly come si usa
      kamagra von ajanta pharma kaufen: https://www.goldkamagra.com kamagra

      回复
    • can hydroxychloroquine prevent coronavirus

      Excellent blog! Do you have any tips and hints for
      aspiring writers? I'm hoping to start my own site
      soon but I'm a little lost on everything. Would you recommend starting with a free platform like Wordpress or
      go for a paid option? There are so many choices out there that I'm
      completely confused .. Any suggestions? Cheers!

      回复
    • Afcws92

      women taking cialis effects betrouwbaar kamagra kopen
      Yvlpgmsi <a href="https://kamagrajellynow.com">kamagra 100mg</a>
      https://kamagrajellynow.com kamagra

      回复
    • cialis by mail usa

      Your means of telling the whole thing in this piece of writing is in fact good, all can simply know it, Thanks a lot.

      回复
    • generic cialis pill identifier

      <a href=https://cialis.mrdgeography.com/>generic cialis pill identifier</a>

      回复
    • Iamburce

      You actually revealed it terrifically! <a href=https://www.goldkamagra.com>kamagra oral jelly</a> kamagra 100mg tablets
      kamagra same day delivery: https://www.goldkamagra.com kamagra tablets for sale uk

      回复
    • viagra without a doctor prescription

      Do you mind if I quote a couple of your posts as long
      as I provide credit and sources back to your website?
      My blog is in the exact same niche as yours and my users would genuinely benefit from a lot of the information you provide
      here. Please let me know if this okay with you. Thanks!

      回复
    • CharlesHob

      tindr , what is tinder
      <a href=http://tinderdatingsiteus.com/?>what is tinder </a>

      回复
    • order viagra 100mg without prescription

      <A HREF="http://viaagra1.com/">order viagra 100mg without prescription</A>

      回复
    • is 20 mg viagra enough

      Excellent write-up. I certainly love this website.
      Continue the good work!

      回复
    • tadalafil without a doctor prescription

      <A HREF='https://atadalafil.online/'>tadalafil without a doctor prescription</A>

      回复
    • viagra rx pharmacy

      <a href="http://viiagra.co/">viagra rx pharmacy</a>

      回复
    • OExcuppy

      natural remedies for high blood pressure - <a href=https://www.withoutbro.com/>viagra prices</a> Ecfc59a
      comparateur de prix cialis france
      prix viagra boite 4: <a href="https://www.withoutbro.com/">generic cialis</a>

      回复
    • how much is cialis daily use

      <a href="https://www.lm360.us/">how much is cialis daily use</a>

      回复
    • cialis cost

      <a href="https://cialzi.com/">cialis cost</a>

      回复
    • what does metronidazole do

      What's up, after reading this awesome post i am too glad to share my experience here
      with colleagues.

      回复
    • CharlesHob

      tindr , tinder dating app
      <a href=http://tinderdatingsiteus.com/?>tinder login</a>

      回复
    • do i need a prescription for azithromycin in uk

      <a href="http://aziithromycin.com/">do i need a prescription for azithromycin in uk</a>

      回复
    • Tinder dating site

      tinder app , how to use tinder
      <a href=http://tinderdatingsiteus.com/?>how to use tinder </a>

      回复
    • tadalafil pills

      <a href="http://vidallista.com/">tadalafil pills</a>

      回复
    • tadalafil for sale

      <a href="http://ciaalis2u.com/">tadalafil for sale</a>

      回复
    • generic viagra

      <a href="https://sildenafili.com/">generic viagra</a>

      回复
    • viagra daily generic

      <A HREF="https://zsildenafil.com/">viagra daily generic</A>

      回复
    • cialis without doctor visit

      <a href=http://tadalafila.online/>cialis without doctor visit</a>

      回复
    • international pharmacy online

      <a href="https://buymeds.mlsmalta.com/">international pharmacy online</a>

      回复
    • Tinder dating site

      browse tinder for free , tinder date

      回复
    • cefixime for pah

      <a href="https://ceefexime.co/">cefixime for pah</a>

      回复
    • tadalafil 40 mg dose

      <a href="https://tadalafil.cleckleyfloors.com/">tadalafil 40 mg dose</a>

      回复
    • amstyles.com

      <a href="https://amstyles.com/">amstyles.com</a>

      回复
    • price for tadalafil

      <a href=https://wisig.org/>price for tadalafil</a>

      回复
    • price of dapoxetine

      <a href=https://ddapoxetine.com/>price of dapoxetine</a>

      回复
    • cialis for daily use generic

      <A HREF="https://tadalafili.com/">cialis for daily use generic</A>

      回复
    • sildenafil generic sildenafil

      <a href="http://droga5.net/">sildenafil generic sildenafil</a>

      回复
    • ivermectin tsc

      <a href="https://ivermectin.mlsmalta.com/">ivermectin tsc</a>

      回复
    • is ivermectin poison

      <A HREF="https://ivermectin.webbfenix.com/">is ivermectin poison</A>

      回复
    • https://lightvigra.com/

      Best viagra brand in canada <a href="https://lightvigra.com/">https://lightvigra.com/</a> viagra for women in india

      回复
    • do africans take hydroxychloroquine

      <a href='https://hydroxychloroquine.mlsmalta.com/'>do africans take hydroxychloroquine</a>

      回复
    • update hydroxychloroquine results

      <a href="https://hydroxychloroquine.webbfenix.com/">update hydroxychloroquine results</a>

      回复
    • what to expect from bimatoprost

      <A HREF='https://carepro1st.com/'>what to expect from bimatoprost</A>

      回复
    • clomid for males

      <a href=https://salemeds24.wixsite.com/clomid>clomid for males</a>

      回复
    • naltrexone near me

      <a href="https://naltrexoneonline.confrancisyalgomas.com/">naltrexone near me</a>

      回复