On my old notebook (Debian sid) I had this in my ~/.bashrc and it used to work (e.g. history was more or less unlimited and it was being saved on each command): export PROMPT_COMMAND='printf &quot;\033]0;%s@%s:%s\007&quot; &quot;lucio&quot; &quot;t470&quot; &quot;/home/lucio/virtualbit/progetti/workspace/vscode/teom/websi&quot;' export PS1='\[\e[1;31m\]\u\[\e[1;33m\]@\[\e[1;36m\]\h \[\e[1;33m\]\w \[\e[1;35m\]$ \[\e[0m\]' export HISTFILESIZE=9999999 export HISTSIZE=9999999 export HISTTIMEFORMAT=&quot;%d/%m/%y %T &quot; shopt -s histappend export PROMPT_COMMAND=&quot;history -a;history -a;printf &quot;\033]0;%s@%s:%s\007&quot; &quot;${USER}&quot; &quot;${HOSTNAME%%.*}&quot; &quot;${PWD/#$HOME/~}&quot;&quot;  I copied over the same ~/.bashrc on my new notebook (Debian sid like the old one) and verified it's being applied: $ echo $HISTSIZE 9999999  but my history is being cut at 1000 entries. I also tried with HISTSIZE=-1 in my ~/.bashrc (based on  information) with same results: my history is being cut at 1000 lines, but I don't want unlimited history anyway, I want a very high limit, such as 9999999. What am I doing wrong? Why it does not work anymore while it used to work on my old notebook? Maybe there was a package other than bash itself on my old notebook that made it work? EDIT: this question has been marked as duplicate of ,but please note it's not a dup. I already know how to have unlimited history in bash, except that solution DOESN'T work in my case and I don't want unlimited history anyway.
120895
Is there a way to define an unlimited history in Bash ?
46709
On Ubuntu 10.4 I have edited the /etc/bash.bashrc file to set some variables like the command history size (HISTSIZE=5000), however if I create a new users Ubuntu by default gives them a .bashrc file in their home directory with this set as HISTSIZE=1000 which is overriding mine. How can I change the default .bashrc file that is created?
82826
Is it possible to have your bash history save the total execution time of every command you run?  i.e. as if every command were prefaced with 'time' and the result was stored in the history along with the command?  clarification: I already know that you can add a timestamp of when the command was started - but I would like to know the total execution time, not just when it was started.
21193
I use !n where (n) is the line number for executing a line in the history file I want executed at the command prompt which I find via history|less.   But there is a command line history event I wish to manually modify. How can I insert into the command line a history events contents without it actually executing so I can modify and then press return?  Best,
57846
I am accessing an Ubuntu 10.04.2 LTS server via SSH from OSX. Recently the colors stopped working. I think it happened while I was installing/troubleshooting RVM, but I am not positive.  In .bashrc I uncommeneted force_color_prompt=yes, and when I run env | grep TERM I get TERM=xterm-color. But still no colors.   Any ideas? Thanks!  Here is the output of cat .bashrc  # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples  # If not running interactively, don't do anything [ -z "$PS1" ] &amp;&amp; return  # don't put duplicate lines in the history. See bash(1) for more options # ... or force ignoredups and ignorespace HISTCONTROL=ignoredups:ignorespace  # append to the history file, don't overwrite it shopt -s histappend  # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000  # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize  # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] &amp;&amp; eval "$(SHELL=/bin/sh lesspipe)"  # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] &amp;&amp; [ -r /etc/debian_chroot ]; then     debian_chroot=$(cat /etc/debian_chroot) fi   # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in     xterm-color) color_prompt=yes;; esac   # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt force_color_prompt=yes  if [ -n "$force_color_prompt" ]; then     if [ -x /usr/bin/tput ] &amp;&amp; tput setaf 1 &gt;&amp;/dev/null; then     # We have color support; assume it's compliant with Ecma-48     # (ISO/IEC-6429). (Lack of such support is extremely rare, and such     # a case would tend to support setf rather than setaf.)     color_prompt=yes     else     color_prompt=     fi fi  if [ "$color_prompt" = yes ]; then     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt  # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*)     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"     ;; *)     ;; esac  # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then     test -r ~/.dircolors &amp;&amp; eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"     alias ls='ls --color=auto'    alias dir='dir --color=auto'    alias vdir='vdir --color=auto'      alias grep='grep --color=auto'     alias fgrep='fgrep --color=auto'     alias egrep='egrep --color=auto' fi  # some more ls aliases alias ll='ls -alF' alias la='ls -A' alias l='ls -CF'  # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package.  if [ -f ~/.bash_aliases ]; then     . ~/.bash_aliases fi  # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if [ -f /etc/bash_completion ] &amp;&amp; ! shopt -oq posix; then     . /etc/bash_completion fi  [[ -s "/usr/local/rvm/scripts/rvm" ]] &amp;&amp; . "/usr/local/rvm/scripts/rvm"
33197
Following the :     When closing multiple bash instances at the same time, there is a   known race condition that may cause the history to be cleared. This   occurs because there is no locking used when the bash history file is   written.   How can I prevent against this cause of bash history purge?  I use i3wm and I think that it happens mostly when I shutdown the computer before I manually close urxvt terminals. The command used (via keybind) for shutdown is systemctl poweroff.
115914
I am having a lot of trouble setting up the terminal history of Bash the way I want. I would like to have no duplicate entries and if I enter a command I want it saved and the duplicates above removed.  The problem is the history command shows me it is functioning the way I want, but once I log out the duplicates come back again. I believe it is just appending the history to the existing one. I have these lines in my .bashrc file:  HISTCONTROL=ignoreboth:erasedups shopt -u histappend   I have even tried uncommenting shopt, but it still appends the history on logout. How can I have the history be exactly how it is before I logout?
3434
This is a  about how Unix operating systems report memory usage.   Similar Questions:                    I have production server that is running Debian 6.0.6 Squeeze  #uname -a  Linux debsrv 2.6.32-5-xen-amd64 #1 SMP Sun Sep 23 13:49:30 UTC 2012 x86_64 GNU/Linux   Every day cron executes backup script as root:  #crontab -e  0 5 * * * /root/sites_backup.sh &gt; /dev/null 2&gt;&amp;1   #nano /root/sites_backup.sh  #!/bin/bash str=`date +%Y-%m-%d-%H-%M-%S` tar pzcf /home/backups/sites/mysite-$str.tar.gz /var/sites/mysite/public_html/www mysqldump -u mysite -pmypass mysite | gzip -9 &gt; /home/backups/sites/mysite-$str.sql.gz cd /home/backups/sites/ sha512sum mysite-$str* &gt; /home/backups/sites/mysite-$str.tar.gz.DIGESTS cd ~   Everything works perfectly, but I notice that Munin's memory graph shows increase of cache and buffers after backup.  Then I just download backup files and delete them. After deletion Munin's memory graph returns cache and buffers to the state that was before backup.  Here's Munin graph:  Externally hosted image was a dead link.
94555
I've just executed a long-running process from the bash prompt. In hindsight, I wish I'd run time on it, or noted down the time at which I kicked it off.  Is there any way of getting this information retrospectively? The .bash_history doesn't seem to include timestamps.  In my particular case it's Mac OS X, but I'm interested in general Unix/Linux solutions.  To clarify, the process has now completed, and I'd prefer not to run it again unless absolutely necessary!
82471
I've installed a version of Ubuntu Server and although I'm fairly still fresh with Ubuntu, I'm trying to create a bash file to run a program in the background. More importantly, I'm trying to get a file nameto display correct and create it before I start running the program (I like my debug stuff).  However, here is my bash script:    #!/bin/bash  PATH="/var/log/servers/Game/"  FILENAME="startup"  EXT=".log"  DATE=$(date +%d-%m-%Y)  NEWFILE=${PATH}${FILENAME}_${DATE}${EXT}   I have verified that the file does exist in the PATH directory. However, the issue is with the date command. When I run the script bash -x game.sh this is what is displays.   + PATH=/var/log/servers/Game/  + FILENAME=startup  + EXT=.log  ++ date +%d-%m-%Y  game.sh: line 5: date: command not found  + DATE=  + NEWFILE=/var/log/servers/Game/startup_.log  + echo /var/log/servers/Game/startup_.log   I don't understand why it would say the command doesn't work, when I can go to the main console and run date and get a valid response.  Any help is greatly appreciated!
26600
On the bash command-line, ↑ gives me the previous command. On the command-lines in ipython or matlab, when I type a few characters, ↑ gives me the previously entered command starting with those characters. How can I enable exactly this behaviour in bash? I am aware of more advanced ways of searching through the command-line history, but sometimes a simple way is more convenient.
100592
In Bash (as well as Bash in WSL), multiline written commands can call-back with up/down arrows correctly also built-in history command report them correctly (until I'm still logged-in in bash). But after exiting from bash and press up/down arrows, multiline commands appears each as separate entries and that's because cat ~/.bash_history has chucked the command on multiple separate entries and writing problem here; the history command result messed too. I have set these options in ~/.bashrc shopt -s cmdhist lithist HISTTIMEFORMAT='%F %T '  and now writing problem fixed but history command still report in multiple line and separate entries (reading problem now). Bash version is 4.3, same issue on v4.4 there is  since a long years but no solution yet. Update: it's also to mention that below multiline command as an example is correctly displaying even after exit Bash: for i in {1..10} do echo $i done  but this is failing: awk ' { print $1}' &lt;&lt;&lt;'first last'  Update 2: the issue mentioned above is fixed in Bash v5.0.0+ that changed to recognize entries between &quot;timestamp as delimiter&quot; as single entry of command (HISTTIMEFORMAT, cmdhist and lithist must be set).
122042
I am trying to create a script that requires me to print the debian codename so that I may echo it into the sources.list file.  I am trying to make this script work across any version of Debian, so I had hoped to set a bash variable of the release codename. This would be simple to do (with lsb_release -c), however our deployment images do not contain lsb_release by default - and with this script being required to fix the sources.list, installing lsb-release with apt-get would not be an option.  I have found numerous ways to get the release number and other info about the system, but cannot find a reliable place to get the codename.  Any ideas would be greatly appreciated!  (OS I am testing this with is Debian Squeeze)
31907
When I copy something to the clipboard and press Ctrl + V in Bash, nothing happens; However, right clicking and selecting Paste does the job.  Why? Is there any reasonable issue (I'm sure there is) behind this behavior in Linux?
27380
I often open lots and lots of Terminals [Right now I have 7 open on this workspace] and I often search history with grep to find a command I've just written recently, but I don't want to hunt down the terminal and then scroll up and hunt for it more, etc.. Sometimes my terminals close without 'exit,' and everything I've written is lost [Sometimes I've needed something I'd written in a terminal that was killed].  So is there a way to make it so each terminal writes to .bash_history immediately? or at least once a minute, or something like that?
93977
Is there a way to have in the .bash_history file, listed: the directory where the command has been typed, the date, and the command ?
114583
In my computer at work, my bash shell remembers history from previous sessions, even if I just opened a new terminal. In my computer at home, this doesn't happen. I have the same OS 10.6.8 in both machines and I don't have any history related setting in .bash_profile. How could I set this up on my home computer so it remembers history across sessions?