Basic Linux. Advanced NDC Training Course

Size: px
Start display at page:

Download "Basic Linux. Advanced NDC Training Course"

Transcription

1 Advanced NDC Training Course Basic Linux Preparatory Commission for the Comprehensive Nuclear-Test-Ban Treaty Organization Provisional Technical Secretariat Vienna International Centre P.O. Box 1200 A-1400 Vienna AUSTRIA IDC Page 1

2 Introduction Files, Directories, Processes Kernel, Shell and Applications (programs) Pattern Matching Redirection and Pipelines Page 2

3 Introduction Scope Basic concepts and terminology; how to get started. Familiarity Problem I have been using SunOS, Solaris and Linux for ~ 20 years. Further Information The man pages, info and Google. Page 3

4 Files and Processes - Everything is a file or a process! Files Files contain blocks of arbitrary data. Are usually persistent (e.g. written to disk) and available to processes. Protected by permissions and may be executable (more later). They can be created, copied, renamed, moved, deleted. Directories are a special kind of file they contain other files. Directories are organised in a tree structure. Navigate using cd (pwd gives current directory). There are some other types of special files, but they are rarely used. Page 4

5 Directory Structure Alternative Representations This type is more common Page 5

6 File Names Some Guidelines Filename are CaseSeNSitiVe Suffix usually gives a clue as to the content of the file; some applications expect a certain extension They can normally be up to 255 characters Very long filenames can cause some problems; filename completion saves typing! It is possible to use almost any character in a Unix filename BUT doing this normally results in complications Avoid the following types of filenames (even though they are valid) Report For 2008.Txt ( embedded spaces, unusual capitalisation of Txt ) Terms&Conditions.txt ( embedded '&' character ) Sily*File.txt (embedded wildcard character) -WithDollar$.txt (leading - (dash or minus sign) and embedded '$' character) ThisHas^G^GControlCharsInIt.txt (embedded control characters) [ Check: ls. od -t a ] ls (name of an existing Unix command) -ls (leading '-' (minus) sign) Page 6

7 Files and Processes - Everything is a file or a process! Process An instance of a computer program being executed. The execution of the instructions in the source code. Many processes, owned by different users, can run at once. Linux is a multi-tasking, multi-user operating system. Can be run in the foreground or the background Uniquely identified by a process id. Find processes using ps (or top or jobs) command (kill to interact). Has a stdin, stdout and stderr associated with it. Normally associated with the keyboard and screen respectively Can be re-directed or piped (more later) Returns an exit code to the shell Page 7

8 Shell The user interface User inputs text for a command line interpreter to execute. Linux provides user-selectable shells, e.g. sh, bash, ksh, csh, tcsh, scsh etc. etc. etc. Every Linux system has a shell compatible with sh Provides builtin functions: wildcards, history, filename completion etc. Graphical User Interfaces (GUI) are essentially graphical shells Often runs shell commands directly under the hood Command line interface provides powerful, flexible, modular control Cannot do everything in a GUI sometimes you need the CLI! The shell is both: command line interpreter (CLI) scripting language very good at automating repetitive tasks But there are better choices: perl, python etc. Page 8

9 Commands, flags and arguments There is always a command ; it is always the first word Examples: cat, ls, w, whoami, uptime, reboot Words are separated by whitespace (space or tab) Examples: cat file1.txt file2.txt file3.txt There may be zero or more command line arguments (CLA) Flags (or options ) are used to modify default behaviour There are very many flags; they normally start with - (or -- ); they are case sensitive. Several flags can often be combined within a single - Examples: sort r file.txt, ls l -R /tmp, ls lartr /tmp, date u Lines can be continued using \ as the last character of the line The following often need special care: <space> *? [ ] { } $ Page 9

10 Commands, flags and arguments ls Page 10

11 Commands, flags and arguments ls l Page 11

12 Commands, flags and arguments ls l test.c Page 12

13 Commands, flags and arguments ls l a r -t test.c Page 13

14 Commands, flags and arguments ls l a r -t test.c ls lart test.c ls lart test.c main.c ls lart test.c main.c *.c *.h *.[ch] Multiple, combined flags Multiple arguments Wildcards Page 14

15 Pattern Matching ( globbing ) Convenience function provided by all shells Two main operators: * and? (except leading '.') Other operators: '[' and ']' (also '{' and '}') Allows zero or more file (or directory) names to be matched Examples: stderr stdout wclist README dirlist.cb.cshrc.bash_profile ls * ---> stderr stdout wclist README dirlist ls -a * ---> {all files:incl. dot files + dirs } ls -a *.* ---> ls: *.* : No such file or directory ls -l.[a-z] ---> ls:.[a-z] : No such file or directory ls.[a-z]* --->.cb.cshrc.bash_profile ls readme ---> ls: readme : No such file or directory ls.* ; ls -d.* --->?? Page 15

16 Redirection (1) Standard I/O interface for all Linux commands: stdin, stdout, stderr Details are shell-specific Bash supports much better redirection capabilities than tcsh Redirection (>, >&, >>) Input can be re-directed from files (or here documents) Output can be re-directed to files (or /dev/null ) Normal and error output can be independently re-directed ls -l *.c > Source_files.list ls -l *.c >> Source_files.list ls -l *.c >& Source_files.list # tcsh # tcsh # tcsh ( ls -l *.c >./out ) >&./err # easier in bash Page 16

17 Redirection (2) INPUT can be re-directed from files (or here documents) wc l < application_log.txt # Not the same as wc l application_log.txt wc l << EndOfDocument Line one Line Two Third Line of text Final_LINE EndOfDocument Page 17

18 Redirection (2) INPUT can be re-directed from files (or here documents) wc l < application_log.txt # Not the same as wc l application_log.txt wc l << EndOfDocument # quotes are useful, not mandatory, but must match Line one Line Two Third Line of text Final_LINE EndOfDocument # the terminator string must be at the start of line Page 18

19 Pipelines Pipelines ( ): Allows chaining of stdout from one process to stdin of the next Linux is built from modular applications Lots of applications, each performing a small task; read stdin, write stdout Pipelines are the key to harnessing the full power of Linux Well worth the time to become familiar with pipelining applications together Widely used and very powerful technique Pipelines can be simple ls -l *.c sort -nr k 5,5 > Source_files.list Page 19

20 Pipelines Pipelines ( ): Allows chaining of stdout from one process to stdin of the next Linux is built from modular applications Lots of applications, each performing a small task; read stdin, write stdout Pipelines are the key to harnessing the full power of Linux Well worth the time to become familiar with pipelining applications together Widely used and very powerful technique Pipelines can be simple, or very complex ls -l *.c sort -nr k 5,5 > Source_files.list ls l *.c sort nr k 5,5 grep v _time_ \ sed e s/\.c$/.cpp/g tr a-z A-Z \ cut c 28- awk {printf %s\t%s\n,$5,$1} Page 20

21 Pipeline stdin, stdout and stderr The stderr always goes to the terminal Still see errors when redirecting stdout Can be directed to separate files Easy in bash, difficult in csh! Page 21

22 Getting Help the man page export PAGER= less setenv PAGER less Page 22

23 Getting Help the man page Page 23

24 Getting Help the man page Page 24

25 Getting Help info not for the faint-hearted! Page 25

26 Getting Help info not for the faint-hearted! C-x 0 = <Control> + x + zero Page 26

27 Getting Help Google Page 27

28 Page 28 Thank you

29 Advanced Linux Preparatory Commission for the Comprehensive Nuclear-Test-Ban Treaty Organization Provisional Technical Secretariat Vienna International Centre P.O. Box 1200 A-1400 Vienna AUSTRIA Page 29

30 Introduction Kernel, Shell and Applications (programs) Environment Permissions and Shellscripts Cron jobs Useful Commands Page 30

31 What do you know already? (1) 1. ls ; LS 2. ls -lartr ~/dd ; ls -a -l -R -r -t ~/dd ; ls -lrtr ~/dd 3. ls *.c > listing.txt 4. ls -l grep txt less 5. lp -d printer_name Resume.txt 6. cd ; cd ~ ; cd $HOME ; cd ${HOME} 7. man find 8. ed R.txt ; vi R.txt ; emacs R.txt ; gedit R.txt ; nedit R.txt 9. cp -prf./foo./bar ; mv./foo./bar Page 31

32 What do you know already? (2) 1. ls -l grep txt 1> /tmp/misc/text_files.txt 2>&1 2. echo "Today is `date -u`" 3. find. -name '*.c' -print 4. find ${HOME} -type f -name \*.c \ -exec grep -iv "core " {} \; 5. find ${HOME} -type f -name \*.c \ -exec grep -iv "core" {} /dev/null \; 6. cd `imspar RELBIN` && tar cf -. gzip -c -1 \ scp auto@idclx006 cat ">" /local/foo/geotool.tar.gz Page 32

33 Linux commands and terms Page 33

34 Kernel, Shell and Applications (programs) Kernel Controls resources (CPU, memory, I/O) Use uname command to see kernel name and other information Shell Passes commands to the kernel for execution, then waits for the command to complete and prompts for new command. Has some time-saving features (completion, wildcards, history) Many variations (sh, bash, ksh, csh, tcsh). You will use tcsh. Application Software (programs) Built-in commands such as ls, rm or more complex, custom-written code such as GIMP, geotool or the CD Tools Page 34

35 Graphical User Interface (GUI) Page 35

36 Graphical User Interface (GUI) Page 36

37 Graphical User Interface (GUI) It's a command line under the hood! Page 37

38 Kernel, Shell and Applications (schematic) Page 38

39 Running Commands Commands are entered at the shell prompt followed by zero or more command line arguments (CLAs) Many commands that can be given file names as command line arguments read stdin and write to stdout if no CLAs are given Commands can be run in the foreground or in the background running in the background allows the terminal to be used for other commands Commands that require input from stdin should not be run in the background! gedit & (OK, X application) but vi test.c & ( Problem: Suspended (tty output) ) Common sequences of commands can be put into a test file which is made executable (a shellscript ) Page 39

40 Permissions All files (incl. directories etc.) have permissions associated with them All users have a user id (name) and a primary group Files created by a user are owned by that user and primary group Permissions are controlled at three levels: user, group and other (ugo) The command ls displays permissions, chmod is used to change them Permissions on a file control who can read, write and execute it (rwx) Directories require read and execute permission! Sequences of commands entered into a text file become a shellscript (or simply a script ). Just make the file executable! the start.cdtool script is one such example (to start/restart the CD Tools) Examples vi my_script.sh; chmod u+x my_script.sh;./my_script.sh Page 40

41 A Simple Bash Shell Script #!/bin/bash # Using printf to format error messages... EXIT_SUCCESS=0 EXIT_ERROR=1 var="/non/existent/directory" echo -n "Enter directory to cd to: " read # goes to default $REPLY if [! -z "$REPLY" ]; then var=$reply fi fatal_error() { } # Formats positional params passed, and sends them to stderr. # Wrap the basic error with FATAL. Finish with info about exit status. printf "\nfatal: " >&2 printf "$@" >&2 printf "\nexiting with status=%d.\n\n" $EXIT_ERROR >&2 exit $EXIT_ERROR # Generate a formatted error message if the cd fails cd $var 2>/dev/null fatal_error $"Can't change directory (cd) to %s." "$var" exit $EXIT_SUCCESS Page 41

42 Cron Jobs Cron allows commands to run automatically at given times Extensively used to produce daily reports (e.g. squal) Frequency can be adjusted to one minute resolution Not all users are allowed to run cron jobs Timing and command information modified using crontab command Commands are executed using the Bourne shell (sh) this frequently catches users out if their environment is not configured! Any output to stdout and stderr is ed back to the user it is normal to write output to a logfile and redirect stdout and stderr to /dev/null Example: 5,35 * * * * ( env `cat cron.shenv`./bin/lasid_snapshot > /dev/null 2>&1 ) Page 42

43 Useful Commands - General Points Commands are case-sensitive typing./boring_tasks is not the same as typing./boring_tasks The PATH environment is used to find commands that are not preceded by an absolute pathname be careful with. in the PATH environment. It is often safer to explicitly specify./program Commands can be separated by: ; & && ; = run the commands sequentially & = run the command in the background in a sub-shell = pipe the output of this command to the input of the next command && = only run the second command if the first command finished successfully = only run the second command of the first command exited with non-zero status Sequences of commands can be run as a shellscript simply edit a text file, then make it executable, using chmod! Page 43

44 Redirection send output to a file. A process has three standard input-output channels associated with it: STDIN Usually the keyboard. This is file descriptor 0 (zero). STDOUT Usually the screen. File descriptor 1 (one). STDERR Always the screen. File descriptor 2 (two). Most Unix commands Read input from STDIN Write output to STDOUT Report errors to STDERR Any of these three channels can be redirected from/to a file They can also be piped to other commands (more later) Input redirection = Taking STDIN from a file Output redirection = Sending STDOUT to a file. Note: this does not affect the STDERR, which still goes to the screen! This is a very common technique for separating errors from lots of routine output. One special target for redirection is /dev/null (for input and/or output) Page 44

45 Redirection (2) Many Unix commands read from STDIN if no filename is given grep test... will search for the string test - from STDIN (usually the keyboard) If the program appears to have hung, it may actually be waiting for input from the keyboard! Similarly, they write to STDOUT if no filename is given You may get lots of output to the screen! It is sometimes necessary to use the special filename - (minus) This can represent STDIN or STDOUT, depending on the context e.g. tar cf -. ( cd /tmp ; tar xf - ) [ first '-'=STDOUT, second '-'=STDIN ] There are special operators to indicate redirections: Output: > = Redirect the STDOUT [e.g. ls > stdout.txt ]. Use >> to append to existing file. Input: < = Redirect the STDIN [e.g. cat < stdin.txt ] Output (stderr too): This depends on the shell being used... ls >& /stdout+stderr.txt (csh) OR ls > stdout+stderr.txt 2>&1 (bash) The backtics operator ` redirects the stdout sqlplus `imspar PUBLICDB` ^D (control key + 'd') to send end of file from the keyboard Page 45

46 Redirection A complex bash shell example Note: you cannot do this with the csh! Source: Page 46

47 Environment All commands run with a certain environment This is usually set up when you login (e.g. ~/.bash_profile, ~/.tcshrc) Content of the environment can be displayed using printenv Details of displaying and setting the environment are shell-specific bash: export PATH= /usr/bin:/dvl/software/shi/rel/bin:. tcsh: setenv PATH /usr/bin:/dvl/software/shi/rel/bin:. Changes to environment often require changes to be sourced bash:. ~/.bash_profile tcsh: source ~/.tcshrc [ ~ = Home directory ] Non-interactive processes normally use the Bourne shell (sh) this catches many people out (e.g. commands run interactively but not as cron jobs) Important environment variables are: PATH, LD_LIBRARY_PATH, GEOTOOL_HOME, PRINTER, DISPLAY, EDITOR Page 47

48 Permissions Page 48

49 Logging in to remote systems using ssh Set up ssh keys to allow logins without passwords ssh-keygen b 1024 t rsa Give it a passphrase of reasonable length (make it memorable!) Default location is ~/.ssh (id_rsa and id_rsa.pub) Login to remote machine using ssh (or scp) You will still need the password this time cat id_rsa.pub >> ~/.ssh/authorized_keys Logout of remote machine Next login should be without password Cache your keys for one login session using ssh-add You will be prompted to enter your passphrase Page 49

50 Using ssh and scp If ssh keys are not set up you will be prompted for password each time! General syntax: ssh [-X] scp local_filename machine:/path/on/remote/machine/remote_filename scp /path/to/local_filename Wildcards in remote file names need to be escaped or quoted scp local_filename*.txt scp machine:/path/on/remote/machine/remote*.txt./ Page 50

51 Page 51 Thank you

52 Unix and Linux Unix was developed in the 1960's; the Linux kernel in 1991 Stable, multi-tasking, multi-user operating system Available for servers, desktops and laptops Several different flavours : Solaris, GNU/Linux, MacOS-X Some commands have Graphical User Interface (GUI) but many commands are available only from the command line! many GUIs simply call command line programs under the hood Three basic elements: Kernel allocates time and memory, interacts with filestore, deals with system calls. Shell command line interpreter between the user and the kernel (e.g. sh, ksh, csh, tcsh, bash etc.) Applications (programs) commands such as GIMP, nautilus, ls, rm, cp, cd, vi etc. Everything is either a file or a process Files contain data. Processes are running programs. Directories are arranged in tree structures, with / (root) at the top Page 52

53 Process State Diagram and Transitions Created (fork, exec) Scheduled Running Blocked (waiting for resource) Swapped out (if not enough physical memory) Page 53

54 Useful Commands Simple Commands Files and Directories pwd, ls -aalhrrt, cd, du -shk, cp -ipr, rm -irf, mv -I Users and groups id, groups, w, last, finger username Processes top, ps -fu {USER}, ps -ef, kill -{SIG} pid, strace -p pid Environment printenv,., env, echo ${ENV_NAME} Utilities vi file, emacs file grep -iv, egrep -iv, sort -urnk, wc -clw, md5sum file find {commands} ---> this one is so powerful you could write a book about it! chmod mode file, ping IP_Address, nslookup domain_name, hostname Page 54

55 Pipelines Pipelines provide communication between processes Both processes must be on one computer The communication is unidirectional ls sort Page 55

56 Pipelines Can be arbitrarily long You can pipeline together as many processes as necessary -rw-rw-r-- 1 hampton smd Nov 5 17:45 GIMP-GUI.png -rw-rw-r-- 1 hampton smd Nov 5 20:08 Redirection-Oreilly.gif -rw-rw-r-- 1 hampton smd Nov 5 20:13 Redirection-after operations.gif -rw-rw-r-- 1 hampton smd Nov 5 20:13 Redirection-after operations.gif -rw-rw-r-- 1 hampton smd Nov 5 20:11 Redirection-using-dummy-stream3.gif -rw-rw-r-- 1 hampton smd Nov 5 20:57 Unix-pipeline-wikicommons.png -rw-rw-r-- 1 hampton smd Nov 5 17:41 cd-creator-gui-under-the-hood.png [...] # A 10-component pipeline.. ls -l head grep -v "^total" awk '{print $3,$5,$9}' \ sort -n -k 2,2 tr '[a-l]' '[A-L]' grep ' CD-' \ cut -c 5-11 tail sort less ton 128 ton 324 (END) Page 56

57 Pattern Matching Examples Which files would be selected by the following commands? ls drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24. drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24.. -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.bashrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.cshrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.gimp drwxrwxr-x 2 hampton smd 4096 Nov 5 21:25.l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.ll -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 File1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 abc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 b -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bbb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 c -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cba -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cbc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 m Page 57

58 Pattern Matching Examples Which files would be selected by the following commands? ls drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24. drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24.. -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.bashrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.cshrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.gimp drwxrwxr-x 2 hampton smd 4096 Nov 5 21:25.l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.ll -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 File1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 abc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 b -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bbb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 c -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cba -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cbc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 m Page 58

59 Pattern Matching Examples Which files would be selected by the following commands? ls -a drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24. drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24.. -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.bashrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.cshrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.gimp drwxrwxr-x 2 hampton smd 4096 Nov 5 21:25.l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.ll -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 File1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 abc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 b -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bbb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 c -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cba -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cbc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 m Page 59

60 Pattern Matching Examples Which files would be selected by the following commands? ls -a drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24. drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24.. -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.bashrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.cshrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.gimp drwxrwxr-x 2 hampton smd 4096 Nov 5 21:25.l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.ll -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 File1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 abc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 b -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bbb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 c -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cba -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cbc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 m Page 60

61 Pattern Matching Examples Which files would be selected by the following commands? ls.[a-z]* drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24. drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24.. -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.bashrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.cshrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.gimp drwxrwxr-x 2 hampton smd 4096 Nov 5 21:25.l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.ll -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 File1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 abc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 b -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 bbb -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 c -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cba -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 cbc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 l -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22 m Page 61

62 Pattern Matching Examples Which files would be selected by the following commands? ls.[a-z]*.a.bashrc.cshrc.file1.gimp.ll.l: # Note: this is a directory listing Page 62

63 Pattern Matching Examples Which files would be selected by the following commands? ls -a.[a-z]*.a.bashrc.cshrc.file1.gimp.ll.l: # Note: this is a directory listing....hidden_file Page 63

64 Pattern Matching Examples Which files would be selected by the following commands? ls -la.[a-z]* -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.a -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.bashrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.cshrc -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.file1 -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.gimp -rw-rw-r-- 1 hampton smd 0 Nov 5 21:22.ll.l: drwxrwxr-x 2 hampton smd 4096 Nov 5 21:25. drwxrwxr-x 3 hampton smd 4096 Nov 5 21:24.. -rw-rw-r-- 1 hampton smd 0 Nov 5 21:25.hidden_file Page 64

65 Pattern Matching Examples Which files would be selected by the following commands? ls -a.*.a.bashrc.cshrc.file1.gimp.ll.: # (current) directory....a.bashrc.cshrc.file1.gimp.l.ll File1 a abc b bb bbb c cba cbc file1 l m..: # (parent) directory one level above this one!... foo.l: # named subdirectory....hidden_file Page 65

66 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * bash-3.1$ ls -a * bash-3.1$ ls -a *.* bash-3.1$ ls -l.[a-z] bash-3.1$ ls.[a-z]* bash-3.1$ ls readme Page 66

67 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * README dirlist stderr stdout wclist bash-3.1$ ls -a * bash-3.1$ ls -a *.* bash-3.1$ ls -l.[a-z] bash-3.1$ ls.[a-z]* bash-3.1$ ls readme Page 67

68 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * README dirlist stderr stdout wclist bash-3.1$ ls -a * README dirlist stderr stdout wclist bash-3.1$ ls -a *.* bash-3.1$ ls -l.[a-z] bash-3.1$ ls.[a-z]* bash-3.1$ ls readme Page 68

69 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * README dirlist stderr stdout wclist bash-3.1$ ls -a * README dirlist stderr stdout wclist bash-3.1$ ls -a *.* ls: *.*: No such file or directory bash-3.1$ ls -l.[a-z] bash-3.1$ ls.[a-z]* bash-3.1$ ls readme Page 69

70 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * README dirlist stderr stdout wclist bash-3.1$ ls -a * README dirlist stderr stdout wclist bash-3.1$ ls -a *.* ls: *.*: No such file or directory bash-3.1$ ls -l.[a-z] ls:.[a-z]: No such file or directory bash-3.1$ ls.[a-z]* bash-3.1$ ls readme Page 70

71 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * README dirlist stderr stdout wclist bash-3.1$ ls -a * README dirlist stderr stdout wclist bash-3.1$ ls -a *.* ls: *.*: No such file or directory bash-3.1$ ls -l.[a-z] ls:.[a-z]: No such file or directory bash-3.1$ ls.[a-z]*.bash_profile.cb.cshrc bash-3.1$ ls readme Page 71

72 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls * README dirlist stderr stdout wclist bash-3.1$ ls -a * README dirlist stderr stdout wclist bash-3.1$ ls -a *.* ls: *.*: No such file or directory bash-3.1$ ls -l.[a-z] ls:.[a-z]: No such file or directory bash-3.1$ ls.[a-z]*.bash_profile.cb.cshrc bash-3.1$ ls readme ls: readme: No such file or directory Page 72

73 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls -a * README dirlist stderr stdout wclist Page 73

74 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls -a * ; ls -a README dirlist stderr stdout wclist....bash_profile.cb.cshrc README dirlist stderr stdout wclist Page 74

75 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls.*.bash_profile.cb.cshrc --> as you might expect. Page 75

76 Wildcards Some Practical Examples....bash_profile.cb.cshrc README dirlist stderr stdout wclist bash-3.1$ ls.*.bash_profile.cb.cshrc But you also get these!.: README dirlist stderr stdout wclist..: Basic-Gamma-Spectroscopy.pdf plugtmp CIN pdf pmwiki.php CRP pdf recipe py CRP pdf references_tables_online.pdf Configuration-Management-Nov2008.pdf saint_installation_test_case.pdf IDC LATEST.pdf WC Page 76

77 Deliberately blank... Page 77

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Introduction to UNIX Stephen Pauwels University of Antwerp October 2, 2015 Outline What is Unix? Getting started Streams Exercises UNIX Operating system Servers, desktops,

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

Review of Fundamentals

Review of Fundamentals Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log

More information

Chapter 9. Shell and Kernel

Chapter 9. Shell and Kernel Chapter 9 Linux Shell 1 Shell and Kernel Shell and desktop enviroment provide user interface 2 1 Shell Shell is a Unix term for the interactive user interface with an operating system A shell usually implies

More information

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Stephen Pauwels Computer Systems Academic Year 2018-2019 Overview of the Semester UNIX Introductie Regular Expressions Scripting Data Representation Integers, Fixed point,

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Introduction to Linux

Introduction to Linux Introduction to Linux January 2011 Don Bahls User Consultant (Group Leader) bahls@arsc.edu (907) 450-8674 Overview The shell Common Commands File System Organization Permissions Environment Variables I/O

More information

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical

More information

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1 Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 These notes are available on

More information

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute Shells The UNIX Shells How shell works Fetch command Analyze Execute Unix shells Shell Originator System Name Prompt Bourne Shell S. R. Bourne /bin/sh $ Csh Bill Joy /bin/csh % Tcsh Ken Greer /bin/tcsh

More information

Command-line interpreters

Command-line interpreters Command-line interpreters shell Wiki: A command-line interface (CLI) is a means of interaction with a computer program where the user (or client) issues commands to the program in the form of successive

More information

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017 Introduction to Linux Part 1 Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017 ssh Login or Interactive Node kingspeak.chpc.utah.edu Batch queue system kp001 kp002. kpxxx FastX

More information

Configuring and Running CD Tools

Configuring and Running CD Tools Presented to: Advanced IDC Training Course Configuring and Running CD Tools Preparatory Commission for the Comprehensive Nuclear-Test-Ban Treaty Organization Provisional Technical Secretariat Vienna International

More information

Useful Unix Commands Cheat Sheet

Useful Unix Commands Cheat Sheet Useful Unix Commands Cheat Sheet The Chinese University of Hong Kong SIGSC Training (Fall 2016) FILE AND DIRECTORY pwd Return path to current directory. ls List directories and files here. ls dir List

More information

Vi & Shell Scripting

Vi & Shell Scripting Vi & Shell Scripting Comp-206 : Introduction to Week 3 Joseph Vybihal Computer Science McGill University Announcements Sina Meraji's office hours Trottier 3rd floor open area Tuesday 1:30 2:30 PM Thursday

More information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

More information

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen Introduction to Unix The Windows User perspective Wes Frisby Kyle Horne Todd Johansen What is Unix? Portable, multi-tasking, and multi-user operating system Software development environment Hardware independent

More information

Shell Programming Systems Skills in C and Unix

Shell Programming Systems Skills in C and Unix Shell Programming 15-123 Systems Skills in C and Unix The Shell A command line interpreter that provides the interface to Unix OS. What Shell are we on? echo $SHELL Most unix systems have Bourne shell

More information

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29 UNIX The Very 10 Short Howto for beginners Soon-Hyung Yook March 27, 2015 Soon-Hyung Yook UNIX March 27, 2015 1 / 29 Table of Contents 1 History of Unix 2 What is UNIX? 3 What is Linux? 4 How does Unix

More information

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda Essential Unix and Linux! Perl for Bioinformatics, 140.636! F. Pineda Generic computer architecture Memory Storage Fig. 1.2 From Designing Embedded Hardware, 2 nd Ed. by John Catsoulis OS concepts Shell

More information

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book).

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book). Crash Course in Unix For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix -or- Unix in a Nutshell (an O Reilly book). 1 Unix Accounts To access a Unix system you need to have

More information

Basic Linux (Bash) Commands

Basic Linux (Bash) Commands Basic Linux (Bash) Commands Hint: Run commands in the emacs shell (emacs -nw, then M-x shell) instead of the terminal. It eases searching for and revising commands and navigating and copying-and-pasting

More information

Linux Command Line Interface. December 27, 2017

Linux Command Line Interface. December 27, 2017 Linux Command Line Interface December 27, 2017 Foreword It is supposed to be a refresher (?!) If you are familiar with UNIX/Linux/MacOS X CLI, this is going to be boring... I will not talk about editors

More information

Lecture # 2 Introduction to UNIX (Part 2)

Lecture # 2 Introduction to UNIX (Part 2) CS390 UNIX Programming Spring 2009 Page 1 Lecture # 2 Introduction to UNIX (Part 2) UNIX is case sensitive (lowercase, lowercase, lowercase) Logging in (Terminal Method) Two basic techniques: 1. Network

More information

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1 Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 The CST8207 course notes GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 Linux

More information

The Unix Shell & Shell Scripts

The Unix Shell & Shell Scripts The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises

More information

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018 GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux

More information

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

UNIX System Programming Lecture 3: BASH Programming

UNIX System Programming Lecture 3: BASH Programming UNIX System Programming Outline Filesystems Redirection Shell Programming Reference BLP: Chapter 2 BFAQ: Bash FAQ BMAN: Bash man page BPRI: Bash Programming Introduction BABS: Advanced Bash Scripting Guide

More information

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version... Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples EECS2301 Title Unix/Linux Introduction These slides are based on slides by Prof. Wolfgang Stuerzlinger at York University Warning: These notes are not complete, it is a Skelton that will be modified/add-to

More information

Answers to AWK problems. Shell-Programming. Future: Using loops to automate tasks. Download and Install: Python (Windows only.) R

Answers to AWK problems. Shell-Programming. Future: Using loops to automate tasks. Download and Install: Python (Windows only.) R Today s Class Answers to AWK problems Shell-Programming Using loops to automate tasks Future: Download and Install: Python (Windows only.) R Awk basics From the command line: $ awk '$1>20' filename Command

More information

EECS2301. Lab 1 Winter 2016

EECS2301. Lab 1 Winter 2016 EECS2301 Lab 1 Winter 2016 Lab Objectives In this lab, you will be introduced to the Linux operating system. The basic commands will be presented in this lab. By the end of you alb, you will be asked to

More information

Lab 2: Linux/Unix shell

Lab 2: Linux/Unix shell Lab 2: Linux/Unix shell Comp Sci 1585 Data Structures Lab: Tools for Computer Scientists Outline 1 2 3 4 5 6 7 What is a shell? What is a shell? login is a program that logs users in to a computer. When

More information

Introduction to the shell Part II

Introduction to the shell Part II Introduction to the shell Part II Graham Markall http://www.doc.ic.ac.uk/~grm08 grm08@doc.ic.ac.uk Civil Engineering Tech Talks 16 th November, 1pm Last week Covered applications and Windows compatibility

More information

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview

More information

Introduction to UNIX Part II

Introduction to UNIX Part II T H E U N I V E R S I T Y of T E X A S H E A L T H S C I E N C E C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S Introduction to UNIX Part II For students

More information

Shell Scripting. With Applications to HPC. Edmund Sumbar Copyright 2007 University of Alberta. All rights reserved

Shell Scripting. With Applications to HPC. Edmund Sumbar Copyright 2007 University of Alberta. All rights reserved AICT High Performance Computing Workshop With Applications to HPC Edmund Sumbar research.support@ualberta.ca Copyright 2007 University of Alberta. All rights reserved High performance computing environment

More information

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Introduction to remote command line Linux. Research Computing Team University of Birmingham Introduction to remote command line Linux Research Computing Team University of Birmingham Linux/UNIX/BSD/OSX/what? v All different v UNIX is the oldest, mostly now commercial only in large environments

More information

Linux at the Command Line Don Johnson of BU IS&T

Linux at the Command Line Don Johnson of BU IS&T Linux at the Command Line Don Johnson of BU IS&T We ll start with a sign in sheet. We ll end with a class evaluation. We ll cover as much as we can in the time allowed; if we don t cover everything, you

More information

Linux Command Line Primer. By: Scott Marshall

Linux Command Line Primer. By: Scott Marshall Linux Command Line Primer By: Scott Marshall Draft: 10/21/2007 Table of Contents Topic Page(s) Preface 1 General Filesystem Background Information 2 General Filesystem Commands 2 Working with Files and

More information

An Introduction to Unix Power Tools

An Introduction to Unix Power Tools An to Unix Power Tools Randolph Langley Department of Computer Science Florida State University August 27, 2008 History of Unix Unix Today Command line versus graphical interfaces to COP 4342, Fall History

More information

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze EECS 2031 Software Tools Prof. Mokhtar Aboelaze Footer Text 1 EECS 2031E Instructor: Mokhtar Aboelaze Room 2026 CSEB lastname@cse.yorku.ca x40607 Office hours TTH 12:00-3:00 or by appointment 1 Grading

More information

unix intro Documentation

unix intro Documentation unix intro Documentation Release 1 Scott Wales February 21, 2013 CONTENTS 1 Logging On 2 1.1 Users & Groups............................................. 2 1.2 Getting Help...............................................

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

UNIX Shell Programming

UNIX Shell Programming $!... 5:13 $$ and $!... 5:13.profile File... 7:4 /etc/bashrc... 10:13 /etc/profile... 10:12 /etc/profile File... 7:5 ~/.bash_login... 10:15 ~/.bash_logout... 10:18 ~/.bash_profile... 10:14 ~/.bashrc...

More information

Unix. Examples: OS X and Ubuntu

Unix. Examples: OS X and Ubuntu The Command Line A terminal is at the end of an electric wire, a shell is the home of a turtle, tty is a strange abbreviation, and a console is a kind of cabinet. - Some person on SO Learning Resources

More information

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02 Essential Unix (and Linux) for the Oracle DBA Revision no.: PPT/2K403/02 Architecture of UNIX Systems 2 UNIX System Structure 3 Operating system interacts directly with Hardware Provides common services

More information

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi Lezione 8 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza Sommario Shell command language Introduction A

More information

CISC 220 fall 2011, set 1: Linux basics

CISC 220 fall 2011, set 1: Linux basics CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week

More information

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options Basic Unix Command The Unix command has the following common pattern command_name options argument(s) Here we are trying to give some of the basic unix command in Unix Information Related man It is used

More information

Introduction to the Linux Command Line January Presentation Topics

Introduction to the Linux Command Line January Presentation Topics 1/22/13 Introduction to the Linux Command Line January 2013 Presented by Oralee Nudson ARSC User Consultant & Student Supervisor onudson@alaska.edu Presentation Topics Information Assurance and Security

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

Chapter 1 - Introduction. September 8, 2016

Chapter 1 - Introduction. September 8, 2016 Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help

More information

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2 CSE Linux VM For Microsoft Windows Based on opensuse Leap 42.2 Dr. K. M. Flurchick February 2, 2017 Contents 1 Introduction 1 2 Requirements 1 3 Procedure 1 4 Usage 3 4.1 Start/Stop.................................................

More information

Scripting Languages Course 1. Diana Trandabăț

Scripting Languages Course 1. Diana Trandabăț Scripting Languages Course 1 Diana Trandabăț Master in Computational Linguistics - 1 st year 2017-2018 Today s lecture Introduction to scripting languages What is a script? What is a scripting language

More information

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

More Raspian. An editor Configuration files Shell scripts Shell variables System admin More Raspian An editor Configuration files Shell scripts Shell variables System admin Nano, a simple editor Nano does not require the mouse. You must use your keyboard to move around the file and make

More information

Introduction to Supercomputing

Introduction to Supercomputing Introduction to Supercomputing TMA4280 Introduction to UNIX environment and tools 0.1 Getting started with the environment and the bash shell interpreter Desktop computers are usually operated from a graphical

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14 Introduction to Linux (Part I) BUPT/QMUL 2018/03/14 Contents 1. Background on Linux 2. Starting / Finishing 3. Typing Linux Commands 4. Commands to Use Right Away 5. Linux help continued 2 Contents 6.

More information

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell Lezione 8 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Esercitazione Introduzione al linguaggio di shell Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza

More information

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

More information

Introduction to Linux Organizing Files

Introduction to Linux Organizing Files Introduction to Linux Organizing Files Computational Science and Engineering North Carolina A&T State University Instructor: Dr. K. M. Flurchick Email: kmflurch@ncat.edu Arranging, Organizing, Packing

More information

CSCI 2132 Software Development. Lecture 5: File Permissions

CSCI 2132 Software Development. Lecture 5: File Permissions CSCI 2132 Software Development Lecture 5: File Permissions Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 14-Sep-2018 (5) CSCI 2132 1 Files and Directories Pathnames Previous

More information

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell:

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell: Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed performs the actions Example:

More information

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018 EECS 470 Lab 5 Linux Shell Scripting Department of Electrical Engineering and Computer Science College of Engineering University of Michigan Friday, 1 st February, 2018 (University of Michigan) Lab 5:

More information

Part 1: Basic Commands/U3li3es

Part 1: Basic Commands/U3li3es Final Exam Part 1: Basic Commands/U3li3es May 17 th 3:00~4:00pm S-3-143 Same types of questions as in mid-term 1 2 ls, cat, echo ls -l e.g., regular file or directory, permissions, file size ls -a cat

More information

Unix Processes. What is a Process?

Unix Processes. What is a Process? Unix Processes Process -- program in execution shell spawns a process for each command and terminates it when the command completes Many processes all multiplexed to a single processor (or a small number

More information

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015 Practical Computing-II March 20, 2015 0. An Introduction About The Course CMS M.2.2 Practical Computing-II About The Course CMS M.2.2 Practical Computing-II 25 credits (33.33% weighting) About The Course

More information

Unix basics exercise MBV-INFX410

Unix basics exercise MBV-INFX410 Unix basics exercise MBV-INFX410 In order to start this exercise, you need to be logged in on a UNIX computer with a terminal window open on your computer. It is best if you are logged in on freebee.abel.uio.no.

More information

UNIX Basics. UNIX Basics CIS 218 Oakton Community College

UNIX Basics. UNIX Basics CIS 218 Oakton Community College UNIX Basics UNIX Basics CIS 218 Oakton Community College History UNIX was invented in 1969 at AT&T Bell Labs Ken Thompson and Dennis Ritchie are credited as the original architects and developers of C.

More information

Introduction to UNIX Command Line

Introduction to UNIX Command Line Introduction to UNIX Command Line Files and directories Some useful commands (echo, cat, grep, find, diff, tar) Redirection Pipes Variables Background processes Remote connections (e.g. ssh, curl) Scripts

More information

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie Introduction in Unix Linus Torvalds Ken Thompson & Dennis Ritchie My name: John Donners John.Donners@surfsara.nl Consultant at SURFsara And Cedric Nugteren Cedric.Nugteren@surfsara.nl Consultant at SURFsara

More information

Chapter 4. Unix Tutorial. Unix Shell

Chapter 4. Unix Tutorial. Unix Shell Chapter 4 Unix Tutorial Users and applications interact with hardware through an operating system (OS). Unix is a very basic operating system in that it has just the essentials. Many operating systems,

More information

Introduction to UNIX command-line

Introduction to UNIX command-line Introduction to UNIX command-line Boyce Thompson Institute March 17, 2015 Lukas Mueller & Noe Fernandez Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions

More information

INSE Lab 1 Introduction to UNIX Fall 2017

INSE Lab 1 Introduction to UNIX Fall 2017 INSE 6130 - Lab 1 Introduction to UNIX Fall 2017 Updated by: Paria Shirani Overview In this lab session, students will learn the basics of UNIX /Linux commands. They will be able to perform the basic operations:

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

CST Algonquin College 2

CST Algonquin College 2 The Shell Kernel (briefly) Shell What happens when you hit [ENTER]? Output redirection and pipes Noclobber (not a typo) Shell prompts Aliases Filespecs History Displaying file contents CST8207 - Algonquin

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming 1 Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

CSCI 2132 Software Development. Lecture 4: Files and Directories

CSCI 2132 Software Development. Lecture 4: Files and Directories CSCI 2132 Software Development Lecture 4: Files and Directories Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 12-Sep-2018 (4) CSCI 2132 1 Previous Lecture Some hardware concepts

More information

Introduction to UNIX. SURF Research Boot Camp April Jeroen Engelberts Consultant Supercomputing

Introduction to UNIX. SURF Research Boot Camp April Jeroen Engelberts Consultant Supercomputing Introduction to UNIX SURF Research Boot Camp April 2018 Jeroen Engelberts jeroen.engelberts@surfsara.nl Consultant Supercomputing Outline Introduction to UNIX What is UNIX? (Short) history of UNIX Cartesius

More information

Operating Systems, Unix Files and Commands SEEM

Operating Systems, Unix Files and Commands SEEM Operating Systems, Unix Files and Commands SEEM 3460 1 Major Components of Operating Systems (OS) Process management Resource management CPU Memory Device File system Bootstrapping SEEM 3460 2 Programs

More information

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 3: UNIX Operating System Organization Tian Guo CICS, Umass Amherst 1 Reminders Assignment 2 is due THURSDAY 09/24 at 3:45 pm Directions are on the website

More information

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010 Unix Basics Benjamin S. Skrainka University College London July 17, 2010 Overview We cover basic Unix survival skills: Why you need some Unix in your life How to get some Unix in your life Basic commands

More information

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: Processes The Operating System, Shells, and Python Shell Commands a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: - Command prompt - Shell - CLI Shell commands

More information

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc. Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds

More information

Introduction To. Barry Grant

Introduction To. Barry Grant Introduction To Barry Grant bjgrant@umich.edu http://thegrantlab.org Working with Unix How do we actually use Unix? Inspecting text files less - visualize a text file: use arrow keys page down/page up

More information

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

More information

Files and Directories

Files and Directories CSCI 2132: Software Development Files and Directories Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Files and Directories Much of the operation of Unix and programs running on

More information

Running Programs in UNIX 1 / 30

Running Programs in UNIX 1 / 30 Running Programs in UNIX 1 / 30 Outline Cmdline Running Programs in UNIX Capturing Output Using Pipes in UNIX to pass Input/Output 2 / 30 cmdline options in BASH ^ means "Control key" cancel a running

More information

IMPORTANT: Logging Off LOGGING IN

IMPORTANT: Logging Off LOGGING IN These are a few basic Unix commands compiled from Unix web sites, and printed materials. The main purpose is to help a beginner to go around with fewer difficulties. Therefore, I will be adding to this

More information

Outline. Structure of a UNIX command

Outline. Structure of a UNIX command Outline Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission (owner, group, rwx) File and directory

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Phil Mercurio The Scripps Research Institute mercurio@scripps.edu 1 Session Overview What is Linux Shells & Windows The Linux File System Assorted Commands 2 What Is Linux? Linux

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 5 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 User Operating System Interface - CLI CLI

More information