IT 244 – Chapter 2: Getting Started

advertisement
IT 244 – Chapter 2:
Monday: (Preparation – have Oracle VirtualBox running both Windows and Linux)
NOTE: email me at bmahf@cs.umb.edu and I will add you to the Google Group
Getting Started
Chapter 2
Logging In: (15 mins)





If sitting in front of a Linux system
o Choose Applications > Accessories > Terminal, and type
 “ssh <yourlogin>@users.cs.umb.edu”
If sitting in front of an Apple Macintosh system
o Choose Applications > Utilities > Terminal, and type
 “ssh <yourlogin>@users.cs.umb.edu”
If sitting on a Windows system
o open PuTTY, enter the hostname as users.cs.umb.edu, make sure that
ssh is chosen, and click connect.
o ssh is a secure method of creating a network shell connection.
 encrypts data sent over the connection.
o Other commands such as telnet or rsh are not secure methods.
In both cases you will be prompted for a password.
Login security measure - The system gives some information about when the
last login was and where it originated. Take a look at this each time you log
in just to make sure no one has logged in as you.
The Shell: (10 mins)




After logging in, you will see a prompt to the left of the cursor. This prompt
is set up for you by the system (or administrator) and can be changed by you
to give the information you want to see.
UNIX commands are typed in after the prompt, followed by the Enter/Return
key. Output of any command given will display on subsequent lines.
Important to have the correct terminal setup in TERM or sometimes keys
don’t work as expected, or displaying doesn’t happen properly.
o If using ssh or PuTTY to Linux, this shouldn’t be a problem:
 BUT::: Make sure to read P. 29 about setting up your
backspace before contacting the Google group.
Aborting a process you have started
o Ctrl-C, or
o Ctrl-Z, and then do ps to find PID and run kill <PID>
Command Documentation: (10 mins)




man pages
o Manual pages for almost all commands on the system. Some
commands installed later may not have had man pages installed.
o “man man” as an example.
o FHS (Filesystem Hierarchy Standard) separates man into 10 sections:
 List given on p. 34 of the book.
 Some commands are shown in more than one section.
 To type “man <command>” shows the first occurrence.
 To type “man <number> <command>” shows the man
page from the given section if it exists.
o “man –k <keyword>” – gives a listing of all commands appropriate for
the given keyword. This is the standard way of doing this.
 Example: “man –k process”
Apropos
o Does the same thing as “man –k”
Info
o Developed by GNU and distributed with Linux.
o Limited number of commands can be displayed this way:
 Linux shells, utilities and programs developed by GNU project.
 More complete and up to date information is given about these
utilities.
o Type “?” while in info to see all commands for using this utility.
o Type “q” to quit out of info.
--help
o Most GNU utilities provide a “--help” option, while others may provide
a –help or –h option. Gives a quick (though sometimes cryptic)
synopsis of the syntax for the command.
Basic commands: (20 mins)

ps command – Process status
o Allows for identifying the shell you are using.
o ps –ef == ps –aux
 Both show all processes running on the system but the output
of the first (standard syntax) and the second (BSD syntax) are
somewhat different.
 Important columns:
 USER (BSD) == UID (standard) - owner of the process
 PID (both) – Process ID
 PPID (standard) – Parent process ID
 %CPU (BSD) == C (standard) – current CPU usage

 START (BSD) == STIME (standard) – process start time
 TIME (both) – amount of time process has been running
 %MEM (BSD) – percentage of memory currently used
 COMMAND (BSD) == CMD (standard) – process name
o Many options change what is displayed to screen or the entries in the
list of processes reported on.
su/sudo
o su - causes you to become superuser if you have the correct password
o sudo – if your login is in the /etc/sudoers file, you can use this to run
as superuser for the length of one command, giving your own
password.
o On Linux su is disabled by default, allowing for using sudo.
Download