Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Linux Dr Karina Kubiak - Ossowska

Similar presentations


Presentation on theme: "Introduction to Linux Dr Karina Kubiak - Ossowska"— Presentation transcript:

1

2 Introduction to Linux Dr Karina Kubiak - Ossowska
High Performance Computing Support Team Department of Physics

3 Unix / Linux OS OS – operating system, a suite of programs which make the computer work Unix – an operating system developed in 1960s, constant development. Unix has also a graphical user interface (GUI) similar to Microsoft Windows, however GUI is not always enough to operate smoothly and run jobs in particular. Linux – a version of Unix (other versions: Mac OS, Sun Solaris) Linux – free and opensource operating system released in 1991 by Linus Torvalds. More than 90% of today's 500 fastest supercomputers run some variant of Linux. Very stable DOS-like environment with GUI.

4 Unix / Linux OS Shell – command line interpreter
Filename Completion – by pressing the [Tab] key the filename (or command name) will be completed. [up arrow] – by pressing the [up arrow] key the user will see previous commands. history – by typing history at the shell the user will see all previous commends. Useful links:

5 The “shell” In UNIX/Linux, the program that interprets commands that are typed in the terminal window is referred to as a “shell” Upon login, a “shell” is run within the terminal window. Common shells are bash, tcsh, zsh User accounts on the HPC machine use bash by default The bash environment can be configured via two files: ~/.bashrc (used to execute commands upon login) ~/.bash_profile (can be used to set environment variables)

6 The user whoami - answers on question who am I?
pwd lists the present working directory Useful when one navigates on a few machines simultaneously or uses a few usernames or has many terminals open

7 Home Directory & Changing Directories
Home Directory – the ‘default’ directory (folder) for a user’s account cd - change directory cd job-scripts cd ../NAMD cd .. cd /lustre/strath/temp/cwb08102 cd with no argument takes the user to their home directory Also, ~ represents the home directory, e.g. cd ~ cd ~/job-scripts Type your username

8 Listing Files & Directories
ls – lists the contents of a directory ls :on its own lists current directory ls ~ ls /lustre/strath/physics/cwb089102 Variants: ls –a : lists hidden files and folders ls –l : long listing ll -t : long listing, files sorted by time

9 ls -a ls -l hidden file or folder Refers to parent directory
. .bash_history .bash_profile bin job-scripts .nedit zshrc .. .bash_logout .bashrc emacs .mozilla .Xauthority hidden file or folder Refers to parent directory ls -l $ ls –l -rw-r--r-- 1 acs03114 user Jan 28 15:01 bigfile.500M drwxr-xr-x 3 acs03114 user Aug data permissions user group size date/time name d - directory Permissions order: user---group---others---

10 ls -al Note: directories are coloured in this example.
sometimes they are denoted by a trailing / e.g. directory/

11 .. (parent directory) cd .. - changes to the parent directory
cd ../ goes up two directory levels cd ../../job-scripts displayed below parent sub-parent job-scripts initial directory

12 Creating & deleting directories/files
mkdir - make directory mkdir dir1 : creates a new (empty) directory (make directory) rmdir dir1 : deletes and empty directory (remove directory) rm file1 : removes (deletes) a file file1 rm file1 file2 file3 : removes a list of files

13 Creating & deleting directories/files
rm file* : achieves the same as the previous command * is a “wildcard”. The shell ‘expands’ the wildcard and returns all filenames beginning with ‘file’, ? Replaces one character rm –rf dir1 : deletes a directory dir1 and all of its contents -f : ask no questions!’

14 Copying files & directories
cp copy cp file1 file2 : creates a copy of file1 and calls it file2 cp –r dir1 dir2 : create a copy of dir1 with all of its contents cp /lustre/strath/physics/cwb08102/file1 . : copies a file file1 from another directory to the current directory (denoted by . )

15 Moving files and directories
mv : move a file mv file1 file2 : rename file1 mv file1 .. : moves file1 to the parent directory mv file1 ~ : moves file1 to the home directory mv dir1 dir2 : renames dir1 ( -r not necessary) mv dir1 ~ mv dir1 /lustre/strath/physics/cwb08102

16 Viewing files in the terminal
To quickly view the contents of text files more file1 spacebar advances through file b for going backwards q to quit / to search for a term head file1 : views the first 10 lines of the file1 tail file1 : views the last 10 lines of the file1

17 Hands on

18 Viewing running processes
top :shows the processes (programs) running on the computer press spacebar to update press q to quit ps :produces a static list of your running processes ps –f :produces a “long” listing ps –ef : lists all running processes (long format)

19 Redirection To redirect output from the terminal to a file:
ps –ef > processes.txt : > creates the named file To append to an existing file: ps –ef >> processes.txt To redirect system errors as well as “standard” output: ps –ef >& processes.txt To concatenate (merge) two files into one: cat file1.txt file2.txt > bigfile.txt

20 Searching a File grep grep error output.txt
find instances of error in output.txt grep error output.txt > errors.txt find instances of error in output.txt and creates a new file grep –i error output.txt case insensitive search

21 Kill a process top :will show the process_id
kill -9 process_id :will kill the specified process It is not possible to kill somebody's else process

22 Access rights on files.... and directories
r (or -) :indicates read permission (or otherwise) w (or -) :indicates write permission (or otherwise) x (or -) :indicates write permission (or otherwise) and directories r :allows user to list files in the directory w :means that users may delete files from the directory (or move into it) x :the right to access files in the directory -rwxrwxrwx :a file that everybody can read, write and execute (+delete) -rw :a file that only the user (owner) can read and write

23 Changing a file mode chmod :changes a file mode. The owner can change the permission to the file u :user r : read g :group w : write (and delete) o :other x : execute (and access directory) a :all (-) : add (take away) permission chmod go-rwx file1 :will remove read, write and execute permissions on the file1 for the group and others chmod a+rw file1 :will give read and write permission on the file1 to all

24 quota All users are allocated a certain amount of disk space
quota -v :will check the current quota and how much has been used (on home directory) df : will print on the screen how much space is left du : will display sizes of all files du -s* : will display only a summary for all files and directories df -kh : how much space is left in kB, what % is used, what % is available

25 File compression gzip file1.txt :will compress file1.txt to file1txt.gz gunzip file1.txt.gz :will uncompress file1.txt.gz to file1.txt zcat file1.txt.gz :reads gzipped files Only text files can be compressed.

26 File information file file1 : give information about the type of the data in file (ASCII, pictures, compressed data... ) file * : information about all files in the directory diff file1 file2 : shows the difference between files 1 and 2 find .-name “*.txt” -print : will find in current directory (.) and all subdirectories all files with the extension .txt and print on the screen find .-size +1M -ls : will find all files bigger than 1Mb and display results as a short listing

27 History Help – man pages history : will show command history list
man command_name : help how to use the command (navigation like under more [spacebar] to page down, [b] to page up, [q] to quit man grep : help about grep command.

28 Hands on

29 Text editors gedit editor
There are various text editors, like joe, vi, nano, pico etc. and also notepad-like editors like kwrite or gedit (it depend on the OS version). vi editor is always installed. gedit editor gedit file1.txt will create file1.txt and open notepad-like window gedit file1.txt & will work as above and keep the terminal active gedit can be open also from Applications Menu

30 Remote control ssh - secure shell
ssh is a program for logging into a remote machine and executing commands in the remote machine. ssh archie-login.hpc.strath.ac.uk -l cwb08102 log user cwb08102 to ARCHIE-WeSt ssh -X archie-login.hpc.strath.ac.uk -l cwb08102 log user cwb08102 to ARCHIE-WeSt using X terminal (graphic terminal)

31 Remote control scp - secure copy
scp copies files over the network securely, uses ssh for data transfer. scp [-r] [-p] -r - copy the entire directory (with sub-directories) -p - preserve file attributes and timestamps

32 Remote control WinSCP is a SFTP client and FTP client for Windows. Its main function is the secure file transfer between a local and a remote computer. It uses Secure Shell (SSH) and supports, in addition to Secure FTP, also legacy SCP protocol Local Windows Machine Remote computer Application interface is similar to Norton Commander. To download visit

33 To download visit http://www.putty.org/
Remote control PuTTY is a free implementation (open source) of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator. To download visit

34 Remote desktop The best program to have remote desktop connection between computers is NX. It is open source, works for Windows, Mac OS and Linux desktop computer and connect them to remote Linux computer. NX server runs on ARCHIE-WeSt. Users can download the client from Instructions:

35 Remote desktop Please do not leave the session. Please log out!
To have the remote desktop session please connect directly to archie- w, archie-e, archie-s or archie-t. Please do not leave the session Please log out!

36 Hands on


Download ppt "Introduction to Linux Dr Karina Kubiak - Ossowska"

Similar presentations


Ads by Google