cancel
Showing results for 
Search instead for 
Did you mean: 

List of common mistakes

 
SOLVED
Go to solution
Highlighted
Anshumali
Esteemed Contributor

Re: List of common mistakes

avoid @ in passwords..
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Ralph Grothe
Honored Contributor

Re: List of common mistakes

The perils of shell globs as command arguments (especially in connection with potentially highly destructive commands) have been already mentioned by many foreposters.
So when in doubt how the shell would expand those globs it is often advisable to have a "dry-run" in advance to see what would get obliterated by prepending an echo statement to the command line (provided the expansion wouldn't affect hundreds of files which would impair readability).
As we most likely all make use of the shells' keystroke history feature such a practise can generally be easily exercised.
Madness, thy name is system administration
Dennis Handly
Acclaimed Contributor

Re: List of common mistakes

>MK: This is true for all files, including directories.

Except directories can't be removed if they still have files in them.
But if you are saying that you can remove the directory out from under yourself, I've had that happen to me.
Manoj1
Advisor

Re: List of common mistakes

Is there a best way to avoid mistake by
copy pasting the commands using mouse on PUTTY session ?
James R. Ferguson
Acclaimed Contributor

Re: List of common mistakes

Hi:

Two practices that I use constantly:

Remove (or truncate with '>' or 'cat /dev/null >' the shell history file ('.sh_history') that contains the 'reboot' or 'shutdown' command from you last use. This prevents inadvertent command recall and re-execution if you move too quickly.

Get in the habit of using 'set -u' in your shell scripts. This makes unset parameters an error when substituting. What you want to avoid is running a script where you *think* a variable has been set, but it hasn't been and you do something like:

# rm -r /${MYPATH}

If '${MYPATH}' is empty, you just removed everything under the root directory. Ignite, anyone?

Regards!

...JRF...
Raj D.
Honored Contributor

Re: List of common mistakes

Manoj,

> Is there a best way to avoid mistake by
copy pasting the commands using mouse on PUTTY session ?

- If you are trying to run some commands and may be really long commands from your desktop to putty, and trying to paste them, try getting them first on a file ,and then analyze the commands and then you can paste.
- Best open a vi session. $ vi temp-cmds
- ": se noai"
- "right click" , it will paste
- save and review the file. And you can select and paste for actual execution.
(- Remeber there is a chance of getting garbage character when pasting to putty, like "-" "converts to "." etc. so reviewing the pasted commands in vi, before actual executing would fix that.)


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Manoj1
Advisor

Re: List of common mistakes

Anshumali, Is there any reason we should be avoiding @ in password ?
Patrick Wallek
Honored Contributor

Re: List of common mistakes

>>Is there any reason we should be avoiding @ in password

It can have a special meaning to the TTY, especially if you are logging into a serial attached terminal (console).

From the WARNINGS section of the passwd man page:

*****
Avoid password characters which have special meaning to the tty driver, such as # (erase) and @ (kill). You may not be able to login with these characters.
*****
R.K. #
Honored Contributor

Re: List of common mistakes

Hi Manoj,

> Is there any reason we should be avoiding @ in password ?
When logging in, the backspace key will NOT work (if you have mis-typed), use the # key to backspace one character at a time, or use @ to erase the line and start again.
This is why these characters are NOT allowed as part of your login name or password.



Another tip: There are a number of commands which can be run in "preview" mode like vgexport, swinstall, vgscan, make_tape_recovery etc. So, before actually running/executing these commands you can always run them in preview mode to see the outcome. If everything is fine, you can remove "p" and use rest of the command.

Example:
# vgscan -p
(here "p" is for preview mode)

Don't fix what ain't broke
AnthonySN
Respected Contributor

Re: List of common mistakes

be carfull with the tar command the only difference between a backup and restore is just c and x.

if doing any lvm changes in cluster systems have a proper vg map file backup before and after changes.


All men make mistakes, but only wise men learn from their mistakes -- Winston Churchill.