Is there any good tool to manage bash history? [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Wanting to remember some impotant cmds, I used to put them in .bashrc_history file and use search to find, like:
$ history | grep alias | grep coffee | grep code
but sometimes history may lost for some reason. Also, usually several terminals, which may rewrite the history.. So is there any tool to manage?

Put this into your ~/.bashrc and re-login (or source the ~/.bashrc)
prompt_command() {
history | sed '$!d' >> /path/to/some/file
}
PROMPT_COMMAND=prompt_command
Now every command you type will be appended to /path/to/some/file immediately after you type it

Related

Efficient way of using auto complete in Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Guys What is a more efficient way of doing the following using auto-complete?
cd
ls
cd bar
ls
cd baz
ls
cd basilio
Try ls -R from the outermost folder, that will recursively list all content.
You haven't specified in which SHELL. In BASH you can do double-tab to see what are your options:
cd [TAB] [TAB] type first few letters [TAB] to complete.
Similar - but better - completion is implemented in ZSH.

Pipe tail output via elinks [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Consider the following command:
elinks -dump file.html
It will print the file, formatted as plain text (without HTML tags).
The file.html is constantly updated and I want to run it through "tail -f like this:
tail -f file.html | elinks -dump
However it's not working. Any ideas?
tail -f only prints lines which are newly added to the end of the file.
If you want to check the output of the command in certain intervalls, watch can do that:
watch elinks -dump file.html

list only five files per archive recursively : ssh [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using below command to get the detailed list of files in each archive in a particular directory. unzip -l ".zip". But the problem with this command is that it is enlisting all the files in the archive. I want to limit the number of files to be listed to 5 per archive.
I am using ssh. Thanks.:)
you can either use head or tail to limit the top n line or bottom n line
unzip -l a.zip | head -n 5

Linux command line....How do I change from $ to #? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm working with the sed editor and I realize that my command prompt is:
[darkchild#localhost ~]$
How can I change this so that it ends in #....and what does this mean?
for example:
[darkchild#localhost ~]#
A friend told me to write this command #!/bin/bash but it does not change the prompt to #.
Can someone educate me?
Canonically # means root shell. You probably do not actually want to do this, because it would confuse other users of your system. If you do actually want to do this, you can edit the PROMPT variable.
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/
You can run the following command:
set prompt=\[`id -nu`#`hostname -s`\]\#\
This is the root user. You can go to this user using the su command.
More info: http://en.wikipedia.org/wiki/Su_(Unix)

How to make Linux shell command stack store only unique commands [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I just reformated my HD and had to overwrite my /home partition. Everything is fine in Linux Mint 11.
Except that the command stack recall with cursor up/down displays repeats of the same command.
Like:
ls
ls
ls
cd ~
should be:
ls
cd ~
Any ideas how to fix this?
Assuming you're using bash:
export HISTIGNORE="&"
I assume you're using bash.
Add this to to your ~/.bashrc
HISTCONTROL=ignoreboth

Resources