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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've decided to learn a bit more about Linux Mint by looking closely at some commands and how they work, choosing the reboot, shutdown, halt, poweroff group to start off with.
Browsing through the web, I've found all sorts of conflicting information about the behaviour of these commands and their options, perhaps related to differing implementations.
I therefore decided to concentrate completely on the versions of these commands as they exist on my Linux Mint 17.3 KDE system. Accordingly I ran
Code:
man reboot
and
Code:
reboot --help
and immediately came across a conflict, the former not including the -n and -q options described by the latter.
So three questions if I may:
(i) Why do 'man reboot' and 'reboot --help' differ and which of these, if any, is authoritative?
(ii) Is there any good source that anyone would recommend where such lower level commands and their options are explained in far more detail than in the man command?
(iii) Where do I find the source code for the various commands for my Mint 17.3 KDE system? (because, if the code isn't too complex, I suspect that this is going to be my only real way of learning what the commands do on my system)
I've decided to learn a bit more about Linux Mint by looking closely at some commands and how they work, choosing the reboot, shutdown, halt, poweroff group to start off with.
Browsing through the web, I've found all sorts of conflicting information about the behaviour of these commands and their options, perhaps related to differing implementations.
I therefore decided to concentrate completely on the versions of these commands as they exist on my Linux Mint 17.3 KDE system. Accordingly I ran
Code:
man reboot
and
Code:
reboot --help
and immediately came across a conflict, the former not including the -n and -q options described by the latter.
So three questions if I may:
(i) Why do 'man reboot' and 'reboot --help' differ and which of these, if any, is authoritative?
(ii) Is there any good source that anyone would recommend where such lower level commands and their options are explained in far more detail than in the man command?
(iii) Where do I find the source code for the various commands for my Mint 17.3 KDE system? (because, if the code isn't too complex, I suspect that this is going to be my only real way of learning what the commands do on my system)
man is a command to start a program called man that holds many documents on the programs that write a man page that tells about itself,
the command
Code:
man reboot
calls the program man the second is the argumant telling that man program to pull up the man pages for the program called reboot
reboot --help calls up the help code/file that is written within the reboot program itself giving the user what ever it was thet the person that wrote reboot to read and tell them what they think they need to know in order to operate that program.
why do we put two -- hypens and not one - hypen when we call for help --help?
because programs that are written to take a argument(s) or options (as they are called by some) use just one hypen to tell that program that it is part of it a function within the program and to then look for the argument after it. or the pram iof that is the way it is written to take in one, and that is needed within that argument so that it can use it to preform its task. or it is a empty pram function where just the one hypen is neeeded then the function call.
this is why reboot -help will cause errors.
Code:
ruserd@userx-VirtualBox:~$ sudo reboot -help
reboot: invalid option: -e
Try `reboot --help' for more information.
userd@userx-VirtualBox:~$
to find the source code for a program GOOGLE is the best place to look, "program name" source code [enter]
Actually make Google your friend in all of your what you do with Linux your first best friend then LQ your second.
I've decided to learn a bit more about Linux Mint by looking closely at some commands and how they work, choosing the reboot, shutdown, halt, poweroff group to start off with.
i think you've chosen an unfortunate starting point:
these commands are usually not genuine commands, but either scripts calling a different command, or, in my case, links to the init program (systemctl).
(reboot -h immediatly reboots my system. didn't think when i was typing)
try
Code:
ls -al $(which reboot)
cat $(which reboot)
to see what sort of file it is (link or script or actual program).
if the cat shows gibberish, nevermind.
if it shows a shell script, it might give you a hint as to what that command really does (and where to find documentation on it).
I kept reading this thing about man, what is it? go look in the mirror?
I don't use man, but all this talk got me courious, so here it is.
Quote:
I believe reboot comes from shutdown so most likely
man shutdown
so I tried it....
Code:
%userx@voided ~>>$man reboot
HALT(8) System Manager's Manual HALT(8)
NAME
halt, reboot, poweroff – stop the system
SYNOPSIS
halt [-n] [-f]
reboot [-n] [-f]
poweroff [-n] [-f]
DESCRIPTION
halt / reboot / poweroff tells init(8) to bring down, reboot, or power
off the system. Without -f, it is a shortcut for init 0 / init 6.
-n Don't sync before reboot or halt. Note that the kernel and
storage drivers may still sync.
-f Force halt or reboot, don't call init(8). This is dangerous!
UNSUPPORTED OPTIONS
This version of halt is based on runit(8), the following features are not
supported and silently ignored:
-w to just write the wtmp record.
-d to not write the wtmp record.
-h to put hard drives in standby mode.
-i to shut down network interfaces.
SEE ALSO
shutdown(8), init(8)
AUTHOR
Christian Neukirchen, chneukirchen@gmail.com.
Linux July 29, 2014 Linux
Many thanks to all for your kind replies and help. I have obtained the source code for the reboot command (apt-get source upstart) after enabling the source code repositories in the Synaptic Package Manager, and this is proving very fruitful in understanding what it does.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.