[ Pobierz całość w formacie PDF ]

Part 3: Basic Operations FAQ 31
Linux Newbie Guide by Stan, Peter and Marie Klimas 01/08/2003
Please note that under Linux (or UNIX), the file extension (for example .exe or .com or .bat) does not make the file executable. The
file needs an "executable file access mode" which is not unlike a "file attribute" under DOS.
3.1.4 How can I change the PATH?
Typically, you don't have to change your PATH, but it very useful to understand what PATH is.
The PATH is the list of directories which are searched when you request the execution of a program. You can check your PATH using
this command:
echo $PATH
which, on my system , shows the PATH for the user "yogin" to be:
/opt/kde/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/yogin/bin
The ":" is a separator, therefore the above PATH represents a list of directories as follows:
/opt/kde/bin
/usr/local/bin
/bin
/usr/bin
/usr/X11R6/bin
/home/yogin/bin
Here is the output from the command "echo $PATH" run on my system on the account "root":
/opt/kde/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
You can change the PATH for all users on the system by editing the file /etc/profile and adjusting (as root) the line starting with
"PATH=". I do it using the pico editor (as root):
pico -w /etc/profile
(The option -w turns off the wrap of long lines.)
Re-login for the change to take effect. To set up the PATH for an individual user only, edit the file
/home/user_login_name/.bash_profile (please note the dot in front of the filename--files starting with a dot are
normally invisible, you have to use ls -a to see them).
If you really want to have the current directory on your PATH, add "." (dot) to your PATH. When used in the place when directory
name is expected, a dot means "the current directory". The specification for the path in /etc/.bash_profile may then look like
this:
PATH="$PATH:$HOME/bin:"."
export PATH
This command takes the contents of the environmental variable called PATH (as set for all users in /etc/profile), and appends to
it the name of your home directory as set by the variable HOME with an attached "/bin" and then a dot. Finally, the command assigns
the resulting string back to the variable called PATH. It is necessary to use the command "export" after modifying PATH or any other
user-environment variable, so that the variable is visible outside of the script that sets it.
3.1.5 How can I shutdown my computer?
Close all your programs saving the data as desired. From your GUI main menu (e.g., "K"), select "Logout". Then, from the logon
screen, select: "System"-"Shutdown".
Alternatively, from a text terminal, press (the "three-finger salute", you press the three keys simultaneously),
wait for the shutdown process to complete, and turn off your machine only after it starts rebooting again. If you are in X-windows,
first switch to a text terminal by pressing (three keys simultaneously).
Never turn off your machine without the proper shutdown or else you may have disk error messages next time you boot. (Typically,
the errors resulting from improper shutdown will be repaired automatically during the next boot, but occasionally more serious
problem may result, and then you may need to repair the files manually or re-install!)
Part 3: Basic Operations FAQ 32
Linux Newbie Guide by Stan, Peter and Marie Klimas 01/08/2003
If you prefer your computer to go to a halt after you press (instead of the default reboot), you can set this up
by editing the file /etc/inittab. This file specifies something like this:
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
As root, replace the option "-r" to "-h" so that the same fragment reads:
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -h now
The line starting with "#" is just a comment (it is for humans, it does not have any effect on the computer). The option "-t3" tells the
shutdown command to wait 3 seconds before it starts killing processes. The options "-r" and "-h" stand for "reboot" and "halt"
respectively, so they perform a shutdown to reboot or a shutdown to a system halt.
Root can also use the shutdown command directly. This command can be used for either local or remote shutdown of your
computer, but is used mostly for remote shutdown when the local keyboard is not available so you cannot use .
It can also be very useful if a program hangs so that the keyboard is no longer functional. For example:
telnet name_of_machine_with_no_operable_keyboard
[login as a user]
su
[give password]
Now either execute ps axu |more, find the process id of the offending command in the ps output and do
kill pid_of_offending_process
or reboot your machine with:
/sbin/shutdown -rn now [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • granada.xlx.pl
  •