Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Some programs use a style when one dash means a character for an option and two dashes mean one option which is several characters. But some programs take one dash and then an option which can contain several chars. For example:
feh -F -Y
so there are two options.
find / -iname '*pattern*'
has just one option - "iname" but not "-i -n -a -m -e" even though has one dash before. You just gotta figure it out for each program.
a simple output on my system (with run command 'ps -aef | grep bash')
kumaas 12582 12580 0 14:08 pts/0 00:00:00 bash
kumaas 15784 15776 0 15:59 tty2 00:00:00 -bash
root 25736 25728 0 20:54 pts/0 00:00:00 -bash
root 26922 25736 0 21:20 pts/0 00:00:00 grep bash
in line 2 and 3 bash started with dash but the other two lines do not
When programs are run on unix systems, they are passed a set of strings. Whatever invokes them builds that set. The shell does it, the login process does it, every program is run by calling some variant of the "exec" system call.
The first of those strings is conventionally the string that was used to invoke the program, but the important thing to understand is that that's only a convention. For instance, here's how you run bash and tell it its name is "hahaha funny":
~/sandbox/49381$ cat >exectest.c
~/sandbox/49381$ make exectest
cc exectest.c -o exectest
~/sandbox/49381$ echo $0
~/sandbox/49381$ ps f
PID TTY STAT TIME COMMAND
11697 pts/0 Ss 0:00 bash
31603 pts/0 Sl 2:13 \_ /opt/google/chrome/chrome --disable-gpu-blacklist http://mail.google.com/mail/#inbox
31608 pts/0 S 0:04 | \_ /opt/google/chrome/chrome --disable-gpu-blacklist http://mail.google.com/mail/#inbox
3732 pts/0 S 0:00 \_ hahaha funny
3785 pts/0 R+ 0:00 \_ ps f
I vaguely remember that bash processes that show up as -bash in ps output are login shells. Presumably the login binary uses the technique explained by jthill to make it so.
A test has just confirmed that a login shell does indeed show up that way. I had to use a virtual terminal; presumably the bash login process that results from using a graphical login screen hash bash replaced by some other program.
Last edited by catkin; 02-03-2012 at 01:03 AM.
Reason: missing words