Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
11-10-2009, 06:38 AM
|
#1
|
Member
Registered: Aug 2009
Posts: 118
Rep:
|
history
Hi,
How to set time for history.And also i want noone edit their bash_profile
in linux.
|
|
|
11-10-2009, 07:06 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
history is based upon a size, not a time. To my knowledge there is no way to have a time based angle on it. As for the bash_profile, if you don't want users to edit their own, does this not really suggest that there is no user specific configurations permitted? In which case, just don't use it. The file is chained on via /etc/bash_profile (AFAIK) so if you remove the sourcing of it, then there will be no need to worry about users own files. Note that this sort of thing can always be bypassed somehow. A user can spawn a secondary shell, with their own config files which set a bash_history and such...
|
|
|
11-10-2009, 07:12 AM
|
#3
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
|
By "time" do you mean number of commands to remember; if so, the default is 500 and you can change that by defining HISTSIZE=1000 (or whatever) in a user's profile. If you mean the time format, that can be changed HISTTIMEFORMAT, also an environment variable. See the manual page for BASH.
If you want to establish a standard, system-wide profile, you can add files in /etc/profile.d for that purpose. Also, you can simply change the owner of individual user profile files (/home/userid/.profile, /home/userid/.bashrc and the like) to root; e.g., chown root.root /home/userid/.filename and chmod 644 /home/userid/.filename. They won't be able to fiddle with them that way.
Bear in mind that any additions you make in /etc/profile.d are only executed one time at login; /etc/profile, the system-wide profile settings, is only read once and it executes whatever is found in /etc/profile.d (only once).
Hope this helps some.
|
|
|
11-10-2009, 07:24 AM
|
#4
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
There is a HISTTIMEFORMAT environmental variable, which allows you to set a time string display in the format specified when the history command is called.
As for not allowing individuals to set their own ~/.bashrc files, read the invocation section of the man page:
Quote:
Originally Posted by man bash
When an interactive shell that is not a login shell is started,
bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist. This may be inhibited by using the --norc option.
The --rcfile file option will force bash to read and execute commands
from file instead of /etc/bash.bashrc and ~/.bashrc.
|
Finally, some advice. I can guess that English is not your native language, but simply posting a simple one-line question without any details explaining what you want to do or why can be hard to understand and is considered a little rude. You didn't even use a proper question form above, in fact.
Try using phrases like "How do I....?" and "What's the best way to ...?" Then add some details about what you are trying to do.
|
|
|
All times are GMT -5. The time now is 07:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|