Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bash-history]

Refers to the history of commands that have been run previously in Bash.

4
votes
1answer
114 views

when parent directory is mounted on to new volume, i cannot see the sub directory which was existing earlier

After mounting /yesh onto a new volume, I cannot see the sub directory /yesh/data001 which was existing before mounting. If the sub directory is existing where can I find it?
5
votes
1answer
623 views

Command history seems to be missing the first 75 lines

A couple of years ago, I did the automatic distribution update from 14.04 to 16.04. For the first time in my life, I was able to continue to use the computer after the automatic distribution update. ...
1
vote
1answer
44 views

How to keep all bash history

I want to keep my duplicates and all commands started with a space. How do I do that? I have no ideas what to do. Last time that I messed with bash nothing worked at all afterwards.
0
votes
1answer
26 views

Couldn't navigate through directories using bash script

Through script I am not able to change into directories and list the files. cd is not working. Here is my script #!/bin/bash export HOME=/home/yesh DIR_START=2 DIR_END=`wc -l < ${HOME}/conf/...
1
vote
2answers
889 views

bash history log all commands to syslog

I am trying to log all commands ran by all users. I got a solution from Github function log2syslog { declare COMMAND COMMAND=$(fc -ln -0) logger -p local1.notice -t bash -i -- "${...
6
votes
2answers
478 views

Creating a complete and alphabetically sorted .txt file of bash history

I want to have a complete and sorted list of my bash history. But there are some problems: By doing history the list never shows the complete list and only 1000 commands are shown. In my $HOME ...
2
votes
2answers
71 views

Cannot connect to the internet after cleaning history

I was using a friend's laptop with an Ubuntu 16 OS. I was asked to clean the historic files an after browsing a few websites, I used: cat /dev/null > ~/.bash_history command which appear not ...
2
votes
1answer
92 views

Gnome Shell command prompt history

I have a question regarding the Gnome Shell command prompt (Alt+F2). I already know that I can delete/reset the command history using dconf, but is there a way to completely disable it? Also, where ...
0
votes
1answer
590 views

Why is history and .bash_history different and how to delete an entry in history?

So I know ~/.bash_history should be the file storing all the history and that you can just type in history to see all the contents of this file. Why would my .bash_history file have just 5 entries ...
0
votes
1answer
124 views

Terminal saves junk values in history

When I'm pressing upper arrow to browse history for some reason the terminal saves either bad out put and good output (commands and junk). for example when I'm typing the following junk it remember ...
0
votes
1answer
36 views

Reverse-i-search jumps back in time!

Sometimes I want to search for a previously executed command in my console. So I press Ctrl + R and I enter in (reverse-i-search) mode. I start typing my command and I press Ctrl + R again and again ...
0
votes
0answers
97 views

How does setting the time format in .bash_history work?

I turned on the time logging flags for .bash_history (HISTTIMEFORMAT='%F %T ') and as expected, when I checked history, I was able to see the time at which commands were executed, up to a point. And ...
2
votes
0answers
179 views

How to delete bash history for specific date range [duplicate]

I know how to delete the complete history of all the commands I have ran in my bash terminal, however, I don't want to delete all the history. What I want is to delete the history for a specific ...
0
votes
1answer
43 views

Create record of bash-commands and its properties

I want to keep a history of whatever I do on bash and its output. I need to create a DB which can store command path (at command time) command start time command end time output of the command Can ...
1
vote
0answers
51 views

Wanted to disable history -c for all users except the one with sudo rights?

I am able to secure .bash_history and .profile files so that user cannot delete or edit those files and cannot change shell as well. I needed this for bastion host for all production instances. I ...
13
votes
4answers
2k views

Hide “history -d” in bash history

If I accidentally type my password or anything else sensitive in bash I can easily remove that line with history -d ROW#, but I'm always left with the history -d ROW# command in history showing ...
12
votes
1answer
352 views

Terminal replacing ! followed by a number with a command

I'm very confused about my ubuntu terminal session, it seems to replace sections in commands that start by ! followed by a number with seemingly random commands. It does that with !87 replacing it ...
0
votes
1answer
212 views

Excluding some commands from getting stored in bash history only after terminal is closed

Currently I am using $HISTIGNORE to ignore some commands and not save them in bash history. But current behaviour is if I am running a terminal I executed a command which is in $HISTIGNORE then on ...
5
votes
1answer
616 views

How does the history command work?

When I type any command in the terminal, it doesn't appear in my ~/.bash_history file until I exit my session. Also, when I manually edit my ~/.bash_history file (for example I remove the last three ...
8
votes
7answers
4k views

Deleting history from ~/.bash_history

I have a couple questions about the terminal or command line history that is stored in ~/.bash_history. I can see the file in the terminal with the history command but if I try to open it with gedit ...
1
vote
1answer
2k views

HISTCONTROL=ignoreboth doesn't work [duplicate]

The default .bashrc in the standard distribution of Ubuntu 16.04 that comes with AWS has these lines: # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more ...
3
votes
2answers
503 views

After removing .bash_history?

After I remove .bash_history, will .bash_history ever be recreated again? If so what creates it after it has been removed?
0
votes
1answer
117 views

Customise Bash Terminal Font Colours

A short while ago I asked this question, on how to customise the bash terminal font colours. The question was answered and I got the colours wanting, using the link provided by a helpful user. The ...
0
votes
0answers
38 views

show what command is used in graphical mode

Is it possible to use some kind of verbose to show on the terminal what commands are executed when using graphical mode? For example: if I click on chrome it must show: google-chrome. My goal is to ...
-1
votes
2answers
156 views

Add to History Script not working

I am trying to add lines from a file to my history, but it just adds the program code! What am I doing wrong? #!/bin/bash HISTFILE=~/.bash_history set -o history cat file.txt | while read line do ...
5
votes
4answers
10k views

how do I remove the last 5 lines in bash history?

How can I remove the last 5 lines in bash history? So that when I reload the Ubuntu server, or restart it they're not there at all? history -c only removes it from current session, but when I re-...
3
votes
2answers
346 views

!x not found - bash script

I made a simple bash script to run a range of commands in your history, but it's not working. read -p "control + c to cancel" for i in $(seq $1 $2) ...
7
votes
3answers
16k views

Finding an old command in the shell history [duplicate]

How can I find an old command I ran in my terminal? I used an appengine command and wish to just find it in my local command history without researching it online again.
3
votes
2answers
6k views

Half of bash history is missing

The other night I was reading AU Q&A and used a bash command: inxi -???? Problem is today I don't remember characters comprising ????. I want to put the command and parameters into my ...
3
votes
2answers
739 views

Does the `reset` command wipes up the session memory used by commands?

There is a reset command I can use in bash, which I think is part of core-utils. Does it clean up the RAM used by previous commands from the Terminal session? I mean everything written into the ...
1
vote
1answer
64 views

Upon restart my ubuntu commands history number changed

While restarting my ubuntu 16.04 OS, my terminal commands history numbers is changed, only the history numbers is changed my history is saving perfectly. History numbers always display numbers between ...
14
votes
1answer
629 views

Why does the '!!' shortcut fail to execute the previously run command?

Recently I typed at my terminal username:~$ !! and got error from bash: bash: !!: command not found At the same time, it succeeds when done under superuser. I investigated my user's PATH's ...
6
votes
1answer
892 views

make sudoers use their own history file

I just can't seem to get it to work in Ubuntu, it should be a simple answer, maybe someone can help me. All I am trying to do is get a sudoers to use their own history file, but if I set the history ...
2
votes
1answer
1k views

Clear the history of recent commands in terminal [duplicate]

How to clear the history of recent commands in terminal so that I am unable to scroll through them with up and down arrow keys? Closing and reopening the terminal doesn't seem to clear the history. ...
1
vote
3answers
615 views

View terminal history without the line number

How can I get the Ubuntu terminal history without the line number? history history command returns the previous commands with line number. I am looking for something like: cd tizen-sdk\tools ...
1
vote
2answers
396 views

Bash history corrupted after power loss

I went to the store and when I came back, I found that I had forgotten to plug in my laptop and It had died from a low battery. When I rebooted, I was surprised to find that my bash history, instead ...
0
votes
1answer
110 views

the system doesn't read .bashrc and .profile of a user in Ubuntu14.04

Recently I added a new user to linux 14.04, user2, but the home directory of user2 is NOT in /home/user2, I've put it in different place, lets call it home2. useradd -d home2 user2 I already had an ...
1
vote
1answer
96 views

Save stdout and stderr of programs running under GNU Screen when you forgot to redirect it

Long story short: I have launched a pipeline under a GNU Screen and instead of typing: ./pipeline.sh &> file.log I typed: ./pipeline.sh Logs from this pipeline are few thousand lines long ...
2
votes
1answer
576 views

Bash History: Default size should be 500 but getting 1000

As this question suggest that bash keeps last 500 entries in history. But following command suggest otherwise, $ echo $HISTSIZE 1000 I have never changed bash history settings or config files other ...
0
votes
1answer
519 views

why doesn't history work in Ubuntu?

I have a new Ubuntu remote machine set up, and for some reason my history doesn't work. When I try and use the arrow key I get escape codes. Here is my full .profile file, the 1st line works so I ...
1
vote
1answer
399 views

ctrl + r not picking up the latest commands in history

when I enterl ctrl + r and enter a search term it goes back in distant history and never finds the commands that I most recently typed that has this keyword
1
vote
0answers
66 views

I have no idea about how the following lines ended up in my root's .bash_history?

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iJwEAQEKAAYFAlb7STMACgkQh7sHtMmeQOHEcQQAorwdGYtbPMN8aS5hM0hvhy+O s7vxpbSdfvKHVskYUiml0UvC3zhA3cyqMjiKHpnOR4Zhaq4esrPcbHQSzJbn4vGn lW2+...
3
votes
2answers
65 views

Customise up and down keys to match cmd (point-in-time) functionality

How do I customise Bash so that up and down keys are the same as in cmd? E.g. $echo command1 $echo command2 $echo command3 $echo command4 In both Bash and cmd, pressing ↑, ↑, ↑, ENTER will run echo ...
0
votes
1answer
765 views

where to find Terminal log history with commands and it's results?

I tried to install Yocto project in Ubuntu 12.04, when for the first time i got few warnings, and i gave a rerun then i got some other warnings in the terminal. Now, my terminal is exceeded it's ...
0
votes
2answers
5k views

How do I access my Bash History? [duplicate]

I am fairly new to Linux and I need to find a way to show the contents of my Bash History via the command line, and unfortunately I can't seem to find anything that works, or that I can understand. I ...
0
votes
1answer
47 views

Same commands execute when restart terminal

So, some time ago, I copied csv data from a webpage into terminal to save it to a csv file, like echo "field1,field2,field3,...,fieldn, with about 20 lines of text. I did this because I couldn't ...
1
vote
0answers
42 views

Record date when command was executed in the terminal? [duplicate]

bash_history lists only the previous commands executed. Is it possible to record the times ie. date when they were executed?
0
votes
1answer
994 views

How to run an anonymous terminal session?

This question by Paranoid Panda asks about incognito terminal use. This means history is not recorded in bash_history; so you can't access commands that were entered during that session. However this ...
1
vote
1answer
131 views

When I paste a command instead of typing it why does it not get added to history

If I type in a command it is preserved in history, but If I copy and paste a command from other place it is not preserved in history which is annoying if I have to run it again. I think this happens ...
8
votes
2answers
744 views

Install Linux Mint Cinnamon's polished Ctrl+R/“reverse-i-search” on Ubuntu?

In Mint, when you hit Ctrl+R in any terminal, you get a pretty nice UI for the reverse-i-search. (To clarify - I'm referring to the extra polish provided in Mint - the UI is a step above the basic ...