- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Paging Bill Hassell
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 03:03 AM
02-19-2004 03:03 AM
You advised someone yesterday to alias rm and similar commands to prevent disaster. I had nothing to offer to that poor person, and found myself thinking "There but for the grace of God go I". I have taken your advice, but as I did not make the original post cannot give you any points on it.
Put a post on here, even if it's only a full stop, and I'll give you 10 points for helping me to prevent a future disaster!
Mark Syder (like the drink but spelt different)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 03:21 AM
02-19-2004 03:21 AM
Re: Paging Bill Hassell
(Pardon me for butting in!).
I've got two tips for you:
1) To help avoid a situation like the one in the thread yesterday (running rm -rf when the person *thought* they were in /tmp), I put the pwd in root's prompt, like this:
export PS1="`hostname`$PWD:`whoami`# "
tsws1/tmp:root#
2) I doubt Bill will come to collect his bounty. He's not in this for the points. If he was, we would all be chasing him.
Pete
(A big fat zero would be perfect, thanks)
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 03:50 AM
02-19-2004 03:50 AM
Solution"There are only two types of system administrators: those that have lost critical files and directories, and thos that are going to"
The 'dangerous' commands and moving root's home directory are standard procedures for me when setting up new systems (and fixing old ones). I like the idea that someone checks your work before you actually type rm. Another very important tool is sudo, freely available from the Liverpool archive. With it, you can eliminate the need for giving out the root password as well as preventing users from accessing dangerous commands. You can even limit the valid parameters allowed for a command (like mount or umount).
I'll be giving an all day sysadmin seminar at HP World this year where I'll cover these tips and a bunch more. http://www.hpworld.com/conference/hpworld2004/about.html
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 03:58 AM
02-19-2004 03:58 AM
Re: Paging Bill Hassell
No, I will not be shaving off my hair!
alias
I get this.
autoload='typeset -fu'
command='command '
functions='typeset -f'
history='fc -l'
integer='typeset -i'
local=typeset
ls=/usr/bin/ls
nohup='nohup '
r='fc -e -'
stop='kill -STOP'
suspend='kill -STOP $$'
type='whence -v'
vi=/usr/bin/vi
alias -x rm='/usr/contrib/bin/reallyrm'
the script in /usr/contrib/bin can have reminders prompts, warnings and explanations of doom.
Pete's Suggestion Deserves 10 points. it can be set in the /.kshrc file
and
ENV=/.kshrc in /etc/profile
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 04:02 AM
02-19-2004 04:02 AM
Re: Paging Bill Hassell
I like the original better.
All said was meant in good humor.
Hi Bill.
Good Luck,
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 04:10 AM
02-19-2004 04:10 AM
Re: Paging Bill Hassell
But I had to smile reading Bill's quote.
I think to have heard sometime this slightly modified version:
There are two types of motorbikers.
Those who have fallen, and those who will fall.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2004 04:29 AM
02-19-2004 04:29 AM
Re: Paging Bill Hassell
(Lucky for him I give him so many opportunities)
Pete
(0, thanks)
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2004 08:33 PM
02-22-2004 08:33 PM
Re: Paging Bill Hassell
I've been using something very similar to your PS1 command ever since I came here 10 months ago. It works fine till I change directory - the prompt doesn't change with me! Any ideas how to fix this? If you have, it's worth more than a big fat zero!
Strangely enough, exactly the same command worked the way I wanted it to on AIX systems (i.e. the prompt changed when I changed directory).
Even if I do get the prompt working, I will still be using Bill's aliases. Every day I use the find command to locate a file (not the same file - my memory's not that bad!) via find / -name etc. I also sometimes tidy a directory of old files via find . -mtime +7 etc.
How easy would it be to type find / when I mean to type find .? Too easy for comfort!
Incidentally, the aliases I have set up are del for rm -i and move for mv -i - I may one day want to use rm without the -i: but only when I'm 100% certain I'm in the right directory.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2004 11:56 PM
02-22-2004 11:56 PM
Re: Paging Bill Hassell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 12:02 AM
02-23-2004 12:02 AM
Re: Paging Bill Hassell
I've tried that and it's just the same result - works fine till I change directory.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 12:07 AM
02-23-2004 12:07 AM
Re: Paging Bill Hassell
PS1="$(hostname):\$PWD "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 12:11 AM
02-23-2004 12:11 AM
Re: Paging Bill Hassell
A Spinal Tap answer!
Come back and I'll give you another point - it's worth 11 out of 10!
Mark
PS - if anyone doesn't understand the Spinal Tap reference, do yourselves a favour and rent the film. It's brilliant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 12:13 AM
02-23-2004 12:13 AM
Re: Paging Bill Hassell
I've tested this on Bourne and Korn, and it works OK.
Try this one:
export PS1='hostname':`$PWD) `
(the set of parentheses around PWD are obviously for command substitution).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 12:15 AM
02-23-2004 12:15 AM
Re: Paging Bill Hassell
You need to set the PS1 prompt in your shell's rc file (.shrc, .kshrc, etc.).
export PS1='$PWD # '
That should do it (I think).
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 12:27 AM
02-23-2004 12:27 AM
Re: Paging Bill Hassell
Mark's suggestion worked, so I don't need to try any others.
Jakes - I'm using korn shell and exactly the same command worked the way I wanted it to when I used AIX. Strange but true.
Pete - I've reluctantly agreed to a 0 for your second posting, but generally if someone has helped, or even tried to help but failed, I give them credit for it.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 01:31 AM
02-23-2004 01:31 AM
Re: Paging Bill Hassell
# Terminal character enhancements
export HB=$(/usr/bin/tput dim) # dim text
export HV=$(/usr/bin/tput smso) # 1/2 bright inverse
export IV=$(/usr/bin/tput bold) # inverse
export UL=$(/usr/bin/tput smul) # underline
export BL=$(/usr/bin/tput blink) # blink
export EE=$(/usr/bin/tput sgr0) # end all enhancements
# Some terminal do not have half-bright inverse
# so substitute underline
if tput smso > /dev/null
then
HVUL=$HV
else
HVUL=$UL
fi
HOST=$(hostname)
USER=$(id -un)
PS1='$HVUL$USER $IV${PWD##${PWD%/*/*}/}$EE # '
PS1='$HVUL$HOST $IV${PWD##${PWD%/*/*}/}$EE # '
Pick the first PS1 to show the user login, the second to show the machine name. This code works on all terminals and emulators as long as $TERM matches the terminal. I've attached a simple demo script that shows some of your terminal's display enhancements.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2004 01:42 AM
02-23-2004 01:42 AM
Re: Paging Bill Hassell
That file looks very useful. I've saved it to hard disc for future use.
Mark