Download presentation
Presentation is loading. Please wait.
Published byHoward Sherman Modified over 8 years ago
1
UNIX What is UNIX? Getting Connected Basic UNIX Commands Help!
Working with Directories Running Programs Editors The Shell Exercise
2
What is UNIX? Multi-Tasking O/S Multi-User O/S
Available on a range of Computers
3
Which UNIX? SunOS Sun Microsystems IRIX Silicon Graphics
HP-UX Hewlett Packard Linux For IBM PC compatibles
4
UNIX Internals (Simplified)
Kernel System Internals Shell Command Interpreter Programming language File System Process Management
6
UNIX Shells C-Shell Bourne Shell Korn Shell T-Shell bash
7
Terminal Emulation Software
DOS Based Telnet Windows 9x/NT/XP, Telnet and X Windows Networked Macintosh, Telnet
8
Graphical UNIX via Exceed
X Concepts Using the Exceed Software Starting the Common Desktop Environment
9
Basic X Concepts X Server runs on local machine
PC Exceed UNIX Workstation Included in OS Apple Mac Exodus X Client runs on remote machine Graphical Application xterm file manager Modelling Package
10
Basic X Concepts
11
The Common Desktop Environment
12
Starting CDE- XSession Options
13
Setting the XServer Options
14
Using Exceed :XTerm
15
Using Exceed to Start an XClient
16
Rules of Engagement UNIX is case sensitive Commands are in lower case
Backspace and Del Keys correct typing errors Ctrl U clears the command line Ctrl C Aborts a program or command Do Not use the arrow keys
17
Filenames Filenames can comprise: Wildcards
a-z, A-Z alphabetic characters 0-9 digits .-_+ special characters mon+tue_ Wildcards * means any character or sequence of characters
18
Format of UNIX commands
command [option ...] [filename ...] eg: ls ls -l tutorial more tutorial
19
List Directory ls list directory ls -l list directory in long format
ls -a list all (inc. hidden) files -rw l course Oct 18 11:05 hello.c Access Permissions Number of bytes in file Date and time last modified
20
Displaying a Text File more filename Spacebar next screenful
Enter next line q quit ? list commands
21
Copy, Rename and Remove Copy a file Rename a file Remove a file
cp oldfile newfile Rename a file mv oldname newname Remove a file rm afile
22
Searching Files grep string file string = word or phrase
file = file or list of files
23
Redirection The output of a command usually goes to the screen
Redirect the output to a file using ‘>‘ ls -l > dirlist
24
Piping Feeding the output of one command into the input of another command The symbol ‘|’ is called a pipe command | command eg: ls -al | more ls -la | grep Nov
25
Manual Pages man command man - k topic man - k topic | more
26
Example Manual Pages Synopsis mv [ - ] [- fi] filename1 filename2
optional options cp [ - ip] filename1 filename2 cp [ - iprR ] filename ... directory rm [ - ] [ - fir ] filename ... rmdir directory
27
Directory Structure / (root) usr home1 cs me ph cs4un1 cs4un2
/home1/cs/cs4un1
28
Directories pwd print working directory cd change directory
cd move to home directory cd .. move up one level cd mydir move into a subdirectory cd /var/adm move to an absolute directory
29
Managing Filestore Each user has an allocation of filestore (Disk Space) Monitor filestore usage with the ‘quota’ command EG: quota -v Disk quotas for username (uid 20002) Filesystem usage quota limit timeleft files quota limit timeleft /stoat-g The quota value can be exceeded for 7 days quota < usage < limit for 7 days The limit value can not be exceeded usage < limit always If usage > quota for 7 days account is expired and files can not be created
30
Running programs Two modes of operation foreground and background
Foreground Interact with program via keyboard/screen Background No connection with keyboard/screen Submit to backbround by Appending ‘&’ EG: myprog >& myfile & The symbols ‘>&’ redirect output and any errors to the file myfile Another method of submitting programs to the background is via a batch processing system, such as Sun Grid Engine (as used on Titania)
31
Foreground Program Control
Kill a program Ctrl C Stop a program Ctrl Z Note a stopped program still exists in the system
32
Program control within current shell
jobs Lists jobs (programs) bg %job_id Place a job in the background fg %job_id Return a job to the foreground stop %job_id Stop a job kill %job_id Kill a job jobs [1] + Running time.sh > out stop %1 [1] + Stopped (signal) time.sh > out bg %1 [1] + time.sh > out & kill %1 Terminated
33
Program control using ‘ps’ and ‘kill’
ps Report process status ps -f -u username UID PID PPID C STIME TTY TIME CMD username :23:04 pts/50 0:00 sleep 2 username :05:45 pts/50 0:01 -csh username :35:07 pts/50 0:00 /bin/sh time.sh kill Terminate process Find its process ID (PID) using the ps command Kill the process using the kill command kill 24585 Sometimes kill on its own does not work so try kill -KILL 24585
34
Programe Control using top
top is a separate utility and not part of the OS top -Uusername k kill program (process) k PID, k -KILL PID h help q quit top
35
Vi Text Editor Very powerful Available on all versions of UNIX
No in-built help Man page gives detailed help Vi has three modes Command Text entry Last line
36
Editors Dtpad nedit vi emacs
37
Desktop Note Pad Editor
38
T-Shell - Filename Completion
Complete a partially typed filename Operation Type enough characters to uniquely identify the name Press the ‘Tab’ key (for C – shell use ‘Esc’ key) If the response is a ‘bleep’ press Ctrl-d to list possible matches Setup Add the following to your .cshrc file set filec
39
T-Shell -Repeating Previous Commands
Operation history List previous commands !! re-run last command !n re-run the nth command !str last command starting with str eg: !vi Setup Add the following to your .cshrc file set history=40
40
T-Shell - Command Aliasing
Definitions alias ll ' ls -lF ' alias h ' history 24 ' alias dir ' ls ' Setup Add alias definitions to your .cshrc file
41
The Secure shell protocol
SSH is a new method of communications over the Internet that encrypts data end-to-end Replaces telnet, ftp, rsh and rcp Components Secure shell ssh Secure ftp sftp Secure copy scp
42
Secure Shell Program to log into another computer over a network
Execute commands on a remote machine Move files from one machine to another Provides strong authentication and secure communications over insecure channels. Intended as a replacement for rlogin, rsh, rcp, and rdist. To use secure shell to access a remote home machine set up an ssh server on that machine
43
ssh You only need the SSH client. The server is unnecessary, unless you wish to connect back to your home machine via the Internet using SSH. Connecting to a WRG node ssh -l wrsmg maxima.leeds.ac.uk To use X-windows add the "-X" flag SSH will then carry Xwindows traffic over the Internet to connect Range of options for changing ports, specifying authentication files, encryption algorithms etc…. Use man ssh for help with options
44
Secure ftp (sftp) Establishes an FTP-style file transfer session between the Unix systems sftp command always used in the form: sftp e.g.from titania sftp
45
Transferring Files Using sftp
From the SFTP prompt (sftp>) can do the following: get command to retrieve a file from the remote Unix server. get test.txt put command to transfer a file from your Unix system to the remote Unix system you are connected to. put file2.txt If you use the ls command without specifying a directory, it will display the contents of the directory you are currently working in on the remote Unix system.
46
Navigating file systems using sftp
From the SFTP prompt (sftp>) can do the following: ls command to display the contents of a directory on the remote Unix system you are connected to. ls /home/user. Will display the contents of the directory /home/user on the remote Unix system. cd and lcd commands change current remote directory, or current local directory. e.g. cd /home/user. Will change the current remote directory to /home/user.
47
Summary of sftp commands 1
mget Retrieve multiple files from server Mput Transfer multiple files to server pwd Display remote working directory quit or exit Quit sftp rename oldpath newpath Rename remote file rmdir path Remove remote directory rm path Delete remote file version Show SFTP version ? Synonym for help
48
Summary Listing of SFTP commands 2
ascii Use text transfer mode help Display the help text image Use binary transfer mode lls [ls-options [path]] Display local directory listing lmkdir path Create local directory ls [path] Display remote directory listing mkdir path Create remote directory put local-path [remote-path] Upload file
49
Secure copy - scp Using SCP Fast, easy method to copy single files from your Unix system to a remote Unix system.
50
Retrieving a file using SCP
To retrieve a file from a remote Unix system, the syntax is: scp local-file username= username on the remote system server= the name of the remote Unix system file= the file to retrieve from the remote system local-file= the location you wish to save the file to on your local Unix system
51
Transferring a file to a remote Unix system using SCP
The syntax is: scp local-file local-file= the file to transfer from the local system username= username on the remote system server= the name of the remote Unix system file= the location you wish to save the file to on the remote Unix system
52
Transferring Multiple Files
mget and mput with sftp Use tar and compress to package a directory tree scp transfers the packaged directory tree uncompress and extract directory tree using tar
53
UNIX Utilities tar compress sed awk
54
Exercise Tutorial Turn on PC Login to your PC Managed NT account
login digley/mep98xxx password: Login to titania Start XSession or telnet titania Login using the provided username and password
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.