If you use or administer a Linux machine it can be quite useful to be able to take a look at the history of commands that have been executed on a machine. Ja Jūs lietojat vai pārvaldīt Linux mašīna var būt diezgan noderīga, lai varētu veikt apskatīt vēsturē komandas, kas ir veikti uz mašīnas. This can be pretty useful when debugging and issue. Tas var būt diezgan noderīga, ja atkļūdošanas un jautājums. I usually use the command history to help me with this. Es parasti lietoju komandu vēsturē, kas man palīdzēt ar to.
# history # Vēsture
… ...
946 rpm -R mutt-1.4.1-11.rhel4.i386.rpm 946 rpm-R stulbenis-1.4.1-11.rhel4.i386.rpm
947 rpm -qR mutt-1.4.1-11.rhel4.i386.rpm 947 rpm-QR stulbenis-1.4.1-11.rhel4.i386.rpm
948 sudp rpm -qa | mail 948 sudp rpm-qa | Mail
949 sudo rpm -qa | mail 949 sudo rpm-qa | Mail
950 sudo rpm -qa | grep mail 950 sudo rpm-qa | grep pasts
951 rpm -qR sendmail-8.13.1-3.2.el4 951 rpm-QR sendmail-8.13.1-3.2.el4
952 cd scripts/log_parse/ 952 cd skriptus / log_parse /
… ...
This command gives me a straightforward list of the commands executed on this machine by the user I'm currently logged in as. Šī komanda dod man vienkārši saraksts ar komandu izpildīto par šo mašīnu, lietotājs es esmu šobrīd esat pieteicies kā. However, sometimes I need a lot more information than just this. Tomēr dažreiz man ir nepieciešams daudz vairāk informācijas nekā tikai to. I need to know which command was executed at what time. Man vajag zināt, ko komanda tika veikts cikos. For this I make a small modification to the commands settings, adding the date and time to the information output by the command: Šo es veicu nelielu izmaiņām komandas uzstādījumi, piebilstot, datumu un laiku informācijas ieguvi ar komandu:
# export HISTTIMEFORMAT=”%F %T “ # Eksports HISTTIMEFORMAT = "% F% T"
Now run the history and see the difference: Tagad sākas vēsturi un redzēt starpību:
# history # Vēsture
… ...
946 2009-07-20 08:12:33 rpm -R mutt-1.4.1-11.rhel4.i386.rpm 946 2009/07/20 08:12:33 rpm-R stulbenis-1.4.1-11.rhel4.i386.rpm
947 2009-07-20 08:09:33 rpm -qR mutt-1.4.1-11.rhel4.i386.rpm 947 2009/07/20 08:09:33 rpm-QR stulbenis-1.4.1-11.rhel4.i386.rpm
948 2009-07-20 09:49:44 sudp rpm -qa | mail 948 2009/07/20 09:49:44 sudp rpm-qa | Mail
949 2009-07-20 10:37:33 sudo rpm -qa | mail 949 2009/07/20 10:37:33 sudo rpm-qa | Mail
950 2009-07-20 10:17:13 sudo rpm -qa | grep mail 950 2009/07/20 10:17:13 sudo rpm-qa | grep pasts
951 2009-07-20 10:12:23 rpm -qR sendmail-8.13.1-3.2.el4 951 2009/07/20 10:12:23 rpm-QR sendmail-8.13.1-3.2.el4
952 2009-07-20 10:22:43 cd scripts/log_parse/ 952 2009/07/20 10:22:43 cd skriptus / log_parse /
… ...
Add this command to your users .bashrc file to make the change permanent. Pievienot šo komandu, lai saviem lietotājiem. Bashrc failu, lai mainītu permanent.























0 Responses 0 Atbildes
Stay in touch with the conversation, subscribe to the Uzturēt kontaktus ar sarunu, abonēt RSS feed for comments on this post RSS barību komentārus par šo ziņu . .