Slashdot Mirror


What UNIX Shell Config Settings Work for Newbies?

Human_Diastrophism asks: "I'm involved in the roll-out of a new *x-based computing service in my previously Windows-centric organization. I want things set up so that newcomers will understand and like what they see. They should feel encouraged to behave appropriately, i.e. explore and extend the environment for themselves. We're talking about technically literate folk who are simply new to the demands and freedoms of the command line. No shell advocacy, please; it's going to be ksh or bash. What would you put in a .profile or .rc to make things work smoothly and give the user the capabilities and feedback they need? I'm thinking about stuff like 'stty erase ^H' and 'set -o emacs' so the edit keys work, and a compact but informative prompt. But what else would you put in? What would you leave out?"

159 comments

  1. Advice: Install Midnight Commander. by Richard+Steiner · · Score: 4, Informative

    That way, the newbie can perform various filesystem commands or navigate the filesystem without having to know the actual commands at first, and they can slowly wean themselves off the filemanager if they want to later on (it does provide a command line).

    Heck, I still use mc a lot after over 10 years using Linux. It's a very useful tool.

    --
    Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
    The Theorem Theorem: If If, Then Then.
    1. Re:Advice: Install Midnight Commander. by Anonymous Coward · · Score: 0

      I still use mc

      Heh, I've long since aliased mc to mv because of early typos that caused some horrible file manager thing I didn't want to open up :)

    2. Re:Advice: Install Midnight Commander. by afd8856 · · Score: 1

      That's very very true! Although I have quite a bit of command prompt experience (I've been using linux for about 6 years now) I use MC even for basic things such as changing directories.

      If you don't know the directory layout, it's easy to change the directory using the Alt+S combination to jump to a specific letter. Also, Ctrl+X Ctrl+S creates a link, Ctrl+X T copies the current file to the command line, ctrl+O reveals the command line, has ftp browsing, supports most of the archive formats (rpm, zips, rar, tar.gz, bz, etc.

      I love it. It's the first tool I've installed back then when I've tried freebsd (only it took me a while to find out that to call it you had to use midc or something like this, instead of mc.

      --
      I'll do the stupid thing first and then you shy people follow...
    3. Re:Advice: Install Midnight Commander. by Anonymous Coward · · Score: 0

      How useful is mc?

      I'm 35 years old, so I actually saw norton commander. Still-- I've used mc exactly once-- for about 3 seconds.

      I started mc, then I thought "what the fuck is this shit?" and closed it and went back to doing things very slowly while conferring with my "Running Linux" book.

    4. Re:Advice: Install Midnight Commander. by nickthisname · · Score: 1

      I'm 47 years old, I have used Linux for 10 years,
      and I always fall back on mc. Out of curiosity, what
      do you fall back on...Explorer?

  2. $PS1 by Otter · · Score: 3, Informative

    Give them a helpful prompt! We can argue about what that entails (I recommend the path to PWD), but anything functional is better than "bash-2.03" or whatever it is now.

    1. Re:$PS1 by Otter · · Score: 1
      Err, sorry -- -1 redundant. My eyes had glazed over at 'set -o emacs'.

      Instead of a suggestion, then, let's make it the invitation for a $PS1 flamefest...

    2. Re:$PS1 by brunson · · Score: 1

      /me pats otter on the head

      We know emacs is hard... you'd better just stick to something simple and leave the heavy lifting to us. Have you tried Pico? ;-)

      --
      09F911029D74E35BD84156C5635688C0
      Jesus loves you, I think you suck
    3. Re:$PS1 by fm6 · · Score: 2, Interesting
      We can argue about what that entails...
      Can and will.

      A lot of the stuff that traditionally goes in shell prompts is outdated or inappropriate for newbies. If you're using using the shell in a terminal window (as almost everybody does these days, especially newbies), you don't need email notification, time, CPU load, and a lot of other crap you can have in a GUI window. The name of the machine you're on is helpful is you're access a lot of different machines -- but most newbies won't do that. (Let's all sing the Telnet Song!) I like to have the command history number in my prompt, since that makes it easier to repeat a command that hasn't scrolled off the top of the screen yet. Then again, that's obsolete too, since any decent shell has lets you uparrow back to previous commands.

      I used to have something to indicate my shell depth, so I wouldn't forget that I'd shelled out of another program. But I stopped shelling out when job control was invented -- not to mention Xterm windows.

      I guess there's not a lot worth putting in the prompt any more. And what you do put should mostly be embedded in an escape string that puts it in the Xterm window. No, wait a minute, that's obsolete too -- most shells now let you define a hook -- an alias or a script -- that's run before each prompt. Makes more sense to put complicated commands there.

      So probably you should just set the prompt to "% " and forget about it.

    4. Re:$PS1 by gregmac · · Score: 4, Informative

      I personally have settled on

      PS1='[\u@\h:\w]\$ '

      as my prompt. I work on many different systems (it's not uncommon for me to have 3 or 4 different sessions to different machines), so the hostname is almost a requirment. Username is a bit handy as well .. and it doesn't take up lots of space, so that's ok.

      I also started using \w as my path (which prints the full path) simply because it would be too easy to lose track without it. When you come back to a window and it says "[root@ws005:bin]# " that doesn't really tell you a lot. I much prefer to see "[root@ws005:/usr/bin]#" or "[greg@hydrogen:/usr/local/someprog/bin]$".

      Also handy is that the prompt is a valid source/target for scp or rsync.

      --
      Speak before you think
    5. Re:$PS1 by Anonymous Coward · · Score: 0

      Whoa... you're thinking CRAZY too exotic here man. This guy is talking about including pwd and mebbe the time in the prompt.

      You are talking crazy kung-fu ninja stuff that used to have to be done in the olden days when vacuum tubes were still pretty cool.

      The time is highly useful to see when a command was executed (more useful on servers, but if I did a synch from source control, its nice to look back and see what time I did it at, for instance.) PWD is in my opinion critical. If you expect them to be switching user names at all, whoami is also important.

      Other than that, I can't think of anything, but PWD and the time... everyone appreciates that.

    6. Re:$PS1 by fm6 · · Score: 1

      I guess your prompt is handy if you work on a lot of different systems and accounts, and use scp or rsync a lot. But we are talking newbies here. They'll probably find the path name helpful, but the other stuff would just confuse them.

    7. Re:$PS1 by jhantin · · Score: 1
      \w is especially handy when you're working in nested directory structures that contain multiple similarly named directories. Java projects are notorious for this.
      [you@box project]$ _
      Um, okaaay... is that:
      ~/project
      ~/project/src/main/java/com/example/pro ject
      ~/project/target/project
      ~/project/target/c lasses/com/example/project
      ~/project/target/proje ct/WEB-INF/classes/com/example/project
      or something I didn't think of in that list?
      --
      ...when you're writing a game...tweak the difficulty of "Easy" to something [your mother] can cope with. -- onion2k
    8. Re:$PS1 by Anonymous Coward · · Score: 0

      I don't have it anymore, but someone I knew had one that was yours, with the addition of executing a grep (I think) through lastlog so it could also show what remote machine you were logged in from, a la "[greg@hydrogen->oxygen:/usr/bin"

    9. Re:$PS1 by klui · · Score: 2, Insightful
      Path is the most important, then followed by machine name. I do access other machines, but hardly ever more than 4 at a time. A more important thing is to set cd aliased so it changes the window title of your terminal emulator. It is absolutely required if you have 8 or 9 windows and you want to get back at some window you were using 20 or even 5 minutes ago.

      Another thing I do is set ls, ll, and lr aliases and include -aF switches in addition to the -l and -R for the latter two, respectively (I just set ls to what I want and have ll/lr reference my ls alias).

      Next, I have a huge command line history--10K lines. It really sucks if I lose my .bash_history file. But I almost can always refer to stuff in history and (almost) never have to write down an obscure command again. But doing this makes working with many windows to a login a challenge. I must use exit or explicitly ^Ding to have my history saved. If I X-out my history is lost. May be a terminal emulator thing--I use tterm w/ ttssh.

      My prompt is 2 lines. A bit over kill, but I traverse to lengthy paths and I like to see the complete path. First line is machine + path, second is just my shell name. I really like editing my command line with bash's v command.

    10. Re:$PS1 by Electrum · · Score: 1

      A more important thing is to set cd aliased so it changes the window title of your terminal emulator.

      If you are using bash, setting PROMPT_COMMAND might be better than aliasing cd. Personally, I only put the hostname in the window title. Having the path in there annoys me.

      declare -x PROMPT_COMMAND="echo -ne '\033]0;${HOSTNAME}\007'"

    11. Re:$PS1 by Taladar · · Score: 1

      You could use zsh (basically bash on steroids) and use a shared history. zsh also has some nice additional history search features.

    12. Re:$PS1 by klui · · Score: 1

      I tried zsh in the past, but the man pages made learning it cumbersome. Zsh had 1 man page that references others much like Perl. I prefer to have one page with all the options listed so I don't have to have all of them opened concurrently--made searching a drag. Maybe zsh has changed, but I have grown to be comfortable with bash.

  3. Ksh? Bash? by Khakionion · · Score: 2, Funny

    Why don't you use a real shell environment, like Common Lisp?

    --
    OMG! Wau!
  4. Let them do their own set-up by FidelCatsro · · Score: 3, Insightful

    Depending on how tech-literate/savy they are this is , i would make a nice little data sheet explaining how to set up their profiles and what the commands do etc ,perhaps make a small perl script that asks a few questions and creates a profile based on the awnsers for those who arn't to up to the task.
    Well if they are neading to get used to shell , then i would say this may be a good approach as it will educate them as well .(incase things go wrong make a simple script to reset their profile so you can rest easy).

    Just another idea you may consider.

    --
    The only things certain in war are Propaganda and Death. You can never be sure which is which though
  5. Re:Ksh? Bash? by Anonymous Coward · · Score: 0

    Yes as KSH/bash are such limited enviroments ??
    it's not as if you couldnt just call cLisp from your normal shell

  6. set -o emacs? by Chris_Jefferson · · Score: 4, Insightful

    I'd think anyone who was familar with emacs shortcut keys would already know about the shell..

    I would say try to change the shell as little as possible from default, else you are going to confuse them if they have previously done a little command line work, or try to install it at home, or try to learn it from a book / web guide.

    I would consider using aliasing to stick a "-i" on rm... nice for beginners (and experts as well to be honest)

    --
    Combination - fun iPhone puzzling
    1. Re:set -o emacs? by smahesh · · Score: 2, Informative

      I second the suggestion for aliasing rm with "-i". After being bitten by the "unintentional deletion of files" bug in my early unix days, I have always aliased the rm/mv/cp commands and recommend all new unix users to do the same.

    2. Re:set -o emacs? by ThatComputerGuy · · Score: 1

      Whoa, horrible idea... this is just the type of thing that'll get you yelled at when they move on to a real distribution that has the default rm operation and they lose their files. Or when they begin trying their hand at scripting and hardcode /bin/rm, without knowing of -i. Or...

      --
      XML is like violence. If it doesn't solve the problem, use more.
    3. Re:set -o emacs? by Anonymous Coward · · Score: 0

      Just be careful when you move/login to a different system. If you internalize the "-i" you might accidentally delete a lot of files. That said, I still throw caution to the wind and alias "-i".

    4. Re:set -o emacs? by Anonymous Coward · · Score: 0

      While I agree with sticking the "-i" on rm in principal, I find that I simply wind up always running a rm -f on systems where I have the -i aliased.

    5. Re:set -o emacs? by lachlan76 · · Score: 1

      It's a bit too risky, they could make a shell script or use /bin/rm which would make everything go wrong.

      What I have found is that it is a good idea to make a file called '-i' in every important folder, that way the argument goes in at shell expansion time.

  7. shopt -s checkwinsize !!!! by datastalker · · Score: 0

    This is so that their commands will wrap to the next line when put in small windows. Otherwise, it wraps on the same line, which is *REALLY* annoying. That's one of my biggest gripes with Linux, and I'm one of its biggest fans.

    1. Re:shopt -s checkwinsize !!!! by Anonymous Coward · · Score: 0

      Have to say , thats not really a problem with linux so much as the set-up of your distro.

    2. Re:shopt -s checkwinsize !!!! by datastalker · · Score: 1

      I have to say, you're wrong. Not one distro I've ever used (and I've used a lot) has ever had that set.

    3. Re:shopt -s checkwinsize !!!! by turbidostato · · Score: 1

      Well... I use Debian (Sarge) and all text console, kterm or xterm will go to next line without further configuration, so go figure

    4. Re:shopt -s checkwinsize !!!! by Anonymous Coward · · Score: 0

      I wanted to add it to my .bashrc, and it's already there! Ubuntu Hoary has it by default.

    5. Re:shopt -s checkwinsize !!!! by MasterOfMagic · · Score: 1
      A snippet from my Debian (sid) machine:
      ed@satchmo:~$ shopt | grep checkwinsize
      checkwinsize on
      So on Debian systems, this is set by default.
    6. Re:shopt -s checkwinsize !!!! by Ed+Bugg · · Score: 1

      This is so that their commands will wrap to the next line when put in small windows


      What's the problem?!?!? The only way to make small windows is small fonts right. Doesn't EVERYONE use the standard 80 columns?

      Never had a problem.
      --
      -- Ed Bugg --You have freedom of choice, but not of consequences.--
  8. It Depends by MikeDawg · · Score: 2, Insightful

    It really depends on what sort of users you plan on having on your system. I understand you say that you have computer (read: Windows) literate people, but, I have seen people that I would consider have a decent ability to navigate and use various Windows okay, and just absolutely freak out when they see a CLI.

    I'd really recommend a tutorial course given by yourself, or by some other member of IT, to familiarize your users with the CLI. I like my prompt very simple and plain, but informative enough for me, for example, in ZSH, I use: prompt='[%T][%n@%m][%~] ' and that is informative enough for me. If you do something simple like this in the global rc file, and then even personalize it a little more on per user basis.

    --

    YOU'RE WINNER !
    Another lame blog

  9. set -o emacs is so evil by photon317 · · Score: 3, Funny


    Right outta the box you're going to subject them to learning the semantics of the editor that wishes it was an operating system and requires 8 metakeys and 3 floor pedals to operate? Talk about BOFH.

    --
    11*43+456^2
    1. Re:set -o emacs is so evil by FidelCatsro · · Score: 3, Insightful

      the basic emacs commands are rather simple and take no time atall to master.
      its not as if they would need to learn the whole emacs multiverse .Just give them a sheet with the commands on like ctrl+f = forward , and they will pick it up quickly enough as the basics are fairly logical .

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    2. Re:set -o emacs is so evil by elmegil · · Score: 2, Insightful
      the basic emacs commands are rather simple and take no time atall to master.

      Funny, I'd say the same thing about vi commands.....and they're fewer keystrokes.

      --
      7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
    3. Re:set -o emacs is so evil by FidelCatsro · · Score: 3, Funny

      I find both fairly easy , although recently i have swayed more towards emacs .
      does that make me a BiTexual

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    4. Re:set -o emacs is so evil by brunson · · Score: 1

      Plus, you'll find the most unix applications understand emacs cursor control keys. It wasn't until a recent release of Firefox that ctrl-e didn't go to the end of the line.

      But, no matter what, the arrow keys work almost univerally nowadays.

      --
      09F911029D74E35BD84156C5635688C0
      Jesus loves you, I think you suck
    5. Re:set -o emacs is so evil by turbidostato · · Score: 1

      "its not as if they would need to learn the whole emacs multiverse"

      And please tell me, what's the benefit of learning emacs over simpler editors like mcedit or nano -to name only console-based ones, if you don't expect to go further than basic key combinations (the same is valid for vim too)?

      I'd say that would be like the "no pain, no gain" motto... without the "gain" part!

    6. Re:set -o emacs is so evil by FidelCatsro · · Score: 1

      the difficulty in learning VI or emacs is greatly exagerated , It is very easy and as an above poster says , most of the shortcut keys from emacs work for most applications.
      I love pico/nano dont get me wrong , but you hardly need to learn it and the keyboard shortcuts from VI or emacs really can boost your productivity on the shell when your use to them.
      VI and emacs both generaly come with a tutorial that will hand guide you through the basics and let you start to feel comfertable with the enviroment .

      If you don't see the gain from using a complex editor and understand what they are able to do , then you probably don't need it and can stick to the wonderfull nano(I use pico/nano for most of my quick editing, but if im writting a script i break out emacs or vi ..more emacs recently as i said).

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    7. Re:set -o emacs is so evil by fm6 · · Score: 1
      Just give them a sheet with the commands on like ctrl+f = forward
      Wouldn't it be better to emphasize the arrow keys? I think you'll find that most keyboards have them nowadays.

      Sarcasm aside, you've just demonstrated how big the mental gap can be between a hacker and a newbie, especially if the hacker has some complicated set of concepts -- like the EMACS or Vi command set -- hard-wired into his frontal lobes. Don't assume that something that comes natural to you is natural to somebody new to the subject.

    8. Re:set -o emacs is so evil by brunson · · Score: 1

      I'm with you, I can go back and forth with hardly any problems.

      As an aside... I don't know any emacs users who don't know how to use vi proficiently. Conversely, I don't know any vi users who do know how to use emacs proficiently.

      I have my own theories on why, I'll let the reader draw their own.

      --
      09F911029D74E35BD84156C5635688C0
      Jesus loves you, I think you suck
    9. Re:set -o emacs is so evil by milgr · · Score: 1

      Emacs and vi are both powerful editors. I have been using both on a daily basis for over 20 years (Yes, I used Gossling Emacs before Gnu Emacs existed). I used to program emacs (two different lisp flavors). I never learned all the availible lisp functions. I never learned all the key sequences of either vi or emacs. The advantage of emacs mode over vi mode is that it is easier for most users to comprehend. In vi mode, users need to keep track of if they are in insert or edit mode. In emacs mode, they are always in insert mode (or search mode, but that it obvious from the screen). Much of this works the same when using arrow keys, but in vi mode, it is difficult to get past the last character in a recalled line. Secondly, the list of basic editting commands is a starting point. It lets the user start using the editor. How many people really know and use all the vi commands? Knowing all the commands is not the point. Having an editing environment that makes the user efficient is what is important.

      --
      Where law ends, tyranny begins -- William Pitt
    10. Re:set -o emacs is so evil by FidelCatsro · · Score: 1

      The biggest mental blockade to get over i would say is the "Manual reading block" if someone is switching from one system to another , They natuaraly assume they are an expert and don't need these "Tutorials".Im not advocating RTFM help only promoting the tendancy to read a manual , i will gladly give any help i can to a new user.

      the reason i advocate that a new users learns a command set like vi or emacs is to get them into the swing of having to read up on things and helps get them into the mindest , I have often found people who do it this way become at home with the system far faster . If you give them the easy option at first they will glide and as soon as something a little tricky comes up they will stone-wall and be at a complete loss .
      That said , this is just my personal experiance and im sure many other people have very difrent views on the subject .

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    11. Re:set -o emacs is so evil by FidelCatsro · · Score: 1
      As an aside... I don't know any emacs users who don't know how to use vi proficiently. Conversely, I don't know any vi users who do know how to use emacs proficiently.
      <br><br>I have my own theories on why, I'll let the reader draw their own.
      *Dawns a flame retardent suit and dives under pico*
      Im not touching that one with a 16' barge pole
      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    12. Re:set -o emacs is so evil by joto · · Score: 1
      Just give them a sheet with the commands on like ctrl+f = forward , and they will pick it up quickly enough as the basics are fairly logical.

      Now, why would any user need to know that? It's not like keyboards doesn't have arrow keys on them. Alright, it's happened to me on some weird occasions running emacs on a terminal through a telnet session, or something like that, but in that case, backspace would also bring up help, making the system completely useless for new users anyway.

      The useful commands an emacs user would need to learn are: C-x C-f, C-x C-s, C-x s, C-x w, C-x k, C-x b, C-x C-b, C-x k, C-x 2, C-x 0, C-x 1, and C-x C-c. On the other hand, all of these commands are available through the menu. So, in fact, for a complete beginner, there are no useful commands to memorize. Ok, there is one: whenever you get into trouble, type C-g a few times.

      So if you want a completely user-friendly system, replace emacs with an editor that doesn't require you to type C-g :-)

    13. Re:set -o emacs is so evil by FidelCatsro · · Score: 1

      yes i do admit the ctrl+f was a poor decision for an example ,hee

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    14. Re:set -o emacs is so evil by Anonymous Coward · · Score: 0
      VIM r00ls, Emacs dr00ls

      :)

    15. Re:set -o emacs is so evil by Karma+Farmer · · Score: 1

      I'll grant that people who use emacs generally never learn it well enough to know that they're not experts in emacs.

    16. Re:set -o emacs is so evil by spudgun · · Score: 1

      BUT basic users are NOT logical !

      --
      Type unto others as you would have them type unto you.
    17. Re:set -o emacs is so evil by iabervon · · Score: 1

      They probably won't notice that their shell does any of that stuff until they've mastered emacs. It's not like people coming from windows are likely to expect their shell to have reverse-search-through-history and be trying to figure out how to get it. So long as the arrow keys and backspace work, they'll be happy. If they end up learning emacs keysfor some reason, they'll be happy to find that their shell uses the keys they know.

      (In point of fact, emacs doesn't wish it was an operating system. It wishes it was a desktop environment. That saying was just coined before there were desktop environments other than emacs.)

    18. Re:set -o emacs is so evil by elmegil · · Score: 1

      Of course it's because vi is the default and you HAVE to know it to do things at certain points in the lifecycle of your system. Some people like to build addition on their houses, others don't. Don't try to make it a religious argument, eh?

      --
      7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
  10. Compact AND informative prompt? by WarPresident · · Score: 2, Insightful

    I dunno if you can have both at the same time...

    alias setprompt 'set prompt="\\
    `pwd`\\
    `hostname`# "'
    alias cd 'chdir \!* && setprompt'
    setprompt

    --
    Here come da fudge!
    1. Re:Compact AND informative prompt? by Elwood+P+Dowd · · Score: 1

      Uh... aren't there other ways to switch directories aside from cd? pushd & popd for example?

      Most prompts that show you pwd do it with backticks or something, afaik.

      --

      There are no trails. There are no trees out here.
    2. Re:Compact AND informative prompt? by brunson · · Score: 1

      or in bash: PS1="\w \h\$ "

      --
      09F911029D74E35BD84156C5635688C0
      Jesus loves you, I think you suck
    3. Re:Compact AND informative prompt? by WarPresident · · Score: 1

      I've never seen the appeal in using a stack to keep track of directories as I've rarely needed to go A, B, C, D, C, B, A in my navigation.

      Most prompts that show you pwd do it with backticks or something, afaik.

      Yes, I'm using backqoutes in my example.

      --
      Here come da fudge!
    4. Re:Compact AND informative prompt? by Elwood+P+Dowd · · Score: 1

      Huh. I guess I thought shells usually had some mechanism for automatically regenerating the prompt every time you issued a new command, so you wouldn't have to explicitly reset it whenever you changed directories or something.

      Right then.

      --

      There are no trails. There are no trees out here.
    5. Re:Compact AND informative prompt? by kernelfoobar · · Score: 1

      maybe not as compact but definetly informative:

      if [ `whoami` = "root" ] ; then
      PSSUF="# "
      psuser="root"
      else
      PSSUF="$ "
      psuser=$USER
      fi
      export PS1=$psuser@`hostname -s`':$PWD/{$LINENO}$PSSUF
      `if [ $? = 0 ]
      then
      echo ":)>"
      else
      echo ":(>"
      fi`'

      which gives something like this:

      joeuser@yourmachine:/usr/local/whatever/{ 1}$
      :)>

      --
      Here we go again!
    6. Re:Compact AND informative prompt? by webhat · · Score: 1
      In bash I know this is the variable PROMPT_COMMAND, which can be set something like this:
      PROMPT_COMMAND='CMD=$((CMD+1));echo -ne "\033_${USER}@${HOSTNAME}: ${PWD/HOME/~}\033\\"'
      export PROMPT_COMMAND
      --
      'I am become Shiva, destroyer of worlds'
    7. Re:Compact AND informative prompt? by Tower · · Score: 1

      Well, most of the time it is A,B,A,B but it is nice to have C available with a pushd +1 (especially when the path name become issues)

      --
      "It's tough to be bilingual when you get hit in the head."
  11. recommended .bashrc file... by mshiltonj · · Score: 5, Funny
    I recommend this for a newbie .bashrc file:

    exit

    1. Re:recommended .bashrc file... by FooAtWFU · · Score: 3, Funny
      Well, I guess it's better than:
      :(){ :|:& };:
      --
      The World Wide Web is dying. Soon, we shall have only the Internet.
    2. Re:recommended .bashrc file... by brunson · · Score: 1

      You are a bastard...

      --
      09F911029D74E35BD84156C5635688C0
      Jesus loves you, I think you suck
    3. Re:recommended .bashrc file... by larien · · Score: 1
      Evil is
      stty erase e
      stty intr r

      If you know what you're doing, it's fairly trivial to get out of that, but a newbie won't have a chance.

    4. Re:recommended .bashrc file... by NewWazoo · · Score: 1

      I love that! I actually ran this without thinking it through (ON A TEST MACHINE!), and it's brilliant.

      This is a perfect example of how UNIX allows you to elegantly shoot yourself in the face. :)

      B

    5. Re:recommended .bashrc file... by Karma+Farmer · · Score: 1

      That command has nothing to do with unix. It's a feature of the shell, not the OS.

      It worked on bash on VMS systems, it works on bash on Win 95/98 systems, and it works on bash in Win NT/2000/XP systems.

    6. Re:recommended .bashrc file... by webhat · · Score: 1
      I don't get it, bash just tells me that:
      $ :(){ :|:& };:
      bash: `:': not a valid identifier
      --
      'I am become Shiva, destroyer of worlds'
    7. Re:recommended .bashrc file... by Vadim+Grinshpun · · Score: 2, Informative

      You know, the best part was, I've never seen a bash forkbomb before, and stupidly decided to give this a try :-P
      (I had no idea that ":" was a valid bash command, and so figured that maybe it'll come up with a particularly amusing error message... was I ever wrong :)))

    8. Re:recommended .bashrc file... by zemoo · · Score: 1

      Damn it!
      I tried opening up a new Virtual Terminal and even remotely SSHing to my machine to stop this thing!
      But apparently the Linux scheduler decided otherwise ... shouldn't interactive processes have a higher priority, allowing to stop such a monster?

    9. Re:recommended .bashrc file... by sysadmn · · Score: 1

      Better than my newbie, who wanted tcsh instead of csh, and didn't know how to chsh or passwd. Instead, he put:/usr/local/bin/tcsh in his .cshrc. Yep, no "exec". By the time the system ground to a halt, there were dozens of little tcshes running around. The user earned the nickname "The forking menace".

      --
      Envy my 5 digit Slashdot User ID!
    10. Re:recommended .bashrc file... by Anonymous Coward · · Score: 0

      'I am become Shiva, destroyer of worlds'

      Shiva am need become go to Engrish class.

    11. Re:recommended .bashrc file... by g-san · · Score: 1

      I don't know what's more hilarious, seeing that pop up from time to time, or reading all the replies from people who decided to try it.

      As an aside, I will gladly correct this problem for anyone if they just reply with their IP, username and password. Oh, I need root access too. And a .bashrc with something useful for the newbies that will be in your box about an hour later.

  12. .profile/.rc Comments! by infernalC · · Score: 4, Insightful

    1. Set up the skeleton .bashrc with just a few customizations. For each customization, include a comment so that they will learn how to customize too. For example:

    # Here we will add a directory to the existing
    # command search path. This command tells the
    # shell to look in the bin directory under your
    # home directory (~) for programs before the
    # system-wide program directories.
    export PATH=~/bin:$PATH

    2. Send them an e-mail telling them that they can customize their accounts by editing ~/.bashrc with an easy editor (nano/pico) or whatever. Point them to a nice tutorial on the web, too. Also, tell them that they can reset their settings to the default by typing reset_shell_defaults, and put a script in /usr/local/bin that prompts "Are you sure? Your settings will be lost!" and then overwrites .bashrc. That way, they won't be afraid to play. Nobody ever got 1337 without playing around.


    3. Offer up Midinight Commander for those who need some curses.


    4. Tell them about man/apropos/info.


    1. Re:.profile/.rc Comments! by sharkey · · Score: 1
      Offer up Midinight Commander for those who need some curses.

      Holy fucking shit!!!

      --

      --
      "Outlook not so good." That magic 8-ball knows everything! I'll ask about Exchange Server next.
    2. Re:.profile/.rc Comments! by Brandybuck · · Score: 1

      That comment is way too verbose. We're talking about technically literate people here, not kindergartners expecting to find a full shell tutorial in their .bashrc. Sheesh.

      Your basic idea is good, but keep that comment down to one line: "set the search path". Otherwise your users will think you're overcompensating for something.

      --
      Don't blame me, I didn't vote for either of them!
  13. Not from experience by ADRA · · Score: 2, Informative

    I would say having a handy-dandy cheat sheet for common commands would be invaluable. Just write a function called help and have information like:
    Copy - cp
    Move - mv
    Help using a command - Man ...

    you get the idea. Otherwise, everyone'll be requisitioning the newb command line books all at the same time. At least with a built-in reference, they don't need paper.

    --
    Bye!
  14. For the old farts familiar with DOS by HotNeedleOfInquiry · · Score: 1

    Alias the dos commands and add the Joe (wordstar-compatable) text editor.

    --
    "Eve of Destruction", it's not just for old hippies anymore...
    1. Re:For the old farts familiar with DOS by dreamer-of-rules · · Score: 4, Interesting
      even better, alias dos commands to mini-helps.

      > copy old.txt new.txt
      Try using 'cp <options> <source> <target>'. For example:
      cp old.txt new.txt
      Type 'man cp' for more help.

      Consider AT, CHKDSK, CMD, COPY, DATE?, DEL, DIR, ECHO, EDIT, FC, MKDIR or MD, MOVE, RD, RENAME?, TIME?, XCOPY.

      --
      Everyone is entitled to his own opinions, but not his own facts.
    2. Re:For the old farts familiar with DOS by HotNeedleOfInquiry · · Score: 1

      Thanks. A good idea. Unfortunately it won't help me much as I do alot of embedded DOS work and bounce back and forth from DOS/Win/Linux.

      --
      "Eve of Destruction", it's not just for old hippies anymore...
    3. Re:For the old farts familiar with DOS by ClosedSource · · Score: 1

      Even the old farts have moved on. If this transition were occurring 10 years ago, aliasing the DOS commands would be great, but very few Windows users use DOS commands today, or need to.

  15. Looks like no one has given you a real answer yet. by rRaminrodt · · Score: 3, Informative

    First off, create an alias for "help" that runs a shell script that runs a quick intro to the command line type tutorial, with scrolling, because you can't assume they will know better to pipe it into less.

    If your users are familiar with dos you might also make "edit" an alias to "nano -w" or something similar. Forcing them to use vi right away might be offputting. (It was the first time I used unix)

    Make sure rm is aliased to 'rm -i' if your distro doesn't do that already.

    If you aren't using X, and everything is completely terminal based (or maybe even if it is). I'd make sure GNU screen is installed on those systems. Once your users get comfortable with the basics, screen adds some really nice features to the mix.

    --
    They'll think I've lost control again and leave it all to evolution. -- Supreme Being, Time Bandits
  16. use jedi mind tricks by nocomment · · Score: 2, Interesting

    I'd also recomend creating a file called 'README.EXE' and putting a copy in their homedir and a copy somewhere on PATH. chmod +x and have the file jsut contain
    #!/bin/bash

    echo"tutorial blah blah blah
    ls does blah blah blah
    to find more info use man blah blah blah

    I think you get the idea.

    most newb are familiar with the idea that .exe means something you can run, and therefore the idea of typing 'README.EXE' to view the howto would not be all that alien to them.

    --
    /* oops I accidentally made a comment, sorry */
    /* http://allyourbasearebelongto.us */
    1. Re:use jedi mind tricks by Anonymous Coward · · Score: 0
      Good idea. Considering that people ccome from Windows backgroud, they will pounce upon a readme.exe file like i pounce on food.

      Somebody mod parent up please !

    2. Re:use jedi mind tricks by Anonymous Coward · · Score: 3, Insightful

      most newb are familiar with the idea that .exe means something you can run, and therefore the idea of typing 'README.EXE' to view the howto would not be all that alien to them.

      Nonsense. Anyone who associates ".exe" with running a program is a Windows power user, and they will NOT associate "readme.exe" with anything, because readmes are always "readme.txt".

      The command to get help in a Windows command prompt is "help", just like in bash, and it works just like bash's. A useful thing to do would be to alias "help" to your own help system that includes information on non-bash commands like ls(1). But your "readme.exe" idea, while clever, would not be at all intuitive to anyone.

    3. Re:use jedi mind tricks by M1FCJ · · Score: 1

      Readme file? Come on. /etc/motd...

    4. Re:use jedi mind tricks by nocomment · · Score: 2, Interesting

      You'd think so wouldn't you. When i first saw that done I thought it looked weird too. A company I used to work for gave shell accounts to any technical employee that wanted one on their 'testing' server. Most people had never learned linux before and therefore didn't really know what to do. The real admin of the server did that, and the newbs ate it up. I initially thought it was a bad idea because it just showed the windows people that .exe's ran on linux (that was my thought anyway) but it proved to be sucessful.

      *nix newbs in our department were soon using that server for all manner of testing.

      The company by the way was mindspring, it's not like it was some podunk place. :-)

      Trust me, it's not nonsense, it actually works very well indeed.

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
    5. Re:use jedi mind tricks by Frnknstn · · Score: 2, Informative

      Except, of course, to run a file called README.EXE under a MS OS, the user would just type 'readme'. The new unix user would sit for 10 minutes wondering why that wasn't working, and then somebody would walk past and say "in unix, you need to type out the full name."

      The user would then sit for half an hour, trying to work out why typing 'readme.exe' doesn't start 'README.EXE'.

      Once he is told that the new shell is case sensitive, three days will pass before he finds out that files in the current directory need to be prefixed with "./" to me executed.

      So, in summary, 'readme' != './README.EXE'

      (Note: yeah, the ./ would only apply in his home directory. But that is where his shell starts.)

      --
      If it's in you sig, it's in your post.
    6. Re:use jedi mind tricks by x_terminat_or_3 · · Score: 1

      True, but then use some tricks.

      Make file readme.txt in the home directory
      make file readme.exe with your bash stuff inside it in /usr/local/bin
      chmod +x it
      in the user's home directory, put a dummy file README.EXE

      It doesn't matter that it will not get executed, when the user types readme, the command that gets executed is /usr/local/bin/readme (provided /usr/local/bin is in the path)

      Cheat away!

      --
      Only those who risk going too far can possibly find out how far they can go. T. S. Eliot
  17. -h's & -i's by -=[Dr.+AJAX]=- · · Score: 2, Informative
    I basically have these aliases in my .profile. The -h's make everything a bit more readable, and the -i's are there to make sure I don't overwrite something important. You might want to also include "-i" to "rm" so they're at least prompted when deleting something.

    alias ls="ls -h --color=auto"
    alias cp="cp -i"
    alias mv="mv -i"
    alias df="df -h"
    alias du="du -h"
    1. Re:-h's & -i's by Sesse · · Score: 1

      Yeah, that's really nice... except after a while people get really tired of the endless "do you want to delete this? do you want to delete that?" and then go on to add -f to everything. Whoops, suddenly you get no warning when you rm something read-only (and when something is read-only in *nix, it's usually for a good reason)...

      /* Steinar */

      --
      (This comment is of course GPLed.)
    2. Re:-h's & -i's by smahesh · · Score: 1
      You do know that the unaliased version can be invoked by escaping the command?

      e.g. "\rm" will invoke the unescaped version of rm and not the alias "rm -i"

    3. Re:-h's & -i's by Sesse · · Score: 2, Insightful

      Then what is the use of the aliases? The main point is: Constant warnings like that are way too annoying to do any good; people start ignoring them in various ways all too soon, if only mentally.

      /* Steinar */

      --
      (This comment is of course GPLed.)
    4. Re:-h's & -i's by hartz · · Score: 1

      Erm, besides "mentally", what other ways have you come across?

      --
      --- Abnormally normal.
    5. Re:-h's & -i's by Sesse · · Score: 1

      -f.

      /* Steinar */

      --
      (This comment is of course GPLed.)
  18. Decent prompt by FooAtWFU · · Score: 3, Informative
    Set up a decent prompt with a few nice colors, but don't overwhelm them with the date and time and fifty dozen different things. I reccomend:
    PS1='\[\e[0;37m\]<\[\e[36m\]\u\[\e[0m\]@\[\e[0;33m \]\h\[\e[0m\] \[\e[1;36m\]\w\[\e[0m\e[1;34m\] \$\[\e[37m\]>\[\e[0m\] '
    or something to that effect. Username@host, directory, all wrapped in a neat little angle-bracket configuration which will make anyone who's seen DOS a bit more comfortable with the system. If you have multiple hosts that they need to worry about, consider multiple colors for the hostnames.

    Additionally, if there's any chance they'd use a command that checks the EDITOR or VISUAL or whatever environment variable, make sure that they do not launch vi. Give them something simple and easy like nano.

    Consider the colors that 'ls' uses. Consider whether or not they'd be helped by a default like ls -p (print / and the like on the end of directories, @ for symlinks, etc.)

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
    1. Re:Decent prompt by jeorgen · · Score: 1
      Additionally, if there's any chance they'd use a command that checks the EDITOR or VISUAL or whatever environment variable, make sure that they do not launch vi. Give them something simple and easy like nano.

      I second that. There is no reasonably obvious way out from vi for a newbie. You're simply stuck.

    2. Re:Decent prompt by tholo · · Score: 2, Informative

      So, what do you do when you need to log in from somewhere / with some software that does not deal with ANSI color escape sequences?

      I mean, at least GNU ls(1) will use terminfo to see if/what is possible to do...

      What is it with people wanting their prompts (or les output!) colorized, anyways...?

      --
      Universe, n.: The Problem.
    3. Re:Decent prompt by M1FCJ · · Score: 1
      When you can't answer, you can always phone a friend?

      Slowly and surely, I'm teaching my colleauge sitting next to me with the arcane art of shells. He has improved quite a lot. These days he can ssh into a Linux box, do what he wants to do and exit without damaging anything, even if he logins as root.

    4. Re:Decent prompt by acousticiris · · Score: 1

      What is it with people wanting their prompts (or les output!) colorized, anyways...?

      It's pretty, and comfortable and color can make it easier for your mind to pick out what is important from something you're looking at.
      My prompt contains my username and hostname in dark blue...because it's something I need to know the instant I hit the box but don't much care about after that (unless I hit the wrong box!). But the path is in violent-bright-red, because while doing anything it's really nice to get that bright reminder of precisely *where* you are in the "world" that is your pretty little shell...

      Maybe it is pointless...but why not? It's like putting a picture in front of the toilet. Nobody spends much time admiring a bathroom when they're using it, but having that flower at least relaxes you a little while you're ruining the place.

      --
      "God is dead!" - Nietzsche
      "Nietzsche is dead!" - God
    5. Re:Decent prompt by Urchlay · · Score: 1
      What is it with people wanting their prompts (or les output!) colorized, anyways...?

      I ssh into 10 or 12 different machines every day. I find it really useful to use a different set of colors for the prompt on each one. Even though the hostname is in the prompt, color recognition happens at a lower level of the brain than reading (or something like that: I'm no expert on brains).

      I don't know about color output from less, but I'm completely addicted to color syntax highlighting in vim. The only thing wrong with the default colors is the unreadable dark blue they chose for comments. I change it to bright cyan, since comments are supposed to be readable and obviously different from code.

  19. what?? by nege · · Score: 3, Insightful

    are you kidding??? set -o vi goddangit! Gots to start these newbs on the right foot!

    1. Re:what?? by larien · · Score: 1

      Best bet is bash or zsh with arrow keys; it's more intuitive. Personally, I've gotten used to vi bindings because ksh is the only shell I can guarantee to be on all our servers at work (AIX, HP-UX & Solaris, various versions of each).

  20. pico? by samjam · · Score: 1

    Don't laugh!

    I got by on pico for years, even for editing C source.

    This was after giving up on JOVE in disgust, which our (blessed) Uni systadmins had installed because it was simpler than emac - well it was, but the everyday bits were just as complicated. ^X^C to quit,etc!

    Now I use vi cos I have to.
    The full set of commands I know are:
    s I i A a ESC :w :q :w! :q! :f /

    And that brings me up to pico ability!

    mad!

    Sam

  21. Re:Ksh? Bash? by Anonymous Coward · · Score: 0
    Why don't you use a real shell environment, like Common Lisp?

    Because the author specifically said, "No shell advocacy, please; it's going to be ksh or bash", you fucktard.

  22. ASCII Porn by j-turkey · · Score: 0

    I can't think of too much to add to your .bashrc and .profile, but if these are former GUI users, used to the modern graphical world and the modern Internet(s) -- you may want to make their world a little more famaliar by making some ASCII porn available. Perhaps you could make a symlink to iexplore.exe which will simply cat some ASCII porn out for them. If ANSI color terminals available, you can even make it a little more elaborate. ;)

    --

    -Turkey

  23. Noooooo! Help is a bash builtin. by infernalC · · Score: 1

    It tells you how to get more help, and spells out the builtin commands (most of what folks are gonna use). I tried to dump the output of 'help' here, but it doesn't pass the /. lameness filter.

  24. No Cheat sheet - alias the commands! by justanyone · · Score: 2, Informative

    Okay, this is silly - having them post a piece of paper near their screen with these commands is a great idea, but you can make their lives so much simpler with several aliases:

    alias dir="ls -al"
    alias rename="mv"
    alias move="mv"
    alias copy="cp"
    alias help="man" # this or
    alias help="info" # this

    These 5 or so commands will help them immensely. DOS / cmd.exe only has a very few commands anyway, and you can successfully alias all of them.

    Midnight commander is an excellent idea as well.

    ALSO: Create a couple of directories in everyone's home dir named, "MyDocuments", "MyPictures", etc., so people don't even have to learn how to create a directory.

    ALSO: don't forget to tell them that there's control-C to break, but there's also control-\ to interrupt (on most terminals) which works much nicer.

    That's my 5 cents.

    1. Re:No Cheat sheet - alias the commands! by Haeleth · · Score: 5, Informative
      you can make their lives so much simpler with several aliases:
      [...]
      alias rename="mv"


      BAD idea. DOS commands are not just Unix commands with vowels in; they work differently.

      For example, in DOS you can do
      C:\> ren *.txt *.bak
      and that is the equivalent of
      $ for t in *.txt; do mv $t ${t/%txt/bak}; done
      ...except it's not case sensitive. Note that it is not equivalent to
      $ mv *.txt *.bak
      which is what your dangerous alias will make people expect.

      ALSO: Create a couple of directories in everyone's home dir named, "MyDocuments", "MyPictures", etc., so people don't even have to learn how to create a directory.

      What - not just alias md="mkdir"?
    2. Re:No Cheat sheet - alias the commands! by AvitarX · · Score: 2, Interesting

      I would actually recomend aliasing the DOS commands to echo text similar to this:

      dir is a DOS command, the most similar command in Linux is ls

      type ls man ls for directions.

      Most common usage is "ls -al"

      or something to that effect. Also I would aliad ls to ls -F --color=auto (most distros will reasonably alias the common commands though).

      By listing the propper command instead of auto-subbing you can encourage people to learn more about the commands (anybody using the command prompt will probably be at the level it will benefit them) and you can put in warnings about differences and better prepar the users for using other systems.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    3. Re:No Cheat sheet - alias the commands! by munpfazy · · Score: 2, Insightful

      That assumes the users are familiar with the DOS command prompt.

      First of all, that doesn't describe the usual windows user, even among seemingly tech savy people. (Which, if you'll forgive a brief flame, is no surprise given the crippled and disgusting nature of the DOS shell... why would anyone use it for anything if they had a choice?)

      Second, anyone who intuitively reaches for DOS commands will pick up a dozen unix commands in minutes. And, once they know the actual command, they'll instantly have access to man files and online help sources, and they'll be able to easily switch to a different unix machine without confusion. Just try a google search to find out to make the unix command "dir" sort by date. If you ask me, aliasing commands to totally different names is asking for trouble. At best, it will never be noticed by anyone. At worst, one will have a bunch of pissed off users a few weeks down the line.

      Someone else in this thread suggested aliasing the dos commands to display help messages instead. That sounds like a very good idea!

    4. Re:No Cheat sheet - alias the commands! by Trixter · · Score: 1

      This is an exquisitely BAD IDEA. It's not portable: They will learn these aliases and then wonder why they don't work on another system!

      An experienced admin friend of mine was working at a console with me looking over his shoulder once, and I saw him type things like "dc" and "vm" and yet the "cd" and "mv" commands were working -- I asked him why and he said he has aliases for all of his typos. THIS ENFORCED BAD BEHAVIOR and, years later, wishes he hadn't done that.

  25. Create a 70's environment by ClosedSource · · Score: 2, Funny

    Encourage them to wear bell-bottom pants, long sideburns for the men and play disco music in the background. That should acclimate them to 1970's style computing.

    1. Re:Create a 70's environment by Anonymous Coward · · Score: 0

      Encourage them to wear diapers, give them a pacifier and/or rattle, and play Barney music in the background. That should acclimate them to Microsoft style computing.

  26. arrow keys? by samjam · · Score: 1

    Does any keyboard not have arrow keys these days?

    Thankfully that last unix where these didn't work for me was SCO ODT3

    And don't tell me about it being quicker to use ^F type keys because my fingers are already in that area, to make a great saving I'd have to be using them an awful lot for it to be worthwhile remembering to use ^F instead of right arrow (or is it down arrow? forward/next sortof seem the same)

    Sam

  27. I recommend by hey! · · Score: 1

    setting the shell options to stun. Or at least daze.

    Also, I recommend setting your email to "out of office" and turning your cell phone off.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    1. Re:I recommend by hartz · · Score: 1

      setting the shell options to stun. Or at least daze.

      I've been looking for a way to get that option turned off. Whenever a Windows user, like in an expirt (qv) or sumfin walks into my cubicle and sees me performing an online disk re-layout in two quick commands, the effect hits them immediately.

      Thank goodness I'm immune to it. Now where is my mouse so I can press the submit button below .... nevermind ... TAB-TAB-Space

      --
      --- Abnormally normal.
  28. My list by Tamerlan · · Score: 1
    • alias cp='cp -i'. The same for mv, rm.
    • PS1="\h:\w>" - Seeing full directory, like in DOS, imo betterfor orientation. In a lab environment it is also helpful to see which host you at.
    • alias dir='ls'; alias move='mv -i';alias ren='mv -i'; for DOS converts
    • alias ls='ls --color=auto'. If ls supports that option, of course
    • Teach them to use autocompletion. That rocks!
    • Finally, teach them to use midnight commander (mc). Not exactly command line though :)
    1. Re:My list by Anonymous Coward · · Score: 0

      Avoid using ">" in a prompt, as it is also used in redirections and can be desastrous when using copy/paste ( Seen dba's erasing datafiles like that. ) Use $ or # instead, as it also tells you if you are root or not.

      BTW, if you use oracle, it's handy to have the ORACLE_SID in the prompt.

      ex :
      HOST=`hostname`
      export PS1='${USER}@${HOST}:`tput smso`$ORACLE_SID`tput rmso`:${PWD##*/} $ '

      And remember that if you are using ksh, it does not allow positional parameters in aliases and you will have to create functions in the users ~/.profile , for example.

  29. Vital thing by bonkeroo+buzzeye · · Score: 3, Informative

    Some good stuff in previous posts about aliasing DOS commands to translation messages and commenting the .bashrc to be helpful.

    Additionally, make *sure* their home, end, backspace, delete keys work properly. I'm not sure if we're talking pure command line or xterm (it's more an issue with some distros and xterms) but it's a hell of a lot to figure out when it's busted and a hell of a pain for a Windows user. It's not exclusively a shell issue but relates to the CLI experience.

    And I'd recommend *not* aliasing 'rm' to 'rm -i' because they're going to get sloppy and be really annoyed when they move to a box that doesn't have that set up and wipe stuff out.

    Set up their pager with something nice like 'export LESS="-eFMRXj12"' (well, it's nice to me).

    Stuff like 'shopt -s checkwinsize cmdhist extglob histappend histverify [etc]' - histverify is cool for new people not popping off the wrong command by accident when they're playing with the cool history tricks.

    Basically, keep it simple - avoid extremely dangerous things like giving them a fuzzy concept of 'rm' and enable not-particularly-dangerous things like 'histverify'. But make sure things like their keyboard and display work like they expect - most important thing. Then just give some hints and enable them to explore for themselves.

  30. Another way to do a cheat sheet by coyote4til7 · · Score: 1

    A left field idea just slapped me upside the head. How about aliasing 'help' to pump the cheat sheet into more|less. Then start it with a short intro like say this:

    This is a short summary of useful commands.

    To get around help:
    Press space to move down
    Press (command) to move up
    Press q (quit) to leave help.

    And if you have any suggestions, email me: blah@blah.com.

    Just an idea. I might even move my cli cheat sheet into something like to this to help my creaking mem-o-reee

    --

    the clock on the wall says 4 til 7
  31. Extensive, smart tab completion by swillden · · Score: 2, Informative

    You said no shell advocacy, so I won't recommend zsh, but something like its tab-completion mechanism would be a really good idea. I believe some packages exist to give bash similar abilities, and I would highly recommend installing them.

    Good tab completion makes using the command-line much easier for novice users, once they get the idea that any time they aren't sure what to type, they should just hit TAB. Don't remember the options to "ls"? Just type "ls -" and you'll get a nicely formatted summary. Don't remember the name of the directory you want to "cd" into? Just hit TAB and you'll get a list of the directories (not files!) in the current directory.

    And good tab completion knows about lots more than just the shell builtins or common commands. It knows all about *lots* of command-line tools, their options, what types of files are reasonable parameters for them ("gqview " gives a list of IMAGE files and directories in the current directory, omitting any non-image files from the list -- gqview is an image viewer), etc. zsh tab completion even knows how to look at remote systems to get completion info. For example, typing "scp 10.0.1.1:f" gets me a list of the files on my home directory on my Linux router that begin with "f". If there's only one, it gets expanded for me.

    Even when smart tab-completion can't tell you what to type, it often gives you a good hint. I think that would be very helpful to (smart, computer-savvy) command-line newbies.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  32. For Newbies...Do Not Forget -i by 4of12 · · Score: 1

    Just so you don't get forlorn people asking about how to undelete things, retrieve them from wastebaskets, etc., you might want to alias rm, mv, cp to use the -i option.

    Later, after they get tired of answering yes they can learn how to edit their profile and remove the training wheels.

    [Even then, I hope you have a good automated nightly backup running on the user's home directories.]

    --
    "Provided by the management for your protection."
  33. stty dec by smartin · · Score: 1

    This solves most backspace/delete problems for me when using terminal based apps such as vi.

    --
    The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
  34. cp/rm/mv -i !!! by phallstrom · · Score: 1

    Whatever else you do, alias cp, rm, and mv to always include -i (for confirmation)!!!

    And set them up with a shell prompt that shows username, host, and current directory.

  35. Please, no color ls. by V.+Mole · · Score: 1

    Because nobody has a clue what the colors mean. Because the default colors always include something dreadful like dark blue (unreadable on a black background) or yellow (unreadable on a light background.)

    Instead, use

    alias ls='ls -Fh'
    so that it tacks on "/" on dirs, etc. Yeah, also not necessarily the most obvious thing in the world, but at least you can read them.
  36. Some other useful things by bsdbigot · · Score: 1
    • alias -x xterm='xterm -ls -sb -rv'
    • alias -x psg='ps ax | grep'
    • alias -x bye='clear;exit'
    • alias -x ssh='ssh -X'
    • HOST=`hostname -s`
    • if [ "X${TERM}" == "Xxterm" ]; then
      alias -x vi='vim -T xterm-color' alias -x cd='Xcd'
      Xcd()
      {
      if [ $# -ne 0 ]; then
      'cd' "$@"
      else
      'cd'
      fi
      echo " ^[ ]0;${HOST}:${PWD} ^G "
      }
      Xcd .
      fi
    I never finished the Xcd() function to perfection, but it generally does what I want. Note that the ^[ and ^G are binary, 0x1b (ESC) and 0x07 (BEL).
    --
    main(){char I,l,O[]={'-',1-1,0,(1<<5)-1,0+'-',-10-1,-10,11-0,- 1,-100};for(I=l=0;l<10+0;put
    1. Re:Some other useful things by scotch · · Score: 0, Troll
      alias -x xterm='xterm -ls -sb -rv'

      Use your .Xdefaults or .Xresources

      alias -x psg='ps ax | grep'

      What about pgrep?

      alias -x bye='clear;exit'

      There's a setting for this one, too.

      alias -x ssh='ssh -X'

      ForwardX11 = yes in the general section of your .ssh/config.

      HOST=`hostname -s`

      What the fuck for?

      if [ "X${TERM}" == "Xxterm" ]; then
      [snip]

      Again, what the fuck for? Alias vi to vim if you want, vim can figure out what kind of terminal it is using. Most shells will show your path in the prompt without having to mess with cd.

      Are all BSD apologists so retarded?

      Grin/Duck/Run

      --
      XML causes global warming.
    2. Re:Some other useful things by bsdbigot · · Score: 1

      The nice thing about my .profile is this: rather than placing your suggestions in all the little dotfiles, I instead have a single file which is easy to scp/ftp/cut+paste. Who wants to fuck around with copying a whole crapload of dotfiles onto every box they use? I log into a new box and scp my .profile. 99.99999% of the time, I never have to touch it again. I have tailorings for Linux, FreeBSD, Solaris, AIX, HP/UX, and Cygwin.

      To be fair, I typically use GNU tools on those OS's which are not fortunate enough (unlike BSD) to have decent versions of their own tools. This tends to streamline my aliasing quite a bit.

      You must be a newb or have never used other than Linux; vim can't ALWAYS detect the right thing to do; try using color syntax highlighting on a Solaris console w/o writing a termcap entry.

      pgrep is a fairly new addition to FreeBSD; it's only been in Solaris since 7; those are my two most frequently used OSs, with various Linux flavors coming third. psg='ps (-ax|-ef)|grep' is a more convenient way to do things. Having a single syntax which you always use on EVERY box really makes life easier.

      Give me an hour to explain my entire .profile, I'll come up with at least a dozen other frequently used programs which make more sense to configure using aliases than in dotfiles (especially considering that there are so many of the little fuckers).

      Parent is asking about ways to make newb's life easier - having to know every little dotfile you have to add/change to make your day more productive is beyond out of control. A simple, single .profile like mine can last for years without revision, and is easy to transport. The only fault I have in my previous post is I didn't say explicitly that aliasing is easier/more portable than dotfiles, b/c I thought that was just common sense. Stupid me.

      But, since we're all being assholes, today, I was wondering if you ever made an original post, or if everything you say is just sniping at other people because they don't do things exactly the way you want. That's a typical Linux apologist for you. Seriously, look at your post history. You really are just a giant penis-shaped boy. You probably use emacs, too.

      Fuck off and die.

      --
      main(){char I,l,O[]={'-',1-1,0,(1<<5)-1,0+'-',-10-1,-10,11-0,- 1,-100};for(I=l=0;l<10+0;put
    3. Re:Some other useful things by scotch · · Score: 0, Troll
      LOL - get over yourself. All your assumptions about me are wrong. Every single one of them! Why didn't you just go ahead and assume I was gay or a child rapist or something while you were at it? That would probably make you feel better.

      PS: I love you.

      --
      XML causes global warming.
    4. Re:Some other useful things by hartz · · Score: 1

      Ha ha ha! Very well put! How did he get such a low UID?

      Somebody mode the parent up!

      --
      --- Abnormally normal.
  37. For starters ... by ic0wb0y · · Score: 1

    Alias ls to dir and make their usernames all Administrator.

  38. Let them change shells by bluGill · · Score: 1

    Shells are a personal thing, and trivial to install and change. Make whichever you want default, but let the advanced users change shells. You might hire an old school Unix guy, like me, who likes his own personal shell. Make sure it is there. Not the default, but there for advanced users.

    csh/tcsh is a must, because it is different and some people prefer it. (I still can't wrap my mind around bash, not that I've tried)

    Install the adventure shell, because someone will want to try it.

    The main reason to do this is some people like to be in charge. chsh is essentially a harmless command that gives your users a psychological feeling of power over the system without giving anything important up.

  39. Newbie toggle script and more... by dreamer-of-rules · · Score: 3, Insightful
    It depends on how much effort you want to put into it, but here are some more suggestions.


    No matter what, make it absolutely clear whenever they use something that can bite them hard on a normal terminal. Don't train them to fail later. Aliasing 'rm' to 'rm -i' can hurt them bad when they get used to typing 'rm *' to be prompted for which files to delete.

    If you want to get really advanced, include two scripts that will switch them to 'normal' mode or back to 'training' mode.

    Start them out in training mode. When they log in, they get:
    * an entire screen of help, including the command to leave training mode, and listing the safety nets you added.
    * their prompt contains "(TRAINING)" or "(NEWBIE)" or something
    * alias 'rm' to 'rm -i', etc.
    * any other safety nets
    * point out 'grep', 'find', 'head', 'tail', 'less' and the cute little 'wc' and where to discover more about unix commands.

    When they switch to normal mode, after confirmation, their login only includes the command to return to training mode. (Which they can edit out of the .bashrc) And their prompt doesn't have "(TRAINING)" in it anymore.

    The idea is that you make sure that they know which safety nets you create, that aren't on other systems. They also get a transistion period for as long as they want. Leaving the "TRAINING" in the prompt is a continual reminder that there setup is more 'safe' than other systems, and may add motivation to go into normal mode.

    The rest of this is from my tcsh experience:

    * set up 'complete' options for common, yet complex commands like 'find', 'alias', 'set', 'man', 'nethack'. (very cool in tcsh, is this feature in bash?)

    * alias l=ls, ll=ls -l, la=ls -a (doesn't hurt anyone)

    * set tab to autocomplete or list matches, if it doesn't already

    * include apache-style comments (maximum verbosity) inside the .bashrc

    * set prompt to "(time) :: (path)\n(host) {(#)}% " (don't know bash)

    * don't alias any DOS commands directly to Unix except for 'dir'. Alias the others DOS commands to mini-helps that remind them gently to use the proper Unix command.

    * use nano

    --
    Everyone is entitled to his own opinions, but not his own facts.
  40. For newbies and pros alike. by Anonymous Coward · · Score: 0

    KDM or perhaps startx

  41. Tab completion, fortunes, and -i by Just+Some+Guy · · Score: 1
    First, me too on the tab completion. I'm partial to Zsh's implementation, but I was the maintainer for FreeBSD's bash-completion port for a while so I'm sort of fond of it, too. Basically, it's crack for CLI users - once they've had it, there's no going back.

    Second, setting up a bunch of "-i" aliases is an extremely bad idea for newbies. Considering that they're starting with a blank slate, this is the time when they can most afford to learn that the machine will always do what they ask and not what they mean. Do you really want them to get used to relying on rm -i not nuking their home directory and then having it disappear one day after they make a mistake in their .bashrc and the alias doesn't get set? Train them to think before they hit enter and make backups often.

    Finally, my first original comment: place a call to fortune(6) in their login script, learn to make a fortune file, and start treating it like a wiki or blog. Have a tip for your users? Put it in the fortune file. A user makes a particularly brilliant mistake that you want to warn the others about? Put it in the fortune file. The randomness of it is a lot more interesting than the ol' MOTD that everyone trains themselves to ignore.

    --
    Dewey, what part of this looks like authorities should be involved?
    1. Re:Tab completion, fortunes, and -i by Rysc · · Score: 1

      I've found that, in bash, when all of thgose fancy completions are turned on it borks globbing with * wildards. For example, ls /home/collin/.*ash*[tab][tab] gives me a list of matching files, but when I turn all of the nifty bash tab completion features on it no longer gives me anything.

      So I tried it, it was crack, but I switched back. I like wildcards.

      --
      I want my Cowboyneal
  42. please do NOT alias in '-i'. by oneiros27 · · Score: 2, Insightful

    I worked doing tech support during my undergrad. The engineering school went and set aliases like you're suggesting, including aliasing 'rm' to 'rm -i'.

    So, of course, as the systems I did support for were stock systems, we had the joy of explaining to people why 'rm *' didn't prompt them, just like they were expecting it to, as it did on the engineering school's computers.

    Dumbing things down can have the exact opposite effect that was intended, when people think that's the way that the shell always works.

    --
    Build it, and they will come^Hplain.
  43. "set -e" by Clueless+Moron · · Score: 1

    That'll teach them very quickly to not make mistakes.

  44. Stop right there! by Anonymous Coward · · Score: 1, Informative
    I'm thinking about stuff like 'stty erase ^H'

    Please... no...

    Some jackass did this in our unified root configs at work and pushed them out to all our boxes. Now everytime I su - on any of them I have to unfuck my terminal.

    BACKSPACE DOES NOT PRODUCE ^H ON ALL TERMINALS!

    http://www.squish.net/docs/delbs.html

    If the termcap/terminfo entries for your TERM on your system match what your terminal actually produces, this is unnecessary and will just piss people off who have a terminal that behaves differently.

  45. good editor by hankaholic · · Score: 1

    Many people have added the idea of using PICO or a clone for basic text editing.

    I'd like to suggest using joe -- it's a nice editor with a good user interface (in that it's easy to figure out how to use based on the interface, without resorting to man pages/tutorials/etc.). It's got a PICO emulation (invoked with "jpico") for those who insist on using keybindings from a badly licensed editor, but offers more commands than PICO and clones.

    It's not guaranteed to be "all the editor you'll ever need", but it offers enough features that the average user will find their requirements to be comfortably met long after they'd have outgrown PICO and been forced to switch editors.

    --
    Somebody get that guy an ambulance!
  46. Here's a few things to help: by Will2k_is_here · · Score: 1

    Make sure every key works the way it's expected. Start with this as an inputrc file:
    http://meta.csd.uwo.ca/~wade/Courses/cs307/Html/Tu torials/G09/inputrc.html

    And here's a script I made that will make a kickass prompt:
    http://meta.csd.uwo.ca/~wade/Courses/cs307/Html/Tu torials/G09/prompt.html

    Tell the user about those environment variables. I had a lot of fun just checking what they all say and changing a few of them.

  47. One of the most useful things to include. . . by munpfazy · · Score: 1

    . . . is something like:

    echo 'Running the file ~/.bashrc. More information is available using the command "man bash"'

    With similar notices in all the dot files.

    As I recall one of the fist headaches I encountered when meeting unix was just trying to figure out which files were run when. We has both bash and csh stuff in the skeleton files, as well a all the other not-obviously irrelevant dot files that get generated over time. For a newbie, it's not at all obvious which files to fiddle with in order to make something happen.

    A few other minor suggestions -

    Document the dot files with excessive comments. It will help newbies get up to speed faster when they try to change something.

    Adding a "-i" to aliases for all the dangerous commands is a good idea, if you ask me.

    Adding a couple examples of aliases, $PATH modification, maybe an if statement, launching an xterm with some geometry and colors, and so on might be nice so people have something to get started on as they try to change their shell to their liking.

    1. Re:One of the most useful things to include. . . by The+Cisco+Kid · · Score: 1

      Launching an xterm might be appropriate in an .xinitrc - it certainly wouldnt be appropriate in a shell rc script.

  48. Hmm... by Slipped_Disk · · Score: 2, Informative

    This is actually a USEFUL Ask Slashdot...

    My two cents:

    The prompt should take the form "user@host:path % " - this is particularly important in environments with multiple machines, and a good idea anyway.

    The shell should be set up for command-line editing (BASH comes this way IIRC, in KSH set -o emacs. If you have any *NIX users (probably not or you wouldn't be submitting this particular question) they can set -o vi if they prefer that.), and the backspace key should work properly (if you need to stty for this do it).

    Shell aliases - forgive my bluntness but fuck the cutesy color shit on ls and any other utilities that wish to make things ugly. If ls comes aliased to "ls -color" or whatever, unalias it. ls should be ls, unadulterated. Same for rm (none of that crappy "rm -i" shit that some linux distros tend to use in the root shell. If I wanted to be bothered I'd add the flag myself, and "protecting users from themselves" will just piss them off).

    What you should add are USEFUL aliases. My personal favorites:
    ll -> ls -al
    la ->ls -a
    lf -> ls -af
    j -> jobs
    h -> history

    You should also take care to set a USEFUL default search path (/bin,/sbin,/usr/bin,/usr/sbin,/usr/local/bin,/usr /local/sbin). Generally I discourage adding ., ~ and ~/bin to the search path, but doing so may make things easier for your users.

    Consider which editor you drop your users into. Pico is a good choice for real newbies, EMACS is the next step up the ladder. vi is probably too different from the windows paradigm for most of your users,

    Also take the time to explain other commands (apropos, man, whatis, whereis, which) that can make life easier.

    I'm sure others have made additional suggestions, but hopefully this is somewhat helpful.

    --
    /~mikeg
  49. bash completion by phlipper · · Score: 2, Informative

    http://www.caliban.org/bash/index.shtml

    - it helps newbies learn what options are available for commands. for pros, it saves a zillion keystrokes a day and is extendable

  50. Re:Looks like no one has given you a real answer y by thorgil · · Score: 2, Funny

    no rm should be aliased to rm -rf so they can delete directories easily

    --
    Warning: This sig contains a small bug. ==> *
  51. things i change by koogydelbbog · · Score: 1

    i use Mandrake at home and Redhat at work and some of the little differences drive me batty. here's what i do to even things out:

    add the following to .inputrc:
    set bell-style none
    set page-completions off
    set show-all-if-ambiguous on
    (tab completion in bash is one of the most useful features but the beeping and having to hit tab twice seems to defeat the purpose)

    modify the following in .dircolors:
    DIR 00:32
    (directories marked as green instead of the dark blue which is virtually invisible on the black background (xterm via putty)) .vimrc:
    colorscheme elflord
    (easiest to remember colorscheme that avoids dark blue)

    i tend to avoid putting pwd in the PS1 because i'd rather have the extra space in the command line and because 'pwd' is easy enough to type. i usually just go with "\h:\u >" just so i know who i am(!) and which machine i'm on.

  52. Re:Ksh? Bash? by solid_liq · · Score: 1

    Everyone keeps talking about people who are switching from Windows. Come on, who still actually uses that outdated operating system? I mean, really! Why don't you help out your more modernized users who are switching to Linux from the Apple IIe??? Give them an iPython shell, so they can have an Applesoft Basic-like shell! --- Q. What's the difference between Batman and Bill Gates? A. When Batman fought the Penguin, he won.

  53. Re:$PS1 - multi-line prompt by hartz · · Score: 1

    Hmmmm, I have also now switched to using a multi-line prompt. I am still of two minds whether I want to use this in all cases, but it is nice on systems where I have scroll-back and window resizing etc. Back in the days of 80x24 I would never have done this!

    I put an open line as the first line in my prompt, followed by the full cwd, and finally a user@host line. I have also started to change the color of my prompt - but only to make it a shade brighter than normal output. I have a bad habit of not reading every line of output, so I find my self searching for my previous prompt line all too often. Having it stand out is therefore quite nice.

    For newbies, I recommend turn on no-clobber.

    --
    --- Abnormally normal.
  54. Modify the .inputrc by bjb · · Score: 1
    If they're going to start using the shell, they might want to learn about tab completion. I assume you're probably getting them to use Bash?

    The ~/.inputrc I use:

    $include /etc/inputrc
    set editing-mode vi
    set mark-directories on
    set completion-ignore-case on

    The editing-mode is up to you. I'm not going to fuel this holy war.

    The mark-directories and completion-ignore-case are probably worth while, however.

    • completion-ignore-case helps out in tab completion by ignoring the case. In other words, if your directory is Documentation, hitting "d" will expand correctly. If you've got more than one 'd' directory (upper or lower), it will treat them equally.
    • mark-directories makes it that when tab completing a directory, it will automatically put a slash at the end (most likely that's what you'd want to do anyway).

    Just thought this might help..

    --
    Never hit your grandmother with a shovel, for it leaves a bad impression on her mind...
  55. Different people learn differently. by Richard+Steiner · · Score: 1

    I've been a heavy user of command lines for over 20 years on a variety of OSes, most of them not UNIX or a UNIX derivative, and I admit that I generally prefer scads of aliases and shell scripts to a menu.

    However, I still use mc under Linux (and FileJet under OS/2 and DOS, and @VSH under OS2200) to peruse the filesystem and to perform certain types of commands (mainly directory tree deletions and selective operations where point-and-shoot is more convenient for me than a series of filespecs).

    Like text editing, the specific methods and tools that different people use for file management can vary tremendously.

    --
    Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
    The Theorem Theorem: If If, Then Then.
    1. Re:Different people learn differently. by jgrahn · · Score: 1
      Like text editing, the specific methods and tools that different people use for file management can vary tremendously.

      ... which leads me to suggest that you shouldn't spend too much time devising clever schemes for your users. Encourage them to learn and to reconfigure for themselves.

      • Find, write, or rewrite a cheat sheet for the most common stuff, and mention how to find the man pages.
      • Buy a handful of O'Reilly books (which title?) and sprinkle them throughout the officescape.

      Navigating the directory hierarchy and editing the command line efficiently seem to be universal problems, so you might want to fine-tune the prompt, completion and editing keys a bit, and teach people that ^A, ^E and ^U exist. And ^R in bash. I've seen so many people waste time retyping the same thing over and over again ...

      Whatever you do, don't create a maze of global config files which source each other to pick up various clever configurations ... you will get it wrong, especially when your site goes multi-OS, and noone will dare change their dotfiles for fear of breaking some important path or variable somewhere ...

  56. Re:$PS1 - multi-line prompt by klui · · Score: 1

    Interesting. I have very recently thought about window size. For the longest time, I have used 80x48. But very recently I had to go through a lot of data to spot check some stuff (too lazy/not enough time to write another program to check) and a lot of the rows are 2 lines' worth. It was difficult looking at the screen while using less and see the lines flip from one line to the next on alternating screens. I have begun to use 80x49, reserving 1 line for pager status. I guess that's why IBM chose, in part, 80x25 as their original monochrome display size.

  57. Background processes and multiple consoles by Frodo+Crockett · · Score: 1

    I haven't seen anyone mention these yet, so be sure to tell your users how to run a process in the background and how to acess the virtual consoles (if they're each going to have their own *nix desktop).

    If you make a cheat sheet, I suggest putting a detailed map of the *nix directory structure on the back side of it, with notes explaining what's in each directory.

    --
    "The newly born animals are then whisked off for a quick run through a giant baking oven." --heard on Food Network
  58. My current bashrc. by irc.goatse.cx+troll · · Score: 1

    Is at http://catheadlabs.com/~semi/bashrc.
    Not really good for beginners, but it has some useful stuff (like automaticly resuming a screen session if one exists and you're not currently inside it), Some not so useful stuff (I have code to check identd of the ssh client logging in commented out), And then your standard aliases and settings.
    Still sort of a work in progress. I'd like to add on ssh agent checking and maybe some other stuff, but hopefully this will help someone.

    --
    Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
  59. Re:$PS1 - multi-line prompt by hartz · · Score: 1
    Here is a little Unix gem - use when viewing logs and other output where lines are longer than the terminal window is wide:

    some-command | sed G | less


    Use of the "sed G" above adds an open line after every line from the output of some-command (The Yank space is empty by default). Obviously by placing something else in the yank-space you can substitute that in stead of an empty line.

    This is a "tip" I picked up somewhere, can not remember where any more, and out of the thousands of tips I've read in my life, one of only a handfull that was actually new and also usefull! (I find that happens very seldomly)
    --
    --- Abnormally normal.