Skip to main content

All Questions

1 vote
1 answer
90 views

How to Set Up Individual Bash History Files for Each Container Alongside a Unified History File?

In my current setup, all of my bash histories are stored in a single file, which is pointed to HISTFILE. This history includes a history of the host system and all containers. Along with this history, ...
Compiled's user avatar
1 vote
1 answer
202 views

bash: function with history -d won't remove history entry

After reading some posts, could not figure out how comes history -d 1 in a function does not delete the entry. The function below goes directly to the command line: function test () { echo "...
rellampec's user avatar
  • 123
3 votes
1 answer
657 views

How to do smart backups of terminal history

Trying to implement smart backups of my zsh terminal history (~/.zsh_history). Same goes for bash no difference just the file is called .bash_history. So far I have decided to create a private git ...
dobro's user avatar
  • 31
0 votes
2 answers
717 views

How to remove any commands that begins with "echo" from history

I have tried the following: history -d $(history | grep "echo.*" |awk '{print $1}') But it is not deleting all the commands from the history with echo I want to delete any commands which ...
Rajarshi Das's user avatar
-2 votes
1 answer
60 views

Why doesn't the bash commands history save datetimes by default in Linux/Debian? [closed]

The bash history does not display or even just save the datetimes of when commands where run. This severely limits the usefulness of the bash history and I can't see any good rationale for it. One can ...
mYnDstrEAm's user avatar
  • 4,598
0 votes
0 answers
112 views

duplicated history entries at the same timestamp

For some time I had an issue with my history using GNU bash (version 4 and 5) where commands appeared in duplicates. I assumed this was due to the fact that in my .bashrc I had the following line: ...
n0542344's user avatar
  • 406
2 votes
2 answers
1k views

Completely Clear Bash History From Shell Script (sysprep)

I'm working on a sysprep-style script which de-identifies a machine and gets it ready for templatizing. The last task that I'd like to perform (before shutdown) is clearing the bash history for the ...
NevDull's user avatar
  • 31
0 votes
1 answer
160 views

Cancel Current Command but Save to History

In bash we can prepend a command with # and insert the non-executed command into our history. Is there a way to achieve similar behavior through some shortcuts or keybinds?
Kahn's user avatar
  • 1,807
0 votes
1 answer
1k views

Why do the line numbers shown by the history command differ from the line numbers of the history file displayed by less and wc -l?

The line numbers from less -N .bash_history and wc -l .bash_history have 44 more lines than the line numbers shown by the bash built-in command history. Comparing the last 20 entries in the history ...
bit's user avatar
  • 1,166
3 votes
2 answers
3k views

What are the cases where the command you typed are lost from the history?

I typed a bunch of commands and when I ran history I saw they were not present in there. Beside the case when the command start with a (space) what are the cases when commands will not be logged in ...
Eduard Florinescu's user avatar
4 votes
3 answers
10k views

Hide ones command history from other users on a Linux server

When I log in via ssh on a Linux(Ubuntu) server, I notice that all the bash commands executed by other users on the server are saved in the command history. Is there a way that could allow me to hide ...
rmb's user avatar
  • 881
4 votes
1 answer
1k views

Why do I get different results with the same user and the history command?

I work with Linux for quite some time and have seen this behaviour but I never got a good explanation. Probably it's even very simple. If I login twice with the same user (bash) in the same server it'...
nsn's user avatar
  • 291
0 votes
1 answer
8k views

where does history timestamp stored before i enable it

I tried to set timestamp for history. My first attempt was do export EXTENDED_HISTORY=ON command, and it seems like doesn't work. Then i do echo 'export HISTTIMEFORMAT="%d.%m.%y %T "' >> /etc/...
林果皞's user avatar
  • 5,486
1 vote
3 answers
611 views

Best tool for monitoring server usage

I was just wondering what the best tools for retracing logs and what logs I should be checking to work out what's going wrong with a server, or what the client has executed to get the server into it's ...
Conner Stephen McCabe's user avatar
26 votes
3 answers
140k views

Can I search bash history across all users on a server?

I want to see all bash commands that have been run on a Linux server across multiple user accounts. The specific distribution I'm using is CentOS 5.7. Is there a way to globally search .bash_history ...
Wesley's user avatar
  • 14.7k

15 30 50 per page