LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 07-31-2007, 08:55 PM   #1
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Rep: Reputation: 15
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
 
Old 07-31-2007, 09:20 PM   #2
jessepangburn
LQ Newbie
 
Registered: Nov 2002
Distribution: RedHat 9.0
Posts: 15

Rep: Reputation: 0
did you try the 'history' command? It is typically enabled in Solaris.
 
Old 08-01-2007, 12:43 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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.
 
Old 08-01-2007, 09:38 AM   #4
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Original Poster
Rep: Reputation: 15
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
 
Old 08-01-2007, 11:53 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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
passwd kcarun
# enter your new password here
echo "* -fstype=lofs :/export/home/&" >> /etc/auto_home
/usr/sbin/automount -v
usermod -d /home/kcarun kcarun
 
Old 08-01-2007, 01:46 PM   #6
kebabbert
Member
 
Registered: Jul 2005
Posts: 461

Rep: Reputation: 41
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.
 
Old 08-01-2007, 08:05 PM   #7
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Original Poster
Rep: Reputation: 15
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)
 
Old 08-02-2007, 06:38 PM   #8
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Original Poster
Rep: Reputation: 15
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:
bash-3.00$ cat /etc/auto_home
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)auto_home 1.6 03/04/28 SMI"
#
# Home directory map for automounter
#
+auto_home
sindhu localhost:/export/home/sindhu
guest2 localhost:/export/home/guest2
joshy 127.0.0.1:/export/home/joshy
* -fstype=lofs :/export/home/&
bash-3.00$

3)"/usr/sbin/automount -v" is used for what purpose?

Kindly Advice

Arun
 
Old 08-02-2007, 07:20 PM   #9
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by kcarun
1) -k /etc/skel is to copy the profile, what are the advantage of this?
Well, it copies the profile files, no big deal.
Quote:

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?
The line I append is equivalent to the one you had with these differences:
- lofs is faster than nfs
- it works for all users, no need to specify one line for each one.

Quote:
3)"/usr/sbin/automount -v" is used for what purpose?
It reloads the settings.

Last edited by jlliagre; 08-02-2007 at 07:21 PM.
 
Old 08-03-2007, 12:43 AM   #10
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Original Poster
Rep: Reputation: 15
thanks jlliagre for the help
 
Old 08-03-2007, 02:44 AM   #11
kebabbert
Member
 
Registered: Jul 2005
Posts: 461

Rep: Reputation: 41
(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)
 
Old 08-03-2007, 01:01 PM   #12
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Original Poster
Rep: Reputation: 15
/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

Last edited by kcarun; 08-03-2007 at 01:03 PM.
 
Old 08-03-2007, 01:51 PM   #13
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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".
 
Old 08-04-2007, 08:51 AM   #14
kcarun
Member
 
Registered: Dec 2006
Location: Cochin,INDIA
Distribution: Debian , OpenSolaris,Ubuntu
Posts: 82

Original Poster
Rep: Reputation: 15
HI jlliagre,

I tried pfexec method, but it is not working.

Quote:
bash-3.00$ who am i
kcarun pts/4 Aug 4 18:59 (:0.0)
bash-3.00$ pfexec ifconfig
ifconfig: Command not found
bash-3.00$
At the time of creating this user i am suspectingthat I changed the below selected part as "Primary Admin", that is only a description of the user or it is the critical part of the command?

Quote:
useradd -m -k /etc/skel -P "Primary Administrator" -d /export/home/kcarun -s /bin/bash kcarun

How can I findout the rights of the user(kcarun) ?

reg

Arun
 
Old 08-04-2007, 09:05 AM   #15
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by kcarun
I tried pfexec method, but it is not working.
Your test didn't demonstrate it worked or not but just that ifconfig isn't in the PATH. You should have run "pfexec /usr/sbin/ifconfig ..." instead.
A simple test to check your settings:
Code:
$ id
uid=10000(jlliagre) gid=10000(jlliagre)
$ pfexec id
uid=0(root) gid=0(root)
Quote:
At the time of creating this user i am suspectingthat I changed the below selected part as "Primary Admin", that is only a description of the user or it is the critical part of the command?
It is indeed critical.
Quote:
How can I findout the rights of the user(kcarun) ?
The profiles precisely:
Code:
$ profiles
Primary Administrator
Basic Solaris User
All
And to fix them if you misspelt Administrator:
Code:
# /usr/sbin/usermod -P "Primary Administrator" kcarun

Last edited by jlliagre; 08-04-2007 at 02:08 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solaris 9 - Command line history itsjustme Solaris / OpenSolaris 4 08-03-2007 01:07 PM
LXer: Useful Commands For The Linux Command Line LXer Syndicated Linux News 0 03-12-2007 10:01 AM
Java Commands for Command Line AceTech Programming 4 08-20-2006 02:55 AM
Time commands from command line ToothlessRebel Linux - Newbie 1 03-09-2005 10:52 AM
shell's command line locks after commands like ls tree_buddy Linux - Networking 17 09-15-2003 10:52 AM


All times are GMT -5. The time now is 04:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration