The officially official Devuan Forum!

You are not logged in.

#1 2017-10-05 10:00:17

devur
Member
From: københavn
Registered: 2017-05-29
Posts: 20

[SOLVED] terminal 'history'

i  have used the terminal command 'history' a few times and wonder that I can not edit in the list
What I would like to have is a list where every single command that has been used appears only once, is that possible ?

Last edited by devur (2017-10-06 07:01:28)


Laptop lenovo
Desktop XFCE 4.10
Os Devuan 1.0

Offline

#2 2017-10-05 13:28:15

fsmithred
Administrator
Registered: 2016-11-25
Posts: 382

Re: [SOLVED] terminal 'history'

sort -u  ~/.bash_history

Online

#3 2017-10-05 16:14:07

devur
Member
From: københavn
Registered: 2017-05-29
Posts: 20

Re: [SOLVED] terminal 'history'

yes, that's get me part of the way
How do I get a numbered list with just one example of each used command
so I can use  !111 to enable a command


Laptop lenovo
Desktop XFCE 4.10
Os Devuan 1.0

Offline

#4 2017-10-05 21:00:28

fsmithred
Administrator
Registered: 2016-11-25
Posts: 382

Re: [SOLVED] terminal 'history'

sort -u  ~/.bash_history > temporary-file
cat temporary-file > ~/.bash_history
nl temporary-file > index_file

Use the index file for reference. You don't want to number the lines in .bash_history, but you do want a numbered list.
This will work until you reach the limit of bash_history, and the commands start scrolling off the top. See 'man bash' for the HISTSIZE setting if you want to change the number of lines that get saved. I don't remember what the default is - maybe 1000 or 2000.

Online

#5 2017-10-06 07:00:32

devur
Member
From: københavn
Registered: 2017-05-29
Posts: 20

Re: [SOLVED] terminal 'history'

Yes, that's the solution wink


Laptop lenovo
Desktop XFCE 4.10
Os Devuan 1.0

Offline

Board footer