General :: Bash History And Keeping Track Of Current Working Directory?
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.
I would like to have a way to keep track of my working hours easily.
Insert arrival and finish times and have the difference in decimal. For example, if I start at 8:00 and finish at 9:30, 1.5 should be added.
I tried to do this with Calc but couldn't figure it out. I set one column to have entrance time, another one to have exit time and a third one with the difference("=B2-C2"). The result is in a timestamp format and not decimal. If I use another cell to say something like HOURS(D2) it rounds the number rather than give a decimal(would give 9 for 9:20:00).
Is there some way I can track all applications that were opened by a user during a gnome session in ubuntu?Do gdm/gtkwm keep a history of all applications that were opened in some log file?
I am starting a small business for computer repair and was wondering if there is any software available for entering and keeping track of service calls. Right now I am using Kmymoney for keeping track of finances and it seems to be working out ok. I also use day planner to keep track of appointments. However, I haven't found anything to keep track of service calls. Currently, I am pretty much trying to adapt spreadsheets as a "get by" solution but its not that pretty.
This should be a simple thing to accomplish, but I can seem to figure it out. Essentially, I want to have a bash alias or function that will let me recursively grep the current directory. A while back I added this to my .bashrc:
Code:
alias rg="grep -r --exclude=*/.svn/* --exclude=*.swp"
This works fine, (and also ignores any svn and vim swp files), and I can call it like:
Code:
rg foo *
However, 99.999% of the time, I am only interested in searching in the current directory, so the "*" is a bit redundant. Also, I would say 5-10% of the time, I am typing faster than thinking and forget the "*", so grep just sits there trying to read from stdin. It's a pretty minor thing, but ideally I'd like to be able to just type:
Code:
rg foo
I've tried creating a function to handle this:
Code:
function rg(){ grep -r --exclude=*/.svn/* --exclude=*.swp $1 * }
but it behaves exactly the same as the alias above. escaping the "*" with 's doesn't work, and neither does trying `pwd` (or even a hard-coded path) in its place.
the data usage information from the carrier is often several hours old and is accessed in some arcane ways (logging into their website, sending a specific SMS message at best). Here's my idea: single-session data usage is perfectly reported by ifconfig ppp0. The problem is, how tokeep track of previous sessions accumulate the numbers rollover to zero at specified date To be able to do this across computers means that one needs to store it on the modem/SIM card itself. (As a specially crafted SMS message, or a contact).
I've been writing a bunch of bash scripts to make possible non-interactive, secure, cron-based SVN checkouts with CollabNet's SVN client and GNOME Keyring Daemon (aka GKD) and one of the scripts was designed to start GKD, harvest its output, essentially a couple of environment variables, and export those variables in shell of a user the script is run as. All upon user login by sourcing a bash script in ~/.bashrc.The problem is that those environment variables will not be exported, because the script is being run in a sub-shell that exits upon it completion and environment variables get unset for good.Well, the question is how can those variables be set permanently, meaning they're exported and kept untouched even across login-logout sessions?
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.
I was wondering how the current working directory is maintained in linux. I assumed it would simply be an environment variable, but all attempts i've made to change directory by resetting variables shown by env have failed.Is this something that is maintained internally in the command prompt (bash in my case)?The background to this is I'm setting up a script to remotely run commands over ssh. Since separate commands will unfortunately require separate SSH connections, I need to maintain (save and reload) items such as environment variables and current working directory from one call of the script to the next.
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.
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.
Is there some blog, changelog, or place where i can track what issues get fixed in the opensuse gnome 3 implementation, or what features are bein added, what changes are bein made, etc.?For example, if there is some bug in opensuse with gnome 3, where can i read that it has been fixed in the dd/mm update, or that new feature xxxyyy was added in dd/mm update, etc.Im talking about issues, fixes, updates related to gnome 3 with opensuse. Not just opensuse with 2xgnome or kde.
I am in my current directory. I want to copy a directory somewhere else into this current directory. Lets say I want to take it from direc1/direc2 and the directory I want to take is called demo.
Code:
That is what it shows in the man pages, but when I do that, it says cp: no match
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).
I'd like to install Lucid on a spare hard drive I have, so I can do my bit for testing it. I have a feeling that if I just burn the latest alpha .iso and install from that, it will replace my current GRUB, whereas I would prefer to simply add the Lucid install as an option in my current GRUB.
Of course I might be wrong, I just wanted to check before I went ahead with it. I was unable to find the info I needed via searching.
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?
With bash is there a way to push and pop the current working directory? I tried writing bash;cd dir; ./dostuff;exit; but the current directory is now dir.
1. is there a way to prohibit a program from writing data on the hdd? 2. can i have different icons on each gnome workspace and how? 3. how to untar to current directory? "tar -xvvf blablah.tar.gz" does not work "tar -xvvf blabla.tar.gz -C ./" does not work in both cases, the files go into some strange random locations. 4. how can i change the way colors are displayed for different content in the xfce terminal? I used to have red for archives, blue for dirs etc. in kde, but lost all that after changing to gnome.
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?