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?"
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.
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.
What I'm listening to now on Pandora...
Why don't you use a real shell environment, like Common Lisp?
OMG! Wau!
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. .(incase things go wrong make a simple script to reset their profile so you can rest easy).
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
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
Yes as KSH/bash are such limited enviroments ??
it's not as if you couldnt just call cLisp from your normal shell
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
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.
Find out about the Lexus Rx400h Hybrid!
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
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
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!
exit
Software Wars
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:
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.
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!
Alias the dos commands and add the Joe (wordstar-compatable) text editor.
"Eve of Destruction", it's not just for old hippies anymore...
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
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
.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.
#!/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
/* oops I accidentally made a comment, sorry */
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.
are you kidding??? set -o vi goddangit! Gots to start these newbs on the right foot!
Don't laugh!
:w :q :w! :q! :f /
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
And that brings me up to pico ability!
mad!
Sam
blog.sam.liddicott.com
Because the author specifically said, "No shell advocacy, please; it's going to be ksh or bash", you fucktard.
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
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.
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.
Unitarian Church: Freethinkers Congregate!
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.
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
blog.sam.liddicott.com
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.
my sstream of consciousness
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.
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
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.
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."
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.
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.
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
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.- 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
.
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).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
main(){char I,l,O[]={'-',1-1,0,(1<<5)-1,0+'-',-10-1,-10,11-0,
Alias ls to dir and make their usernames all Administrator.
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.
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
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
* set prompt to "(time)
* 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.
KDM or perhaps startx
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?
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.
That'll teach them very quickly to not make mistakes.
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.
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!
Make sure every key works the way it's expected. Start with this as an inputrc file:u torials/G09/inputrc.html
u torials/G09/prompt.html
http://meta.csd.uwo.ca/~wade/Courses/cs307/Html/T
And here's a script I made that will make a kickass prompt:
http://meta.csd.uwo.ca/~wade/Courses/cs307/Html/T
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.
. . . 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.
This is actually a USEFUL Ask Slashdot...
r /local/sbin). Generally I discourage adding ., ~ and ~/bin to the search path, but doing so may make things easier for your users.
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,/us
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
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
no rm should be aliased to rm -rf so they can delete directories easily
Warning: This sig contains a small bug. ==> *
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:
.inputrc:
.dircolors: .vimrc:
add the following to
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
DIR 00:32
(directories marked as green instead of the dark blue which is virtually invisible on the black background (xterm via putty))
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.
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.
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.
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.
Just thought this might help..
Never hit your grandmother with a shovel, for it leaves a bad impression on her mind...
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.
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.
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
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
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.