Questions tagged [bash-history]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
30 views

View history of terminal and all the details of perticular command

I know how to see history of command that we run on terminal by using {history} command To check perticular no. Of command we run ! Now lets say I ran some other stuff in that command, example for ...
0
votes
0answers
16 views

How do i see time of all the commands typed when i execute “history” [duplicate]

when i type history then i only see no of command and the commands. but what can i write in .bashrc file so that when next time i execute history it shows me time of execution as well. I tried export ...
2
votes
0answers
25 views

How can i write only the latest commands to ~/.bash_history file? [duplicate]

my ~/.bash_history file keeps record of all the commands i've typed. can i not put only the latest commands that i've typed from the start of terminal so that it always show me the recently typed ...
3
votes
1answer
94 views

lines starts with # and integers in .bash_history

I see lines contains #1582696021 . Whats is this? In SIEM we use it seems like a command running by user. Any help or documentation would be appreciated. Best
0
votes
2answers
110 views

No history and path/bash completion on some systems

For some reason, I don't have a history of commands in the terminal and neither can I complete paths or commands. Pressing arrows also show symbols like ^[[D and ^[[C. The shell is bash and .bashrc ...
0
votes
0answers
21 views

Is it possible to view full shell log? [duplicate]

Is it possible to view the outputs history of previous commands and not only shell commands history? If so how? Thanks in advance!
7
votes
1answer
484 views

How to prevent saving bash commands *with* space in front

I read that, in order to not save bash commands to .bash_history, you put a space in front. This worked on all my embedded Linux PCs but not on my desktop with Ubuntu 18.04 LTS. I just thought it was ...
1
vote
1answer
76 views

How can I test if there are entries in the terminal command history in bash?

I'm still quite new to bash scripting and I need a very simple script that, if there is command history, displays it, and, if there isn't, informs the user that there is no command history. What I ...
8
votes
2answers
973 views

How to see time in ~/.bash_history file

I added time to the ~/.bashrc file, so now it shows me time when I execute history command like this: 376 04/10/19 20:39:52 sudo cat ~/.bash_history 377 04/10/19 20:40:04 date 378 07/10/19 ...
1
vote
2answers
1k views

clear terminal cache [duplicate]

I need to clear the terminal cache, I have tried with history -c but it clears the cache in that terminal session, but if I open another session and type history it shows all the previous commands.
0
votes
1answer
128 views

Prevent admins from disabling bash history

I have some admins that don't want their activity seen. They cleverly run set +o history once they log in. Doing so means that commands they run don't get recorded in the history file. Is there a ...
2
votes
1answer
264 views

Can users with the same $HOME have separate bash histories?

I have two users, that have the same home directory: useradd -m -d /home/mydir user1 useradd -m -d /home/mydir user2 and they are in the same group. But I have a problem, when someone logged in the ...
9
votes
1answer
632 views

multiline command chunks in bash history into multiple lines

In Bash (as well as Bash in WSL), multiline written commands can call-back with up/down arrows correctly also builtin history command report them correctly (until I'm still logged-in in bash). But ...
4
votes
1answer
127 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
1k 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
107 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
35 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
3k 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
519 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 ...
1
vote
2answers
115 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
139 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 ...
1
vote
1answer
3k 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
143 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
57 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
147 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
468 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
47 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
101 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 ...
14
votes
5answers
3k 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
410 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 ...
1
vote
1answer
373 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 ...
8
votes
1answer
2k 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
5k 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 ...
4
votes
1answer
5k 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
583 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
175 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
40 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
244 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 ...
11
votes
5answers
20k 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
443 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) ...
12
votes
3answers
34k 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.
6
votes
2answers
13k 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 ...
4
votes
2answers
2k 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
73 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
651 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 ...
5
votes
1answer
1k 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 ...
3
votes
1answer
2k 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
794 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
600 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
157 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 ...