General :: How To Get Bash Shell History Range
Oct 4, 2010
How can I get/filter history entries in a specific range?I have a large history file and frequently usehistory | grep somecommandNow, my memory is pretty bad and I also want to see what else I did around the time I entered the command.For now I do this:get match, say 4992 somecommand, then I do history | grep 49[0-9][0-9]this is usually good enough, but I would much rather do it more precisely, that is see commands from 4972 to 5012, that is 20 commands before and 20 after. I am wondering if there is an easier way? I suspect, a custom script is in order, but perhaps someone else has done something similar before.
View 2 Replies
ADVERTISEMENT
May 4, 2010
Is there a way to define an unlimited history in Bash ?
View 3 Replies
View Related
Aug 18, 2010
Possible Duplicate: Can history files be unified in bash? I have bash running in an ssh session, call this session A. I leave the office, go home, ssh to the same box, call this session B. From session B, I'd like to be able to look at the history of session A.
View 1 Replies
View Related
Jun 14, 2011
Is it possible to use the keyboard in order to select some text in the terminal windows that is not in the currently edited line? (for example, in order to copy part of previous command output).
View 3 Replies
View Related
Apr 11, 2011
I want to build a bash script, which can ping a range IP adresses which will be filled in by the admin. If there is no IP-adress filled in, then the script must ping the subnet where the system is logged on. So if my ip is 192.168.1.6, then the script must ping from 192.168.1.1 till 192.168.1.255 Or else, if there is given a beginning and ending ip it must ping that!
The first part of the bash script is to ping a given range (see below). But there is one problem, how can I tell the script to ping from $begin till $end, [..] is of course wrong! But what must be filled in there???
echo "Enter beginning IP-adres:"
read begin
echo "Enter ending IP-adres:"
read end
ping -c 1 $begin [..] $end
The second part is to find my own ip and ping the whole range.. How to do that? I only can find my own IP, but I cant ping the whole range,, how to do that?
#!/bin/bash
ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' |
cut -d: -f2 | awk '{ print $1 }'
View 11 Replies
View Related
Apr 4, 2010
How is shell history specific to each tty? I can't see anything in the history files that would indicate which tty a command was performed on, however if I restart and log in on several ttys, the command order and history is preserved on each. How is this accomplished? This goes for zsh and bash equally.Now for some zsh specific questions.I had a saved webpae, which resulted in a file called doku.php.htm, and a directory called doku.php_files - I could only get zsh to expand the directory. It didnt seem to give me the option to cycle nor did it only complete as much as it could with ambiguity, i.e. to doku.php , so what is this behaviour and where can I read about it?
Secondly I would like to know why zsh interactive shells do not expand the PS1 prompt completely. Whenever I open an xterm or such, the prompt is not the normal PS1 prompt. I read through the manuals and config files, and could see nowhere that staed a different prompt should be used depending on the shell type. Why does this happen, and how can I modify this behavior?Regarding modules, if I install the compat-wifi modules which I assume replace the existing ones, how would I uninstall them? Would I just reinstall the normal kernel modules over them?
View 8 Replies
View Related
Nov 17, 2010
I am working on a x86 target running fedora 9.
Whenever I reboot it, my history returns to some state, and I do not have commands I did in the sessions before the reboot.
What I have to change to have updated history I had before reboot?
View 2 Replies
View Related
Apr 8, 2011
In my organization, we have a centralized home directory for all users which gets mounted from all the machine where user logs in.Since any XYZ user can login to any of hundreds test machines and run 'sudo su - myusername', hence taking control of my home dir.How do I track who took control of my home dir and deleted its contents.
View 3 Replies
View Related
Feb 10, 2011
what command do i use to copy .bash_history to /tmp location?
View 9 Replies
View Related
May 28, 2010
How to Look at history file in unix shell for a user, find 5 most often used commands.
View 5 Replies
View Related
Jun 30, 2011
Is there a way to get the bash history to delete older entries that are identical to the new one?Say the bash history would look like this normally:
Code:
cd ~
ls -l
[code]...
View 4 Replies
View Related
Jan 12, 2010
i want to delete some say 10 previous commands in bash shell!
View 3 Replies
View Related
Jun 8, 2010
I would like to keep track of not only what bash commands I used and when, but also where they were issued from, i.e. what was the current working directory when I issued "foobar" on a particular day and time. Can we ask bash history to keep track of working directories too? I have tried to get an idea of this reading the enormous "man bash", but I don't seem to have an answer yet either way.
View 11 Replies
View Related
Jun 29, 2010
I am using squid proxy server for sharing Internet in my internal network. I would like to know that how can I check the browsing history by individual users web surfing history by their IP addresses?
View 1 Replies
View Related
Jun 7, 2010
Bash's command history is great, especially it is useful when adding the history -a command to the COMMAND_PROMPT.However, I'm wondering if there is a way to log the commands to a file as soon as the Return key is pressed, e.g. before starting the command and not on completion of the command (using the COMMAND_PROMPT option would save the command once the prompt is there again).
I read about auditing programs like snoopy and session recorder like script but I thought they're already too complex for the simple question I have. I guess that deactivating that script logs all the output of the command would lead already in the right direction but isn't there a quicker way to solve that probelm?
View 1 Replies
View Related
May 31, 2010
What's the command to delete bash command history?
View 4 Replies
View Related
Feb 15, 2010
terminal i open i have no history; the history is kept only in that terminal and is gone when i exit the terminal.If I count lines:as a user:
Code:
$ wc -l .bash_history
wc: .bash_history: Permission denied
[code]....
View 2 Replies
View Related
Oct 19, 2010
I have tried a combination of the following lines in .bashrc to try and control duplicates in the bash history file:
export HISTCONTROL=ignoreboth
export HISTCONTROL=erasedups
export HISTCONTROL=ignoredups
[code]....
View 5 Replies
View Related
Nov 23, 2010
installed Ubuntu Server Edition and I've found that my first user has a bash history and I can turn on a coloured prompt by editing my .bashrc etc but new users don't have that!I did : useradd -d /home/newb -m newbpasswd newband the correct looking .bashrc file appears to be in /home/newb but it is being ignore by bash when logged in as newb. Instead I am presented with just a dollar prompt instead of "newb@server"how can I sort out my users with proper prompts?
View 1 Replies
View Related
Mar 26, 2010
i wrote a script to run over a macintosh system
Quote:
#!/bin/bash
history -c
clear
but the script not doing what i am trying to achieve.
View 1 Replies
View Related
Oct 7, 2010
Lets say I wanted to save my bash history permanently. I.e., so I could look in a log somewhere and find some command I used 6 months ago, like the one I used to get my printer drivers installed
View 1 Replies
View Related
Feb 20, 2010
Feel free to just link to another thread where this is (pre)solved; I can't search the forum for the word "for," because it's too short (or maybe the search engine dislikes prepositions).
Is there a way to give the 'for' command a range? Here's what I mean:
Code:
#for i in (1-5); do echo $i; done
Certainly, meat space user; I understand exactly what you're thinking.
1
2
3
4
5
True, I realize I could use
Code:
COUNT=1 ; while [ $COUNT -lt 6 ]...
...but if I can avoid the extra preparatory step I'd prefer to do so.
View 2 Replies
View Related
Mar 14, 2010
I want to change my default shell to tcsh. I used
Code:
usermod -s /bin/tcsh username
command as given at url
But if I open a new shell, it is still a bash shell.
How do I make my default shell as tcsh?
View 6 Replies
View Related
Mar 25, 2010
I used c-shell previously in unix. One of the useful command I used frequently is foreach.> foreach a (`cat list`)>> echo $a need to use bash shell now instead, and realized that I can't use foreach anymore. The command is not found. Does anyone knows if there is similar command / function in bash shell?
View 9 Replies
View Related
May 11, 2011
So I open firefox from my bash shell with:
Code:
firefox google.ca
it opens firefox, I can browse, etc.
Now if I alt-tab back into my shell, i can't enter any commands in the shell.
I know that i can do this if I close firefox, but I want to keep working in my shell with firefox still open.
Is this possible?
View 6 Replies
View Related
Feb 16, 2011
Ubuntu :: save copy of bash entries / history?
View 7 Replies
View Related
Apr 14, 2011
I've been looking for how to set this up in bash with no luck so far. I can change what file the history log is written to, and how much history is saved. But it only writes the saved part when bash exits. Instead, I'd like to have bash write that file continuously as each command is entered (and maybe also do an fsync(2) to flush it to disk). That way I can see the command I crashed the box with Anyone know the magical incantation for that?
But there appears to be nothing that I can find there, in the man page, or other searches, that suggest it even can do continuous.
View 12 Replies
View Related
Oct 26, 2010
Currently the terminal prompt looks like this:[karlis@karlis-desktop current_folder]$How can I minimize the prompt, so that it only shows $ or # without extra info in square brackets?I checked the preferences for the default Gnome-Terminal and Terminator - there are no settings for this. It is pretty hard to use terminal when working in directories with long names.
View 1 Replies
View Related
Apr 12, 2011
I've written a bash shell script (code provided below) that gives the user 4 options. However I'm having a little trouble with the code. Right now when they select option 3, to show the date.It loops over and over again.I have to close the terminal window to stop it because it's an infinite loop. How would I prevent this? Also quit doesn't seem to be working either.
#!/bin/bashe
echo -n "Name please? "
read name
echo "Menu for $name[code]............
View 2 Replies
View Related
Aug 3, 2011
In linux how do I to get the ascii decimal/hex/oct code from a char or a ascii char from a decimal/hex/oct code. I see from the gnu sed user manual that I can use the d# o# x# to specify a character but I am not sure how to use that. If some one has a better way to get the the ` and ' chars through I want to sed with the backtick '`' character and ''' single quote character.
sed '/`/p'
these don't work
sed '/'/p'
sed '/`/p'
View 3 Replies
View Related