Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I don't mind a few lines of reboots, but this is getting rather long:
Last login: Tue May 24 11:24:31 2011
Rebooted at 10:14AM 03/25/10 2.6.18-164.el5
Rebooted at 11:13AM 04/22/10 2.6.18-164.el5
Rebooted at 10:54AM 06/01/10 2.6.18-164.el5
Rebooted at 16:19PM 08/12/10 2.6.18-164.el5
Rebooted at 17:02PM 08/16/10 2.6.18-164.el5
Rebooted at 10:38AM 08/19/10 2.6.18-164.el5
Rebooted at 10:46AM 10/05/10 2.6.18-164.el5
Rebooted at 13:21PM 11/11/10 2.6.18-164.el5
Rebooted at 17:35PM 12/15/10 2.6.18-164.el5
Rebooted at 18:55PM 02/16/11 2.6.18-164.el5
Rebooted at 14:01PM 02/17/11 2.6.18-164.el5
Rebooted at 14:27PM 02/21/11 2.6.18-164.el5
Rebooted at 10:57AM 05/23/11 2.6.18-164.el5
Rebooted at 11:05AM 05/23/11 2.6.18-164.el5
How can I clear (or reduce) the history that comes up when ssh to my host?
You can just change the 'last reboot' in your profile to specify the number of entries you want to see. For example, 'last -n3 reboot'. You can change your /etc/logrotate.conf to reduce the rotation interval for /var/log/wtmp, if you just want to keep less data.
Remember this will clear up all history because you are renaming the file (wtmp is the file use to log reboot, login etc history) using the above command and at the same time you are creating a new one for future logging.
The above command will change the ownership to root and group assignment to utmp for logging and at the same time assign rw-rw-r-- permission on /var/log/wtmp
Thank you, but need more information. Where do I change 'last reboot' in my profile?
Most distributions don't list the last reboot. If you or someone you know didn't add it, you'll need to look around to see where it was added. The possible locations vary with the shell. If you're using bash, then check:
~/.bashrc
~/.bash_profile
/etc/bashrc
/etc/profile
and the files in /etc/profile.d/
Thanks guys, but... Could not grep 'last reboot' (or variations) anywhere in those listed files (yes, using bash). And, followed T3RM1NVT0R advice, but it didn't fix it.
my.desktop% ls -ltr wtmp*
-rw-rw-r-- 1 root utmp 812160 May 24 13:21 wtmp.old
-rw-rw-r-- 1 root utmp 1536 May 24 14:24 wtmp
Still getting the entire list of reboots when I ssh to my host. (using Putty btw) This is a corporate linux host. Can it be controlled by corporate policies?
I tried it once again on my RHEL and Linux Mint system and it worked perfectly fine. You can give a try by breaking down the commands. Run them in the following sequence and see if you still get the message:
1. mv /var/log/wtmp /var/log/wtmp.old
2. ls -l | grep /var/log/wtmp (just to make sure that the file has been renamed)
3. touch /var/log/wtmp
4. chown root.utmp /var/log/wtmp
5. chmod 664 /var/log/wtmp
Last edited by T3RM1NVT0R; 05-24-2011 at 04:56 PM.
No error, as you can see from the files listed, it worked. I used sudo to run the commands, as I do not have permissions as user. I have a new wtmp file that is 1.5k in size, compared with the old file that is 812k.
my.desktop% ls -ltr wtmp*
-rw-rw-r-- 1 root utmp 812160 May 24 13:21 wtmp.old
-rw-rw-r-- 1 root utmp 1536 May 24 14:24 wtmp
I can even view the wtmp.old file and see the binary that looks like it logged the reboots, while the new wtmp file doesn't have much in there yet.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.