Score:0

how can I find out all the commands entered

gw flag

how can I find out all the commands entered by the user?

I need to know all my entered commands OC: centOS

uz flag
Jos
CentOS is offtopic here, but I'm pretty sure the `history` command will work the just as well.
user1649644 avatar
gw flag
@Jos, No, it does not show commands that were entered in another session
Artur Meinild avatar
vn flag
Does this answer your question? [Is it possible to make writing to .bash\_history immediate?](https://askubuntu.com/questions/67283/is-it-possible-to-make-writing-to-bash-history-immediate)
Score:0
br flag

On all unix-based OS's this is typically achieved by using the history command. If you want to search for a specific command in your history, you can use history | grep "cp". This command takes the output from the history command and pipes it (that's the | character) into grep which checks every line for the string cp. To limit the amount of results the history command provides, add the desired number as the first argument to history: history 15.

If you want to get the history of a different user that your current one, you have to switch to that user first: su myusername.

Keep in mind that if you open multiple sessions as one user, only the first terminal you open will actually save the history if you use bash.

If you need a combined history of all sessions of one user, I would recommend you to use a different shell, fish for example.

user1649644 avatar
gw flag
So I won't see old sessions anymore?
Toby4213 avatar
br flag
If you haven't closed the terminal you want to get the history from, you can try getting the previous commands by pressing the up key on your keyboard to show your previously typed commands. Otherwise, if the command doesn't show up in `history` it wasn't saved.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.