background image

 

 

01 

Programming Methods and Techniques I 
Introduction to UNIX System 
Andrzej Głowacz, Ph.D.

 

2010-10-04 

 

Task 1 Starting Kubuntu Linux 

1.  Start with turning your computer on. Then choose operating system Kubuntu to boot up. Kubuntu will start 

boot program. 

2.  Next  the  system  kernel  and  hardware  drivers  will  be  loaded.  After  system  is  ready  to  work,  you  will  see 

graphic  environment  KDE.  Type  following  URL  address  in  browser: 

http://eit.agh.edu.pl/spe/PMaTI_en

Read all published documents: a) course rules, b) lectures and c) laboratory instructions. 

Task 2 Using Konsole 

1.  In  the  system  taskbar  select  and  click  Konsole  shortcut  -  it  is  located  in  Start  >  System  >  Konsole  (icon 

displaying terminal screen). 

2.  After console is started you will see window with prompt message 

ubuntu@ubuntu:~$

 

3.  This  notation  means  that  you  are  logged  as  user  „ubuntu”,  into  operating  system  „ubuntu”,  and  working 

directory is tilde („~”). Tilde is general shortcut to your home directory. In this case you are logged in local 
system  and  storage  system  is  located  on  local  hard  disk.  Note  that  Kubuntu  is  specific  version  of  Ubuntu 
Linux. 

Task 3 Linux commands 

1.  There are many commands and combinations of them in UNIX system. This is advantage for programmers 

and  UNIX  systems  are  commonly  used  for  advanced  tasks.  A  command  consists  of  its  name,  options  and 
parameters, which can be typed in console window. 

command [options] [parameters]

 

2.  Option  (or  switch)  is  a  sequence  of  characters  usually starting  with  “-“.  It  defines various  behavior  of  the 

same  command.  For  example, 

ls

  command  will  print  files  in  working  directory,  whereas  command  with 

option 

ls –l

 will print additional information. 

3.  Parameters (or arguments) define objects of command operation. For example, 

ls –l Desktop

 in Kubuntu 

will print the content of directory Desktop. Let us notice, that command is mandatory, whereas options and 
parameters are not required (we write it with square brackets []). 

4.  Basic  commands  are: 

ls

  prints  files  in  directory; 

uname  –a

  prints  information  about  system; 

date

  prints 

local time, 

pwd

 prints working directory. 

Task 4 Using documentation 

1.  Most  commands  are  well-documented  in  UNIX  system.  Manual  pages  for  specified  command  can  be 

displayed  by  typing 

man  command

.  For  example, 

man  ls

  (notice  that  ls  is  parameter  for  command  man

prints manual for a command ls. You can move across man pages with  

  Page down - combination of "^V" (CTRL+V) or space, 
  Page up – combination of "^B" (CTRL+B), 
  "/" –search, 
  "Q" - quit. 

2.  For some commands, documentation can be displayed with 

info command

, e.g. 

info type

3.  Some commands prints a short usage description after typing 

command --help

, e.g. 

ls --help

. There are 

additional  possibilities: 

whatis  command

  prints  brief  command  description, 

whereis  command

  prints 

command and manual localization, 

type command

 prints type of the command. 

4.  For search keyword in the whole documentation, there is command 

apropos  keyword

. This prints pages, 

where keyword is found. 

Task 5 Users 

1.  UNIX users are divided into groups of different privileges. Users and groups are created by superuser (root). 

Each user has its own ID number, which can be checked with command 

id

2.  There can be many users logged in remotely at the same time and each user can have concurrent sessions. 

List of logged users can be checked with one of the following commands: 

who

w

finger

. The difference here 

is in options and results. For example, 

finger user

 prints following information about user: username, 

background image

 

 

home directory, login status, mail status, plan file, name, surname and default shell. Shell is a program 
interpreting the commands. Common shells are: bash (GNU Bourne-Again SHell) and tcsh (T C-like syntax 
SHell). 

3.  Users run programs, which create processes in machine’s memory. List of executed processes can be 

checked with command 

ps

, or 

ps -u user

 for given user. 

4.  First and foremost, active process is shell (and ps – when it is run). Useful information is PID (unique 

process ID), TTY (terminal which run process), running time and process name. 

Task 6 Logging into remote system (student.uci.agh.edu.pl) 

1.  We want to connect to remote host named student.uci.agh.edu.pl, which is located in UCI (University Center 

of Informatics). For safe login into server we use ssh (ang. Secure Shell
 

ssh user@student.uci.agh.edu.pl

, where user is name you received when your account was created. 

2.  System prompts for your password – you need to type it (password is not displayed on screen because of 

security reasons) 

password: 

 

3.  After successful login, you receive system information and prompt 

login@student:~ (101) >

. Now you 

are in terminal of remote system and all commands are related to that system. 

4.  Command 

passwd

 let you change your password in system. You need to give old password, and twice the 

new one (in order to avoid typing errors). There are the same rules as during login (passwords are not 
displayed). Passwords should be changed at first login or after specific time. 

5.  Session ends after command 

logout

.  

6.  Command 

ping server

 checks, if the server is reachable in network: 

ping student.uci.agh.edu.pl

This should be the first command in lack of connection. To check routing path, you can use command 

traceroute server

Questions 

1.  Read carefully course rules. If something is unclear or you have additional questions, this is certainly the 

best time to ask the lecturer. 

2.  If it is your first contact with UNIX, you need to learn starting and closing the system, Konqueror browser 

and Konsole

3.  Get familiar with commands: man, info, ls, uname, whatis, whereis, type, apropos, id, who, w, finger, ps, ping, 

ssh. Put your focus on following: a) what is the purpose of each command? b) what is the syntax? c) what are 
the options? d) what are the parameters? e) what is the usability? 

4.  Notice the differences between local (Kubuntu) and remote (SunOS) system. Are commands the same in 

both systems? 

5.  Download image Kubuntu Linux from 

http://www.kubuntu.org

 and burn it. After disc is ready, you can boot 

up your computer directly from it. Try all the presented commands by yourself.