Changes

Jump to navigation Jump to search
1,310 bytes added ,  07:48, 7 October 2014
m
adding comments to shell commands and add date time to bash history
Line 320: Line 320:     
It can take several minutes/hours depending on the size of your drives and their speed. With some luck, the filesystem will be cleaned, and you'll be able to boot.
 
It can take several minutes/hours depending on the size of your drives and their speed. With some luck, the filesystem will be cleaned, and you'll be able to boot.
 +
 +
====Adding notes/comments to shell commands====
 +
You can add comments to shell commands without interrupting the functionality of the shell command. The comments will be appear in .bash_history which can be beneficial for later analysis. e.g. Why was the the command given or who entered the command. Examples:
 +
cat /etc/redhat-release #johnd What version are we running
 +
 +
config setprop sshd status disabled #maryc Disable ssh access ticket:#12345
 +
 +
With (complex) grep arguments one would be able to search the bash history on different criteria. e.g. To find all shell commands given entered by mary that have something to do with ssh (example line above):
 +
cat /root/.bash_history | grep "#mary" | grep ssh
 +
will return:
 +
config setprop sshd status disabled #maryc Disable ssh access ticket:#12345
 +
 +
====Adding date and time to bash history====
 +
By default the bash history does not show the date and time of any activity. You can enable this by entering the following command:
 +
HISTTIMEFORMAT="%d/%m/%y %T "
 +
where %d=day, %m is month, &y is year and %T is time
 +
 +
 +
To see the bash history with the date and time added, enter:
 +
history
 +
 +
 +
the history command can be useful in combination with added comments to shell commands for more precise analysis or (automatic) reporting based on a shell script and cron.
    
===RPM's===
 
===RPM's===

Navigation menu