Results 1 to 6 of 6
Hello,
I've just started using Fedora 8 and am having loads of fun with it...i recently found out about alias commands and how to create them...currently i am trying to ...
- 10-22-2008 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 4
Noob needs a hand with alias commands
Hello,
I've just started using Fedora 8 and am having loads of fun with it...i recently found out about alias commands and how to create them...currently i am trying to make one to delete a logs directory under my /home/user/. Ive tried creating it with the format alias dellogs='rmdir -i /home/user/logs' when i issue the commands it responds with a no such directory error, not sure what i am doing wrong....and also wondering if its possible to make it a system wide command, so my brother may execute it from his account as well.
Thanks in advanced, for any light shed on this issue.Last edited by S-H-A-R-P-Y; 10-22-2008 at 07:06 PM. Reason: Added more description of issue
- 10-22-2008 #2Linux Newbie
- Join Date
- Jan 2008
- Location
- UK
- Posts
- 211
Hi,
Under bash rmdir will not delete directory unless it is empty.
So you want to use alias dellogs='rm -r /home/user/logs'
wowbag1
- 10-22-2008 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 4
Thanks for the reply that helped alot with my formatting, i was just wondering also if its possible to create this alias to be permanant and runable by other users....also since it deletes a file in the home dir, how would i make it so the script can del the logs dir under the current logged in users home dir?
- 10-22-2008 #4Linux Newbie
- Join Date
- Jan 2008
- Location
- UK
- Posts
- 211
Hi again, have a look at this link -it gives a very complete explanation about using alias.
How to use the alias command, by The Linux Information Project (LINFO)
hope this helps
wowbag1
- 10-22-2008 #5
The trouble is more to do with variables than with the alias mechanism as I read it.
You want to distribute this alias under multiple users? Put it in a shared profile for example? Bash has some build in variables that help you with that.
This always points to the current users homedir. By the way, ~otheruser will always point to the homedir of otheruser.Code:~/ # Is always the current users home dir, so... alias dellogs="rm -r ~/logs"
Can't tell an OS by it's GUI
- 10-23-2008 #6Just Joined!
- Join Date
- Oct 2008
- Posts
- 4
Thanks Very Much, Freston Works like a charm.
Article was of assistance as well wowbag thank you.


Reply With Quote