How to know which are all the commands used in the past (in Anaconda prompt in Windows 10) ?
1
0
Entering edit mode
2.3 years ago
Student ▴ 30

Hi. Is there a command that allows you to know which are all the commands that a user has typed in Anaconda prompt in Windows 10 ?

For example, in Linux (Ubuntu) I was used to know this just by clicking the arrow pointing up on the keyboard once opened the terminal. In this way I have one by one all the commands used in the past.

In Windows 10 this does not work :( how can I do ?

I hope that this question is suitable for this website and that I have been clear. Thank you in advance.

Manuela.

Prompt Commands Windows Anaconda • 6.3k views
ADD COMMENT
0
Entering edit mode

What is an anaconda prompt? Just windows command line prompt?

ADD REPLY
0
Entering edit mode

I meant this.

ADD REPLY
0
Entering edit mode

I haven't tested these and check if any of following commands work:

  1. doskey /history (in cmd cli)
  2. %userprofile%/.python_history (user profile is yours and open the file with a text pad/notepad)
  3. import readline; print('\n'.join([str(readline.get_history_item(i + 1)) for i in range(readline.get_current_history_length())])) (copy/paste this line and press enter)
ADD REPLY
1
Entering edit mode
2.3 years ago

The word that describes the feature is "command history", the up-arrow key does work on Windows as well as long as the shell is open.

But, unlike Linux, it seems that Windows does not save the history once the terminal is closed (I am not on my Windows machine and I can't check) but this is what I found:

https://serverfault.com/questions/95404/is-there-a-global-persistent-cmd-history

ADD COMMENT
0
Entering edit mode

Windows PowerShell (included in recent versions of windows) does save history of past commands (but can't be used for anaconda based on comment below).

ADD REPLY
0
Entering edit mode

Alas, the anaconda prompt relies on the traditional command-line prompt.

It is basically a command-line terminal shortcut that has all the paths set to properly work with Anaconda.

ADD REPLY
0
Entering edit mode

Thank you all... I searched better and it seems there is a command to know this that is grep -B1 "^# cmd" my_env/conda-meta/history (I found in StackOverflow) but I have problems in installing grep.

ADD REPLY
0
Entering edit mode

try:

conda install grep

or use the findstr command that is supposedly the windows equivalent for grep:

https://www.shellhacks.com/windows-grep-equivalent-cmd-powershell/

ADD REPLY

Login before adding your answer.

Traffic: 1765 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6