In Solaris(command Line ), How to get the previous commands?
Hi friends,
I tried with "UP" Keys but I am getting some special charaters only, Is there any method to get the previous commands? Kindly advice ...arun |
did you try the 'history' command? It is typically enabled in Solaris.
|
The default shell (/bin/sh) which is the original Bourne shell doesn't has this feature.
You need to switch to a shell providing command history, like bash, ksh or zsh. |
Thanks Jessy &jlliagre ,
1) I tried the command 'history',which is not working and I don't kow how can i switch to other shells ? 2) How can i know that which shell is using currently? ....Arun |
I suspect you are logged in as root. This is a very bad practice, as you can easily break the system with a mistake.
Create a user account and stick to it. Here are some commands that will create a user account for you with a shell you are familiar with: Code:
useradd -m -k /etc/skel -P "Primary Administrator" -d /export/home/kcarun -s /bin/bash kcarun |
After you have created an ordinary account (which has bash shell), you can use arrow up, and also write "history" and you will get a list of old commands. Like:
1 ls -la 2 cat kebap.txt 3 cat orvar.txt then you can write !ca and press enter, then it will execute the latest command that started with "ca" which is "cat orvar.txt" in this case. |
Thaks for your advice kebabbert,
& jlliagre you are 100% right i am using only root login for my past 1 year in Debian & now that is continuing in SUN also..Thanking you for leading me to the right direction, Arun ( Yesterday i just typed #bash(accidently) in command prompt , after that i am getting the history) |
jlliagre,
I created the user and , read the man pages to understand the options (like -m,-P),but still some more doubts! 1) -k /etc/skel is to copy the profile, what are the advantage of this? 2) echo "* -fstype=lofs :/export/home/&" >> /etc/auto_home , This command appended a line in /etc/auto_home , but for other uses ,we are manually updating this line, for this user(kcarun) the line is differ from others? Quote:
3)"/usr/sbin/automount -v" is used for what purpose? Kindly Advice Arun |
Quote:
Quote:
- lofs is faster than nfs - it works for all users, no need to specify one line for each one. Quote:
|
thanks jlliagre for the help
|
(The profile files are used to setup the environment (PATH, etc) once and for all for each new user, and then every new user will use the environment you just setup. If you dont do this, every user has to setup for instance, the PATH variable)
|
/etc/sudoers
Ok kebabbert,
now i am using my new id for login, In debian by editing "/etc/sudoers " file we can give permisson for executing commands , that arrangement is not in Solaris? ...ARUN |
If you followed the instructions I posted, you are granted the "Primary Administrator" role.
You can run any command as root by prefixing it by "pfexec". |
HI jlliagre,
I tried pfexec method, but it is not working. Quote:
Quote:
How can I findout the rights of the user(kcarun) ? reg Arun |
Quote:
A simple test to check your settings: Code:
$ id Quote:
Quote:
Code:
$ profiles Code:
# /usr/sbin/usermod -P "Primary Administrator" kcarun |
Thanks jlliagre
Yes now it is working , In my system i am planing to create one more user ,then how can i controll the use of "pfexec" by that user? What are the necessary actions while creating an Ordinary user with very low rights? ...Arun |
Accidently i posted 2 times, So edited the msg and removed the comments, ( I dont kow how to remove a posted reply)
Sorry for the trouble ..ARUN |
Quote:
You can remove previously granted rights with this command: Code:
# /usr/sbin/usermod -P "" userid |
jlliagre , Now it is clear.
One of my first cousin is sparingly use my system to view some examination results, I am planing to add a user account for him. Is it possible to create an account with out password? and can log on to GUI for browsing? |
Passwordless acounts are risky but you can give your cousin an empty password.
|
if you are using bash, then the up cursor key will do, but for korn shell, issue first the command set -o vi. to get to the previous command, press escape key followed by small letter k (similar to vi)
|
How to get yesterday's command fired in solaris
Hi all,
Can anybody help me by providing the path or command to know the list of commands fired yesterday in solaris terminal? for example as today is 18.10.2012.. I want to know yesterday (17.10.2012) what were the commands fired in solaris terminal.? pls help. |
There is no timestamping in shell history so there is no way to get that information unless you are using a recent enough bash release and have properly set the HISTTIMEFORMAT variable. If you are using ksh, there are hacks to have your prompt saving the timestamp in the history file.
|
All times are GMT -5. The time now is 03:28 PM. |