• Skip to primary navigation
  • Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

bashrc

Bash History With Timestamps

by Ulysses · Oct 31, 2019

If you need to see Bash history with timestamps, use this command.

HISTTIMEFORMAT="%d/%m/%y %T "

HISTTIMEFORMAT="%d/%m/%y %T "

To make it permanent, add it to your .bashrc.

echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
source ~/.bashrc

echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc source ~/.bashrc

Timestamps accuracy is retroactively, meaning it will not be accurate for commands performed prior to the history time format being set.

Filed Under: Linux Tagged With: bash, bashrc, history, timestamps

.bash_profile vs .bashrc

by Ulysses · Aug 21, 2019

.bash_profile is executed for login shells. .bashrc is executed for interactive non-login shells. When you login, .bash_profile is executed. If you are already logged in, .bashrc is executed. .bashrc is also executed when you start a new bash using /bin/bash.

Filed Under: Linux Tagged With: .bash_profile, bash, bashrc, login

Set User Umask

by Ulysses · Aug 20, 2019

How to set up umask for a Linux user.

# sets umask for all users
vi /etc/profile
# sets umask for a user
vi ~/.bashrc

# sets umask for all users vi /etc/profile # sets umask for a user vi ~/.bashrc

Add the following umask line to the file.

umask 0022

umask 0022

Filed Under: Linux Tagged With: bashrc, profile, set, umask

Copyright © 2012–2021