Quick viewing(Text Mode)

Tiago M. D. Pereira

Tiago M. D. Pereira

Basic / Course

Tiago M. D. Pereira

Institute of Theoretical Astrophysics Christmas Party 2016

Black board

౮ถ Brenda Lluís Nuri شقایق Andri Øyvind Karla Sven Kosovare Jack Max

Stein Hans Ata Thomas Marie Sergio Luc Bridget Miki Vidar Kristian شاهین Mats Iris

Ingunn Simen Mikołaj 姨

Vasco Cathy Viggo Ada Håkon Tiffany Øystein Noelia Marianne Ove Barbara Tiago O. Odd Marianne Kari Clara Magnus Ellen Håvard Ainar Petter S. Torben Daniel

Kristine Harald Pia भावना Tone Mattia Cecilie ያብባል

Food Felix Ben Christer Frode Trygve IN Fireplace

Institutt for teoretisk astrofysikk Julebord 2016

���� ���� ���� ���� ���� ����

������� ����

��������� ��� ��� ������� ������ ��� ������ ������ ��� ������� ��� ���� �� ����� ��� ��������� �������� ������������� ��� ���� ��� ����� ����� ������ ���� �������� ��� ����� ����� ����� �� ����� ������������� �������� ��� ��� ������� �������� ����� ���� ����� ����� �������� ��� ������ �� ���������

�������� ���� ���� ���� ����� ��� ��������� ������ �������� �� ��� �������������� �������� ���� ���������� ������� ���� ���������� System III & V family ����� ��� � �

��� ��� ��� ���� ������ ��� Main features of Unix

• Multi-user

• Multi-tasking

• Managed by kernel ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ����

�������� �������� ������ �������� ����� ������������ �������� ����� ������� ����� ���� ����� ����� ��������� ���� ���������� ����� �� ���������� �� ����� � ���������������� ��������� ����� ���� � ������������������������������������������� ����� ��������� ����� ��� ��� ���� ������������� ������� ������ ������� ������� �������� ����� ��������� ���� ��������� ��������� ��������� ��������� ����������� ���� ���� ������� ���������� ���������� ��������� � ���� �������� ������� ������� ��� ������� ���� �������� �� ������� ����� ��������������� ������ ��� ������� ������� ���������� ������������ ������� ������ ��������� ���������� ������� ������ ����� ������ ������ ������� ������� �������� ������� ���������� ������� ������� ���������� ������� �������� ��������� ����� ��������� ������ ������� ������ ����� ���������� ���� ���������� ���� ���� ����� �������� ��������� ������� ������� ���� �������� ������� ����� ������� ������� ����� ��� ������� ����� ��� ����� ��� ��� ���� ��������� ������ ������� ������ ������ ��������� ���������� ������ ������� ��������� �������� ������ �� ������� ������� �������� ������� ������ ���� ������� ������� ������� ����� ���� ���� ������� ���������� �� ���� ������� ���������� ����� ����� ������ ����� ������ ����� ��������� ������� �� ���������� ���������� ������� ����� ���� ����� �������� ������������ ������ ��� ���� ���� ����� ������ ���� ������ ����� ������ ����� ������ ����������� ������ ������ ���� �� ���������� �� ������ �� ������� ������� ��������� ������� ������ ��������� ��� �� ���� ���� ����� ����� �� ������ ��� ���� ����� ������� ������ ������ ����� ���������� ������ ���� ��� ������������ ���� �������� ������� ������ ������ ������ ������ ��������� ������� ������� ��������� �� ����� ���� ������� ��������� ������� ������� �������� ������� ����������� �������� ��������� ������ ������� ����� ������ ����� ����� ��������� ������ ��������� ������ ������� ������ ������� ���� ������ ���� ���������� ������� ���������� �������� ����� �������� ����������� �������� �������� ��� ������ �������������� ����� �������� ����� ������ �������� ������� ��������� ����� ������� ������ ������ ������ �������� ���������� ������ ������� �������� ���������� ��������� ������ �������� ������ ������� ����� �������� ������� ��������� ������ ����� ������������� ����� ���� ������ ������� ������� ����������� ������� ������� ������������ �������� ���� ������ ������ ������������ ����� ������� ��������� ��������� �������� ���� ������� ������� �������� ������� ������� ������ ������� ��������� ����������� ������� ������ ����� �������� ������� ������� �������� ���� ����� ����������� ����� ���������� ����� �������� ������ ������ �������� ������� ��������� ����� ����� �������

��� ���� �������� ����������� ������ �������� ���� ������ �������� ����� ���� ���� �������� ��������� ������� ��������� ���� ������ ��������� ����������� ������� ���� ������ ���������� ����������� ������� ����� ������ ������� ������ ������� ������� ��������� ������� ����� ����� �������� ��� ������ ���� ������ ���������� ��������� ��� ���� �������� ������� ��� ����������� ������� ���������� ������� ������� ������� ��������� �������� ����� ���� ������������ ���������� ������������� ���������� ���� ������� ����� ������ ����������� ������ ������� ���� ���� ��� ��� ������� ������ ����� ������� �������� ���������� ����� ������ ������ ���

�����

������� ��� ������������ ������� ������� ������ �������� ��� �������� ����� ��������� ������ ������ ������������ ����� ����������� ���� ������������ �� �������� �������� ������� ������� ������ ������ ��������� ��� ������ ���� ������� ���� ����� ������� ��� ������ ������� ������� ����� ����� ��� ������������ �� ������ ������� ��������� ����� ����� ��������� ������� �������� ������ ����� ������� ����� ������ � ��� ����� ������� �� ����� �������� ������� ������� ��������� ���� �� ������ �� ������ ���� ������ ������� ������ ������ ������ ����� �� ��������� ����� ����� ���������� ��� ��� ������� �������� ������ ������ �������� ���������� �������� ������������� ������� ������� ��������� ��� ������ ���������� ������ ����� ������ ��� ��� ��� ��� ���������� ������� ������ �������� ���� ����� ��� ����� ����� ������� ������������ ���� ������ ������ ��� ����������� ������������ ������� ���� ��� ��� ����� �� ����� ������� ������ ������� ��� ���� ������ ��� ������� ��� ������ ����� ���������� ��� ��������� �������� ��� ����� ���

������� ����� �� ������ ��� ������� ������� ����� ������ ������ ������ �� ������ �������� �� ���������� ������ ��������� ����� ����� ������ ������� ����� ������� ���� �������������� ��������� ������ ������ ����� ��������� ���� ������ ����� ����� �� �������

����� ������ ����������� ������� �������� ����� ������� ��������� ������� �������� ��������� �������� ���� �������� ������ ���� �������� �������� ������ �������� ���� ����� ��� ������� ������

��� ������� ������ ������� ���� ��������������� ������ ����� ��������� ����� �������� ������ ��� ��� �������� ����� ����� ����� ������ �������� ��� ��������� ���� ������� �������� ������ ������ ���������� ��������� ������� ����� ������ ������� ���� ���� �� ������� ��������� ������� ����� ��������� ����� ���� ������� ����� ������� ������� ���������� ��� ���������� ������� ����� ������ ���� ������� �������� ������ ���� ������ ������ �������� ���������� ������� ���� ������� ��� ���������� ����������� ��� ������ ���� �������� ����� ������� ��� ������������ ��������� ����� ��� ������� ������ ���������� ����� ���� ���� �� ������� ������ �� ������� ������ ����� ����� ������� ����� ������� �������� ������ ����� ������� �������� ������ �� ������� ����� ��������� ����� �������� ����� ����� �������� ������ ������� ���� ��������� ������ ����� ������ ���� ������ ��������� ���� ��������� ���� ���� ������������ ������� ����� ��������� �������� ����� ������ �� ���� ������� ���� ����� ������ �� ����� ����� ����� ��������� ����

������� �� ����������� ����� �� ������� ���������� ��������� ����������� �������� ��

���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���� Today’s first terminal command

• Open a Unix terminal (own Mac or connect to a remote Linux)

• Enter -a, and see which Unix you are running Today’s lecture in a nutshell

1. Processes

2. Users and groups

3. Permissions

4. Filesystems and system resources

5. Hands-on tutorials Linux processes • Child: created by another at run-time • Daemon: run in background, mostly system processes • Orphan: when parent process dies and “child” remains • Zombie: when “child” finishes but “parent” does not take notice • Parallelism: many processes per user (MPI) or multithreaded process (OpenMP) Process signals: Process vs : • SIGINT (Ctrl + C): Process: own memory space • SIGTSTP (Ctrl + Z): suspend, use fg to get back Threads: shared memory • SIGKILL (kill command): terminate immediately • Many other... More on processes

• Each process has own id (PID). Use ps to check on processes

• Processes can have controlling terminal or be in background (ps xau for all processes and showing user). Also pgrep -af

• Use top to see which processes take more system resources

• To force quit a process, use kill or pkill

• Launch process in background: nohup process & For more powerful options use screen. Process priority

• Nice: process priority, from highest (-20) to lowest (20) commands: nice and renice

• Users compete for resources!

• Nice: default 0, goes up with time

• Only administrator can set nice < 0 Users

• Users define: username, name, home , shell, groups

• Root: special user for administrative / system processes Other special usernames reserved (e.g. nobody, www, sys, lp)

• Network and local users

• Not all users have access to all functions in system (file access, hardware, etc.)

• su to change user identity. to run process as admin. Users

• Who’s on the system? Use command w. Also finger (not in ITA’s Linux).

• Info about UiO users: http://personer.uio.no/

• Write to other users on the terminal: write ! (make sure it is enabled with mesg y) Groups

• Users can be placed in groups for common permission setting. E.g. common files, printing, editing webpages, administrators.

• Find your own groups: id . All astro people should be on group astuser; students also in aststud.

• All files and directories have permissions for user, group, and everyone. Unix permissions

• Three basic types: read, write, execute (r w x)

• Execute for executable files and directories (cd to)

• Use ls -lah to see details on files, including permissions snowgum:~ tiago$ ls -lah test.hdf5 -rw-r--r-- 1 tiago staff 959M 24 Sep 18:59 test.hdf5

Permissions Username Group Size Last modified File name -rw-r--r-- { { { Reserved User Group Other

-rw------Only user can read and write

-rw-r----- User can read and write, group can read

-rw-rw-rw- Everyone can read and write (dangerous) drwxr-x--x Directory, everyone can cd to and read files, but others cannot ls

• Use chmod to change permissions, e.g: chmod a+r (all read), chmod go-w (group and other not write) • Use chown : to change ownership of a file Permissions

• Use chmod to change permissions, e.g: chmod a+r (add read permission for all) chmod go-w (remove write permission to group and other) chmod ugo+x (add executable permission for all) • Use chown : to change ownership of a file, e.g: chown tiago:astuser will change ownership to user tiago and group astuser. • Default permission of new files set by umask. Filesystems and system resources

• Local and remote disks can be mounted. Use df -h to see which disks are currently mounted.

• Normally only root can mount, some exceptions (e.g. USB)

• Different disks appear as different directories (mount points)

• Your will reside in one of these mount points. Use echo $HOME to see where

• ITA: SAN in /mn/stornext/???, networked (NFS) at /astro/local � ������

���� ���� ����� ���� ���� ���� ���������� ���� ������������� ���� ���������� ������ ���������� ���� ����������� ��������� ���� ����� ������� ���� ������� ��������� ��� ��� ������� ��������� ������� ���� � ��������� ����� ���������� ���� ������� ����� ���������� ��� ���� ���� �������� ����� ����� ������������ ����� ����� ����� ���� ����� ���� �� ����� ����� ����� ���� ��������� ������������ ���� ��������� ������� ���� �������� ���� �������� ���� ������������ ���� ����� ���� ����� ������� �� ���������� � ��������� ������� ������ ����������� ������ ���������� ���� ������ �������� ���� ��� ��� ����� ���� ���������� ������ ���� �������� ���� ����� ��������� �������� ������ ���� ��� ���� ������ ����� ���� �� ����� ����� ���� ��� ��������� ���� ����� ��������� �� ���� ���� ��� ������ ����������� �� ���������� � ��������� �������� �� ���� ���� ����� ���� ����� ����������� ���������� ��������� �������� ���� ������ �������� ������������� ����� �������� ������ ��������� ��������� ���� ��� �������������� �� ������ ��������� ��������� ����� �������������� ���� ������ �������� � ������ �������������� ���� ��������� ���������� ����������� ����� ��������������� ���� ����������� ������ ������� �� ���������������� ����� �� ��� �� ���������� ����� ���� ��� ��� ��������� ��������������� ��� ���� ����� �� �������� ���������� ��������������� �� ������ ������� ���� �������� ��������������� �� �������� ������� ��� �������������� �������� ��� �������������� ���������� ���� ����� ����� ������� ������ ������� �������� ������ ����� The

• shell: another name for terminal

• Several different types of shell: bash, csh, , zsh, ksh, etc.

• How to find own which one I’m using? echo $0

• Differences between shells mostly for programming. Religious wars between flavours. Use chsh to change default shell.

• More details on shells and programming in next course! Tutorials and hands-on part

• These slides online: https://folk.uio.no/tiago/teaching/unix2017

• Find tutorial questions on same page