LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 02-24-2004, 11:27 PM   #1
tez
LQ Newbie
 
Registered: Jun 2003
Location: Sydney, Australia
Distribution: Slackware 9.1
Posts: 15

Rep: Reputation: 0
Running a command from anywhere


Hi all,

Running Slackware 9.1, and havesetup the sudoers file to allow shutdown for all users.


How can I get it so I can type shutdown in any directory (logged in as a user) and it being able to run instead of changing to /sbin to run it?

Thanks
 
Old 02-24-2004, 11:31 PM   #2
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Put /sbin in your path, or just make an alias in your bash profile.
eg
Code:
alias shutdown='/sbin/shutdown'
 
Old 02-24-2004, 11:34 PM   #3
tez
LQ Newbie
 
Registered: Jun 2003
Location: Sydney, Australia
Distribution: Slackware 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
Hi,

Fellow Sydney nix user

Where do I put that in? where's the file?

 
Old 02-24-2004, 11:41 PM   #4
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Good to see fellow Aussie Linux users around here :-)
It depends on the distro, but ~/.bash_profile for per user setting and /etc/profile for system wide should work most of the time.
If it worked you should see it when you type "alias".
 
Old 02-27-2004, 09:54 PM   #5
tez
LQ Newbie
 
Registered: Jun 2003
Location: Sydney, Australia
Distribution: Slackware 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
So if I dont have a bash_profile or bashrc, when I create one, what do these need to contain?
 
Old 02-27-2004, 10:07 PM   #6
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
something like
Code:
#!/bin/bash
                                                                                
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

alias shutdown='/sbin/shutdown'
 
  


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
Running a command across several directories Poetics Linux - Newbie 2 05-15-2005 07:26 AM
sh command running as nobody chongluo Linux - Security 1 12-01-2004 06:03 AM
Running a command at Startup TuxTimo Linux - Newbie 6 02-27-2004 05:11 PM
command running on cd in Daem0hn Linux - General 3 07-22-2003 03:13 AM
auto running command.... / what have i done :| Gear_freak2000 Linux - General 13 06-12-2003 03:47 PM


All times are GMT -5. The time now is 07:07 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