create command aliases for a user


 
Thread Tools Search this Thread
Operating Systems Solaris create command aliases for a user
# 1  
Old 05-18-2008
Question create command aliases for a user

Hi all,

I am using Solaris 10 OS on X86. When I add a new user from command
Code:
useradd -d /export/home/vikas -m -s /bin/bash vikas

files local.cshrc, local.login, local.profile and .profile get copied to my home directory (i.e. /export/home/vikas) from /etc/skel/

Which file I have to change to make command aliases and what is the format ?
for e.g. making alias of ls as ls -lrt.

Like in Linux, we have to change .bash_profile as
Code:
ls='ls -lrt'; export ls

to have this effect.

I tried this on local.profile and .profile but it wasnt working.

Also, suppose I need that each time a user logs in a script say /tmp/vikas.sh executes. How to achieve this ? Pls help !

Thanks and Regards,
Vikas
# 2  
Old 05-18-2008
do a man alias
# 3  
Old 05-18-2008
aliases

In your .profile
set ENV=~/.bashrc

In .bashrc
alias ll="ls -l"
and so on

The .bashrc is in your HOME (~) dir.
For more info see: man bash

Hope this helps,
Kind Regards,
Rene
# 4  
Old 05-18-2008
format is

alias alias name='command'
# 5  
Old 05-18-2008
Thanks all,

It worked by changing .profile

Quote:
alias ls='ls -ltr'
Regards,
Vikas
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. OS X (Apple)

Don't understand the practical difference between command aliases and environmental variables

Hey, I'm recently learning Unix from the video course by Kevin Scoglund. I'm stuck at the moment where he goes into Environmenat variables. I have some issues with understanding what's the essential difference between EV and command aliases: for instance, by writing the command alias ll='ls... (3 Replies)
Discussion started by: scrutinizerix
3 Replies

2. Shell Programming and Scripting

Need one line command to create and set password for new user...

Using useradd abc --password password (5 Replies)
Discussion started by: Jagruti Rml
5 Replies

3. Shell Programming and Scripting

Create user with access only to one command

Hi all, Is there any way to create linux user with access only one defined command? For example, I want new user has access only to ls command. (7 Replies)
Discussion started by: nypreH
7 Replies

4. AIX

How to create permanent Aliases?

Hi All Under my root directory I have a file called Aliases. It is owned by root (root:root) and the user (I mean root) has rwx permissions. In this file I have set some aliases like the following alias a="cd /opt/IBM/WebSphere/AppAerver/Profiles" When I run the above alias command from... (0 Replies)
Discussion started by: chrs0302
0 Replies

5. Homework & Coursework Questions

Create script to add user and create directory

first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies

6. UNIX for Dummies Questions & Answers

Aliases wont work after set command

Hi, I have setup my .profile with some helpful aliases and some set commands in it. I have it as: alias gr='autorep -G' alias c='clear' alias x='exit' alias wcl='wc -l' alias l1='ls -1 "$@"' alias ll='ls -l "$@"' alias la='ls -altr "$@"' alias l='ls -ltr "$@"' alias ml='m_ls -ltr... (5 Replies)
Discussion started by: grep_me
5 Replies

7. Shell Programming and Scripting

bash aliases and command chaining with ; (semi-colon)

What am I doing wrong here? Or is this not possible? A bug? alias f='find . >found 2>/dev/null &' f ; sleep 20 ; ls -l -bash: syntax error near unexpected token `;' (2 Replies)
Discussion started by: star_man
2 Replies

8. UNIX for Advanced & Expert Users

Other than root user .Normal user is unable to create files

Hi all, I am using Sun Solaris 9 .In this system normal users unable to create files from the command line.I added these users in bin,adm and even root group i found them unable to create a file. (1 Reply)
Discussion started by: mallesh
1 Replies

9. UNIX for Dummies Questions & Answers

Want to create new users without using "useradd" command and user Interaction.

Don't want to use useradd command to create a new user I am doing manual addition of accounts. Actually I am writing a script and I am working on RedHat7.1 system. What I am trying to do is run the script and pass all the values of the username password and group as command line parameters. Now... (2 Replies)
Discussion started by: syedifti
2 Replies
Login or Register to Ask a Question