Brief Introduction on Linux Related Technology. KONG, Lei

Size: px
Start display at page:

Download "Brief Introduction on Linux Related Technology. KONG, Lei"

Transcription

1 Brief Introduction on Linux Related Technology KONG, Lei

2 Contents 1. Useful clients under Windows & Linux 2. Command line utilitie 3. Bash scripts

3 Section I Useful Tools under Windows & Linux

4 Clients under Windows for Remote Login Use PuTTY/SecureCRT as ssh client to login to the remote server. PuTTY: ham/putty/ SecureCRT: crt/index.html

5 Clients under Windows for File Transfer Use WinSCP to do file transfer between local and remote computer WinSCP SFTP (SSH File Transfer Protocol), mostly used with SSH-2 SCP (Secure Copy Protocol), mostly used with SSH-1

6 Clients under Windows for X Use Xmanager as Xwindow Server for X11 display. Xmanager:

7 Other Useful Tools GNU Screen lftp sophisticated command line ftp/http client GNU wget

8 Section II BASIC Useful Linux/Unix Tools (Particular Thanks: ZHAO, Shuqi)

9 GNU Text Utilities dos, unix, mac text file dos2unix unix2dos mac2dos time, estimate the time for the jobs time someprog progparam economize on disk run_certain_program -o /dev/stdout gzip -c > result.gz

10 GNU Text Utilities Is the program with correct format? cat -A filename edit the original file sed -i -e /badline/d *.fa perl -i.bak -npe s/old/new/g *.fa Input special characters in bash(eg. tab) ctrl+v special_character

11 sort -b --ignore-leading-blanks -d --dictionary-order -f --ignore-case -i --ignore-nonprinting -n --numeric-sort -r --reverse -k POS1[,POS2] --key=pos1[,pos2] -s --stable -t SEPARATOR --field-separator=separator -u --unique

12 sort example A sort key position may also have any of the option letters `Mbdfinr appended to it, in which case the global ordering options are not used for that particular field. sort sort -k5,6nr -k7,7

13 tar <options> for tar x to extract from an archive. c to Create an archive. t to list the contents of an archive. z to work with a gzipped (ending with.gz) archive. (GNU Tar only) j to work with a bzip2 (ending with.bz2) archive. (GNU Tar only) more general for -z and -j bash $ tar cf - path/to/dir/ gzip -c > xxx.tar.gz bash $ tar cf - path/to/dir/ bzip2 -c > xxx.tar.bz2

14 find Syntax: find pathname-lists option expression; Examples: To print out the current pathname for file myfile : bash $ find. -name myfile -print To print out the yes* files accessed in the last two days: bash $ find. -name yes* -atime +2 -print

15 find 如何将查询的结果作为命令行参数 tmp]$ cd find-example/ find-example]$ >a >b >c >d >e >f find-example]$ ls a b c d e f [kongl@soft find-example]$ find. -type f -exec mv {} {}.1 \; [kongl@soft find-example]$ ls a.1 b.1 c.1 d.1 e.1 f.1

16 Difference between.bash_profile and.bashrc Login with shell (ssh /etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile #append to.bash_profile test -f ~/.bashrc &&. ~/.bashrc Login without shell (ssh cmd) /etc/bash.bashrc -> ~/.bashrc

17 Special Shell Variables $# The number of arguments. All arguments, as separate words. $* All arguments, as one word. $$ ID of the current process. $? Exit status of the last command. $0,$1,..$9,${10},${11}...${N} Positional parameters. cbimgmt $ cat wrapper.sh exec program.real $@ cbimgmt $ cat wrapper.sh exec program.real $@ WHAT S THE DIFFERENCE

18 Bash test and comparison functions test, [ ], [[ ]], (( )), or if-then-else-fi cbimgmt $ test expr #= [ expr ], return $? cbimgmt $ test 3 -gt 4 && echo true echo false cbimgmt $ [[ ( -d "$HOME" ) && ( -w "$HOME" ) ]] && \ echo "home is a writable directory" arithmetic comparisons -eq, -ne, -lt, -le, -gt, or -ge, String comparisons =,!=, <, or >

19 SSH Related Tips always type the user and host name? tmp]$ cat ~/.ssh/config Host soft Hostname User kongl

20 SSH Public Key Authentication ~]$ ls ~/.ssh/ config known_hosts ~]$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/kongl/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/kongl/.ssh/id_dsa. Your public key has been saved in /home/kongl/.ssh/id_dsa.pub. The key fingerprint is: e4:b4:8d:98:f5:6f:39:5e:f7:96:f8:0c:c0:d6:cf:73 ~]$ scp ~/.ssh/id_dsa.pub soft:.ssh/authorized_keys password: id_dsa.pub 100% KB/s 00:00 ~]$ ssh soft Last login: Sat Nov 28 15:34: from

21 SSH Copy without SCP I [kongl@soft tmp]$ dd if=/home/kongl/tmp/c ssh soft 'dd of=/home/kongl/tmp/e' 0+1 records in 0+1 records out 123 bytes (123 B) copied, 2.1e-05 seconds, 5.9 MB/s kongl@ 's password: 0+1 records in 0+1 records out 123 bytes (123 B) copied, seconds, 58.4 kb/s [kongl@soft tmp]$ ls a c d e find-example sort_example.txt test.sh [kongl@soft tmp]$ cat e Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy.

22 SSH Copy Without SCP II tmp]$ cat c ssh soft 'cat > /home/kongl/tmp/f' kongl@ 's password: [kongl@soft tmp]$ ls a c d e f find-example sort_example.txt test.sh [kongl@soft tmp]$ cat f Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy.

23 lftp lftp [ftp:// lftp -c command lftp -e cmd lftp -f script_file lftp commands! shell command debug level off cd, lcd get, put, mget, mput, pget mirror

24 Vim command mode operations :g/pattern/d (Delete lines with the specified pattern) :%!sed /pattern/d (same as above) :1,10s/old/new/g (Replace old with new in line 1-10 globally.) :r!date (Read current date.) :set nu, :set nonu (Display line number or not.) :set ai, :set noai (auto indent) :set hlsearch, :set nohlsearch (high light search results) n+yy (copy n lines),p (paste),dd (delete/cut the current line), u (undo) w (move cursor forward a word),b (move cursor backward a word) shift+d (delete from cursor to line end) ctrl+d (half page down),ctrl+u (half page up) :w (save),:q! (force quit without saving),:wq (save & quit)

25 Vim insert mode i (insert mode) esc (quit insert mode) ctrl+v special_character (input a special character in insert mode)

26 Task Manager Tips crontab crontab e # use /bin/sh to run commands, # no matter what /etc/passwd says SHELL=/bin/sh # run five minutes after midnight, every day 5 0 * * * $HOME/bin/daily.job &>> $HOME/tmp/out # run at 2:15pm on the first of every month * * $HOME/bin/monthly crontab filename

27 Four device file /dev/stdin /dev/stdout /dev/stderr /dev/null cbimgmt $ cat /etc/passwd do_job -i /dev/stdin -o /dev/stdout cbimgmt $ ln -s /dev/stdout o.png && convert in.ps o.png display cbimgmt $ find /etc name * -type f -exec ls -l {} \; 2>/dev/null

28 Bash shortcuts moving the cursor Ctrl + a Go to the beginning of the line (Home) Ctrl + e Go to the End of the line (End) Ctrl + p Previous command (Up arrow) Ctrl + n Next command (Down arrow) Alt + b Back (left) one word Alt + f Forward (right) one word Ctrl + f Forward one character Ctrl + b Backward one character Ctrl + xx Toggle between the start of line and current cursor position

29 Bash shortcuts - editing Ctrl + L Clear the Screen, similar to the clear command Ctrl + u Cut/delete the line before the cursor position. Alt + Del Delete the Word before the cursor. Alt + d Delete the Word after the cursor. Ctrl + d Delete character under the cursor Ctrl + h Delete character before the cursor (Backspace) Ctrl + w Cut the Word before the cursor to the clipboard. Ctrl + k Cut the Line after the cursor to the clipboard. Alt + t Swap current word with previous Ctrl + t Swap the last two characters before the cursor (typo). Esc + t Swap the last two words before the cursor. ctrl + y Paste the last thing to be cut (yank) Alt + u UPPER capitalize every character from the cursor to the end of the current word. Alt + l Lower the case of every character from the cursor to the end of the current word. Alt + c Capitalize the character under the cursor and move to the end of the word. Alt + r Cancel the changes and put back the line as it was in the history (revert). ctrl + _ Undo TAB Tab completion for file/directory names

30 Bash shortcuts - history Ctrl + r Recall the last command including the specified character(s) searches the command history as you type. Equivalent to : vim ~/.bash_history. Ctrl + p Previous command in history (i.e. walk back through the command history) Ctrl + n Next command in history (i.e. walk forward through the command history) Ctrl + s Go back to the next most recent command. (beware to not execute it from a terminal because this will also launch its XOFF). Ctrl + o Execute the command found via Ctrl+r or Ctrl+s Ctrl + g Escape from history searching mode!! Repeat last command!abc Run last command starting with abc!abc:p Print last command starting with abc!$ Last argument of previous command ALT +. Last argument of previous command!* All arguments of previous command ^abc^def Run previous command, replacing abc with def

31 Bash shortcuts process control Ctrl + C Interrupt/Kill whatever you are running (SIGINT) Ctrl + l Clear the screen Ctrl + s Stop output to the screen (for long running verbose commands) Ctrl + q Allow output to the screen (if previously stopped using command above) Ctrl + D Send an EOF marker, unless disabled by an option, this will close the current shell (EXIT) Ctrl + Z Send the signal SIGTSTP to the current task, which suspends it. To resume the task enter fg.

32 screen related tips create a screen: #screen [ENTER] fork a new shell #screen [ENTER] or C-a c name current window: C-a A switch to certain window: C-a Present a list of all windows: C-a Send the command character (C-a): C-a a detach screen: C-a d Toggle to previously window: C-a C-a To split screens: C-a S (Shift-s) To unsplit screens: C-a Q (shift-q) To switch between screens: C-a TAB resumes a detached session: screen -r Attach to a not detached session: screen -x

33 Section III Bash Script Programming

34 Readings Advanced Bash-Scripting Guide BASH Programming - Introduction HOW-TO Intro-HOWTO.html

35 UNIX Philosophy KISS: Keep It Simple and Stupid OT2: One Time, One Thing Collaboration makes the world better

36 Very Simple Scripts Hello World tmp]$ cat hello.sh #!/bin/bash echo Hello World tmp]$./hello.sh Hello World A very simple backup script #!/bin/bash tar -czf /var/my-backup.tgz /home/me/

37 Input & Output Standard input (stdin): keyboard; Standard output (stdout): monitor; A process has 3 special file descriptor.

38 Process file descriptor $ ls -l /proc/14649/fd total 0 lrwx lion lion 64 Aug 16 07:32 0 -> /dev/pts/8 lrwx lion lion 64 Aug 16 07:32 1 -> /dev/pts/8 lrwx lion lion 64 Aug 16 07:32 2 -> /dev/pts/8 Why did we look at directory /proc/14649/fd? /proc is for "process information" /14649 is for "process #14649", the running bash shell /fd is for "file descriptors", the list of the process' open file descriptors Now we see that we have three open file descriptors: 0,1,2. 0 is stdin 1 is stdout 2 is stderr

39 IO Redirection 在 shell 中, 使用者可以利用 > 和 < 来进行输入输出重定向 command >file Redirect command s stdout to a file command &>file Redirect command s stdout to a file along with the stderr command >>file Append the command s stdout to the file command &>> file Append the command s stdout to the file along with the stderr command 2>&1 Redirect stderr to stdout. command i>&j Redirect file descriptor i to j. j<>filename Open file filename, and assign file descriptor j to it.

40 IO Redirection examples ~]$ > a ls [kongl@soft ~]$ cat a a Desktop F-7-i386-DVD.iso fedora7 gentoo new-svap surg _40u4_linux64.tar.gz tmp zimbra

41 The order bash deal with io redirection: left to right tmp]$ ls tmp]$ >a tmp]$ >c tmp]$ ls a c [kongl@soft tmp]$ rm b > d 2>&1 [kongl@soft tmp]$ cat d rm: cannot remove `b': No such file or directory [kongl@soft tmp]$ rm b 2>&1 >d rm: cannot remove `b': No such file or directory [kongl@soft tmp]$ cat d [kongl@soft tmp]$ [kongl@soft tmp]$ 2>&1 rm b > d rm: cannot remove `b': No such file or directory [kongl@soft tmp]$ >d 2>&1 rm b [kongl@soft tmp]$ >d rm b 2>& 我是分隔符 [kongl@soft tmp]$ rm b 2>&1 2>a [kongl@soft tmp]$ cat a rm: cannot remove `b': No such file or directory [kongl@soft tmp]$ rm b 2>a 2>&1 rm: cannot remove `b': No such file or directory [kongl@soft tmp]$ cat a [kongl@soft tmp]$

42 Redirection order test tmp]$ cat c Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy. [kongl@soft tmp]$ cat c > a > d > e > f [kongl@soft tmp]$ cat a [kongl@soft tmp]$ cat d [kongl@soft tmp]$ cat e [kongl@soft tmp]$ cat f Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy.

43 More Funny tmp]$ cat test.sh #!/bin/bash cat c rm b [kongl@soft tmp]$ ls a c d test.sh [kongl@soft tmp]$./test.sh > a rm: cannot remove `b': No such file or directory [kongl@soft tmp]$ cat a Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy. [kongl@soft tmp]$./test.sh > a 3>&1 1>&2 2>&3 3<&- Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy. [kongl@soft tmp]$ cat a rm: cannot remove `b': No such file or directory

44 File descriptor tmp]$ ls c d test.sh [kongl@soft tmp]$ cat c Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy. [kongl@soft tmp]$ 3<>a cat c>&3 [kongl@soft tmp]$ cat a Greg Sanders: All work and no play makes Greg a dull boy. Gil Grissom: All play and no work makes Greg an UNEMPLOYED boy.

45 PIPE Process A STDOUT STDIN Process B STDOUT STDERR STDERR

46 Sample: simple pipe with sed tmp]$ ls a c d e f find-example hello.sh sort_example.txt test.sh [kongl@soft tmp]$ ls sed -e "s/[aeio]/u/g" u c d u f fund-uxumplu hullu.sh surt_uxumplu.txt tust.sh

47 Sample: an alternative to ls -l *.txt tmp]$ ls -l *.txt -rw-r--r-- 1 kongl cbi 381 Nov 28 11:02 sort_example.txt [kongl@soft tmp]$ ls -l grep "\.txt$" -rw-r--r-- 1 kongl cbi 381 Nov 28 11:02 sort_example.txt

48 Variables Sample: Hello World! using variables #!/bin/bash STR="Hello World!" echo $STR Sample: A very simple backup script (little bit better) #!/bin/bash OF=/var/my-backup-$(date +%Y%m%d).tgz tar -czf $OF /home/me/

49 Local variables tmp]$ cat local_hello.sh #!/bin/bash HELLO=Hello function hello { local HELLO=World echo $HELLO } echo $HELLO hello echo $HELLO [kongl@soft tmp]$./local_hello.sh Hello World Hello

50 Conditionals if expression then statement if expression then statement1 else statement2 if expression1 then statement1 else if expression2 then statement2 else statement3

51 Examples Basic conditional example if.. then #!/bin/bash if [ "foo" = "foo" ]; then echo expression evaluated as true fi Basic conditional example if.. then... else #!/bin/bash if [ "foo" = "foo" ]; then echo expression evaluated as true else echo expression evaluated as false fi Conditionals with variables #!/bin/bash T1="foo" T2="bar" if [ "$T1" = "$T2" ]; then echo expression evaluated as true else echo expression evaluated as false fi

52 Loops - for [kongl@soft tmp]$ cat for_example.sh #!/bin/bash for i in $( ls *.*); do echo item: $i done echo "============separater==========" for i in `seq 1 5`; do echo $i done [kongl@soft tmp]$./for_example.sh item: for_example.sh item: hello.sh item: local_hello.sh item: sort_example.txt item: test.sh ============separater==========

53 Loops - while [kongl@soft tmp]$ cat while_example.sh #!/bin/bash COUNTER=0 while [ $COUNTER -lt 5 ]; do echo The counter is $COUNTER let COUNTER=COUNTER+1 done [kongl@soft tmp]$./while_example.sh The counter is 0 The counter is 1 The counter is 2 The counter is 3 The counter is 4

54 Loops - until [kongl@soft tmp]$ cat until_example.sh #!/bin/bash COUNTER=10 until [ $COUNTER -lt 5 ]; do echo COUNTER $COUNTER COUNTER=`expr $COUNTER - 1` done [kongl@soft tmp]$./until_example.sh COUNTER 10 COUNTER 9 COUNTER 8 COUNTER 7 COUNTER 6 COUNTER 5

55 Functions without parameter tmp]$ cat fun_no_param.sh #!/bin/bash function quit { exit } function hello { echo "Hello World!" } hello quit echo "It should not reach here!" [kongl@soft tmp]$./fun_no_param.sh Hello World!

56 Functions with parameters tmp]$ cat fun_with_param.sh #!/bin/bash function quit { exit } function my_echo { echo $1 } my_echo Hello World my_echo "Hello World" quit echo "It should not reach here, either!" [kongl@soft tmp]$./fun_with_param.sh Hello Hello World

57 Using select to make simple menus tmp]$ cat select_menu.sh #!/bin/bash OPTIONS="Hello Test Quit" select opt in $OPTIONS; do if [ "$opt" = "Quit" ]; then echo done exit elif [ "$opt" = "Test" ]; then echo "This is a test." elif [ "$opt" = "Hello" ]; then echo "Hello World!" else clear echo "bad options!!!" fi done [kongl@soft tmp]$./select_menu.sh 1) Hello 2) Test 3) Quit #? 1 Hello World! #? 2 This is a test. #? 3 done

58 Using the command line parameters tmp]$ cat cmd_param.sh #!/bin/bash if [ -z "$1" ]; then echo usage: $0 directory exit fi SRCD=$1 TGTD="$HOME/tmp/" BASENAME=`basename $SRCD` OF=$BASENAME-$(date +%Y%m%d).tgz echo tar czf "$TGTD/$OF" $SRCD tar czf "$TGTD/$OF" $SRCD [kongl@soft tmp]$./cmd_param.sh usage:./cmd_param.sh directory [kongl@soft tmp]$./cmd_param.sh find-example/ tar czf /home/kongl/tmp//find-example tgz find-example/ [kongl@soft tmp]$ ls a d find-example fun_no_param.sh local_hello.sh test.sh c e find-example tgz fun_with_param.sh select_menu.sh until_example.sh cmd_param.sh f for_example.sh hello.sh sort_example.txt while_example.sh

59 Reading user input with read tmp]$ cat read_example.sh #!/bin/bash echo Please, enter your name read NAME echo "Hi $NAME!" echo Please, enter your firstname and lastname read FN LN echo "Hi! $LN, $FN!" tmp]$./read_example.sh Please, enter your name Kidding Hi Kidding! Please, enter your firstname and lastname Kidding Serious Hi! Serious, Kidding!

60 Arithmetic evaluation tmp]$ cat arithmetic.sh #!/bin/bash echo "echo 1 + 1" echo echo "echo \$((1+1))" echo $((1+1)) echo "echo \$[1+1]" echo $[1+1] echo "echo \$[3/4]" echo $[3/4] echo "echo 3/4 bc -l" echo 3/4 bc -l [kongl@soft tmp]$./arithmetic.sh echo echo $((1+1)) 2 echo $[1+1] 2 echo $[3/4] 0 echo 3/4 bc -l

61 Getting the return value of a program [kongl@soft tmp]$ cat return_val.sh #!/bin/bash cd /dada &> /dev/null echo return value: $? cd $(pwd) &> /dev/null echo return value: $? [kongl@soft tmp]$./return_val.sh return value: 1 return value: 0

62 Capturing a commands output [kongl@soft tmp]$ cat capture_output.sh #!/bin/bash LIST=`ls find-example` for f in $LIST do echo FILE: $f done [kongl@soft tmp]$./capture_output.sh FILE: a.1 FILE: b.1 FILE: c.1 FILE: d.1 FILE: e.1 FILE: f.1

63 DEBUG The first line like this will produce some intresting output information #!/bin/bash -x Example: tmp]$ cat debug.sh #!/bin/bash -x PARAM=$1 echo $0 echo $1 tmp]$./debug.sh test.sh + PARAM=test.sh + echo./debug.sh./debug.sh + echo test.sh test.sh

64 Acknownlegement Dr. ZHAO, Shuqi

65 REFERENCE tml

66 Thanks

67

68 Some Linux Tips mkfifo, a program to create named pipe

69 GNU Text Utilities dos, unix, mac text file dos2unix unix2dos mac2dos time, estimate the time for the jobs time someprog progparam economize on disk run_certain_program -o /dev/stdout gzip -c > result.gz

70 /proc directory organization /proc/cpuinfo /proc/meminfo /proc/filesystems /proc/version /proc/[0-9]+ /proc/[0-9]+/cmdline /proc/[0-9]+/environ /proc/[0-9]+/fd /proc/[0-9]+/cwd

71 Some Linux Tips export hash -r reset wc #the \n number, not the line number ldd cbimgmt $ ldd /bin/bash linux-gate.so.1 => (0xffffe000) libncurses.so.5 => /lib/libncurses.so.5 (0xb7f6e000) libdl.so.2 => /lib/libdl.so.2 (0xb7f6a000) libc.so.6 => /lib/libc.so.6 (0xb7e50000) /lib/ld-linux.so.2 (0xb7fb8000)

72 file copy related Tips copy certain file to a new directory cbimgmt $ mkdir target cbimgmt $ find src -name *.class grep -v secret \ cpio -pd target Compress certain files cbimgmt $find../dir1/ cpio -o --format=tar > test.tar or cbimgmt $find../dir1/ cpio -o -H tar gzip> test.tar.gz work with rsync cbimgmt $ mkdir target cbimgmt $ rsync --exclude="*.java" -av src target/

73 Some Linux Tips Remember the work path cbimgmt $ cd some_path. cbimgmt $ do some work cbimgmt $ forget where to return? cbimgmt $ pushd some_path cbimgmt $ do some work cbimgmt $ popd Reorder the file column and row cbimgmt $ cat data cbimgmt $ cat data tr ' ' '\n' xargs -l5 cbimgmt $ cat data tr ' ' '\n' paste cbimgmt $ cat data tr ' ' '\n' xargs -l3 tr ' ' '+' bc 15 40

74 Some Linux Tips look up or signal process pgrep [-flvx] [-d delimiter] [-n -o] [-P ppid,...] [-g pgrp,...] [-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...] [-t term,...] [pattern] pkill [-signal] [-fvx] [-n -o] [-P ppid,...] [-g pgrp,...] [-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...] [-t term,...] [pattern] cbimgmt $ pgrep -u root #= ps -ef egrep '^root ' awk '{print $2}' cbimgmt $ pkill -HUP syslogd display a tree of processes pstree [-a] [-c] [-h -Hpid] [-l] [-n] [-p] [-u] [-Z] [-A -G -U] [pid user]

75 SSH Related Tips ## Linux Laptop.ssh/config ## Host work HostName User sporkey LocalForward :80 LocalForward :22 LocalForward :139 Host workssh HostName localhost User donkey Port HostKeyAlias workssh ## Linux Laptop.ssh/config ## Host workssh HostName ProxyCommand ssh /usr/bin/nc -w 1 %h 22

BASH Programming Introduction

BASH Programming Introduction BASH Programming Introduction 1. Very simple Scripts Traditional hello world script: echo Hello World A very simple backup script: tar -czf /var/my-backup.tgz /home/me/ 2. Redirection stdout 2 file: ls

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

Linux shell programming for Raspberry Pi Users - 2

Linux shell programming for Raspberry Pi Users - 2 Linux shell programming for Raspberry Pi Users - 2 Sarwan Singh Assistant Director(S) NIELIT Chandigarh 1 SarwanSingh.com Education is the kindling of a flame, not the filling of a vessel. - Socrates SHELL

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

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

bash, part 3 Chris GauthierDickey

bash, part 3 Chris GauthierDickey bash, part 3 Chris GauthierDickey More redirection As you know, by default we have 3 standard streams: input, output, error How do we redirect more than one stream? This requires an introduction to file

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

A shell can be used in one of two ways:

A shell can be used in one of two ways: Shell Scripting 1 A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) 2 If we have a set of commands

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

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

Introduction to Linux Basics Part II. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Introduction to Linux Basics Part II. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala Introduction to Linux Basics Part II 1 Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala pakala@uga.edu 2 Variables in Shell HOW DOES LINUX WORK? Shell Arithmetic I/O and

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming 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

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

Assignment clarifications

Assignment clarifications Assignment clarifications How many errors to print? at most 1 per token. Interpretation of white space in { } treat as a valid extension, involving white space characters. Assignment FAQs have been updated.

More information

Linux 系统介绍 (III) 袁华

Linux 系统介绍 (III) 袁华 Linux 系统介绍 (III) 袁华 yuanh25@mail.sysu.edu.cn Command Substitution The backquote ` is different from the single quote. It is used for command substitution: `command` $ LIST=`ls` $ echo $LIST We can perform

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

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

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

Command Interpreters. command-line (e.g. Unix shell) On Unix/Linux, bash has become defacto standard shell.

Command Interpreters. command-line (e.g. Unix shell) On Unix/Linux, bash has become defacto standard shell. Command Interpreters A command interpreter is a program that executes other programs. Aim: allow users to execute the commands provided on a computer system. Command interpreters come in two flavours:

More information

Unix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP

Unix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP Unix Guide Meher Krishna Patel Created on : Octorber, 2017 Last updated : December, 2017 More documents are freely available at PythonDSP Table of contents Table of contents i 1 Unix commands 1 1.1 Unix

More information

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes CSE 390a Lecture 2 Exploring Shell Commands, Streams, Redirection, and Processes slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture

More information

Consider the following program.

Consider the following program. Consider the following program. #include int do_sth (char *s); main(){ char arr [] = "We are the World"; printf ("%d\n", do_sth(arr)); } int do_sth(char *s) { char *p = s; while ( *s++!= \0 )

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

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala Linux Training for New Users of Cluster Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala pakala@uga.edu 1 Overview GACRC Linux Operating System Shell, Filesystem, and Common

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

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

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017 Linux Shell Scripting Linux System Administration COMP2018 Summer 2017 What is Scripting? Commands can be given to a computer by entering them into a command interpreter program, commonly called a shell

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

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

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

Linux shell scripting Getting started *

Linux shell scripting Getting started * Linux shell scripting Getting started * David Morgan *based on chapter by the same name in Classic Shell Scripting by Robbins and Beebe What s s a script? text file containing commands executed as a unit

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

9.2 Linux Essentials Exam Objectives

9.2 Linux Essentials Exam Objectives 9.2 Linux Essentials Exam Objectives This chapter will cover the topics for the following Linux Essentials exam objectives: Topic 3: The Power of the Command Line (weight: 10) 3.3: Turning Commands into

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

CENG 334 Computer Networks. Laboratory I Linux Tutorial

CENG 334 Computer Networks. Laboratory I Linux Tutorial CENG 334 Computer Networks Laboratory I Linux Tutorial Contents 1. Logging In and Starting Session 2. Using Commands 1. Basic Commands 2. Working With Files and Directories 3. Permission Bits 3. Introduction

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

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

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

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

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009 Bashed One Too Many Times Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009 What is a Shell? The shell interprets commands and executes them It provides you with an environment

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: 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

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

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection 1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 2 Lecture summary Unix

More information

RH033 Red Hat Linux Essentials

RH033 Red Hat Linux Essentials RH033 Red Hat Linux Essentials Version 3.5 QUESTION NO: 1 You work as a Network Administrator for McNeil Inc. The company has a Linux-based network. A printer is configured on the network. You want to

More information

Bourne Shell (ch 8) Overview. Bourne Shell. Bourne Shell. Bourne Shell. Bourne Shell. Redirect standard error. Redirect standard error

Bourne Shell (ch 8) Overview. Bourne Shell. Bourne Shell. Bourne Shell. Bourne Shell. Redirect standard error. Redirect standard error Overview (ch 8) IT244 - Introduction to Linux / Unix Instructor: Bo Sheng Admin determines which shell you use bash is the default shell in most of Linux systems /bin/bash Shell start-up /etc/profile (for

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

Shell Programming Overview

Shell Programming Overview Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some

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

Linux command line basics II: downloading data and controlling files. Yanbin Yin

Linux command line basics II: downloading data and controlling files. Yanbin Yin Linux command line basics II: downloading data and controlling files Yanbin Yin 1 Things you should know about programming Learning programming has to go through the hands-on practice, a lot of practice

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

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

Shells & Shell Programming (Part B)

Shells & Shell Programming (Part B) Shells & Shell Programming (Part B) Software Tools EECS2031 Winter 2018 Manos Papagelis Thanks to Karen Reid and Alan J Rosenthal for material in these slides CONTROL STATEMENTS 2 Control Statements Conditional

More information

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2) BANK ON & SHELL PROGRAMMING-502 (CORE PAPER-2) TOPIC 1: VI-EDITOR MARKS YEAR 1. Explain set command of vi editor 2 2011oct 2. Explain the modes of vi editor. 7 2013mar/ 2013 oct 3. Explain vi editor 5

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

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

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

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 11: WWW and Wrap up Tian Guo University of Massachusetts Amherst CICS 1 Reminders Assignment 4 was graded and scores on Moodle Assignment 5 was due and you

More information

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi Titolo presentazione Piattaforme Software per la Rete sottotitolo BASH Scripting Milano, XX mese 20XX A.A. 2016/17, Alessandro Barenghi Outline 1) Introduction to BASH 2) Helper commands 3) Control Flow

More information

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions?

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Lecture 4 Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Tuesday, September 7 CS 375 UNIX System Programming - Lecture

More information

OPERATING SYSTEMS LAB LAB # 6. I/O Redirection and Shell Programming. Shell Programming( I/O Redirection and if-else Statement)

OPERATING SYSTEMS LAB LAB # 6. I/O Redirection and Shell Programming. Shell Programming( I/O Redirection and if-else Statement) P a g e 1 OPERATING SYSTEMS LAB LAB 6 I/O Redirection and Shell Programming Lab 6 Shell Programming( I/O Redirection and if-else Statement) P a g e 2 Redirection of Standard output/input i.e. Input - Output

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

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

Understanding bash. Prof. Chris GauthierDickey COMP 2400, Fall 2008

Understanding bash. Prof. Chris GauthierDickey COMP 2400, Fall 2008 Understanding bash Prof. Chris GauthierDickey COMP 2400, Fall 2008 How does bash start? It begins by reading your configuration files: If it s an interactive login-shell, first /etc/profile is executed,

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

COMP 4/6262: Programming UNIX

COMP 4/6262: Programming UNIX COMP 4/6262: Programming UNIX Lecture 12 shells, shell programming: passing arguments, if, debug March 13, 2006 Outline shells shell programming passing arguments (KW Ch.7) exit status if (KW Ch.8) test

More information

Linux Fundamentals (L-120)

Linux Fundamentals (L-120) Linux Fundamentals (L-120) Modality: Virtual Classroom Duration: 5 Days SUBSCRIPTION: Master, Master Plus About this course: This is a challenging course that focuses on the fundamental tools and concepts

More information

Introduction to Linux. Roman Cheplyaka

Introduction to Linux. Roman Cheplyaka Introduction to Linux Roman Cheplyaka Generic commands, files, directories What am I running? ngsuser@ubuntu:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu

More information

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1 Shell Scripting Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 If we have a set of commands that we want to run on a regular basis, we could write a script A script acts as a Linux command,

More information

LING 408/508: Computational Techniques for Linguists. Lecture 5

LING 408/508: Computational Techniques for Linguists. Lecture 5 LING 408/508: Computational Techniques for Linguists Lecture 5 Last Time Installing Ubuntu 18.04 LTS on top of VirtualBox Your Homework 2: did everyone succeed? Ubuntu VirtualBox Host OS: MacOS or Windows

More information

COMS 6100 Class Notes 3

COMS 6100 Class Notes 3 COMS 6100 Class Notes 3 Daniel Solus September 1, 2016 1 General Remarks The class was split into two main sections. We finished our introduction to Linux commands by reviewing Linux commands I and II

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

bash Args, Signals, Functions Administrative Shell Scripting COMP2101 Fall 2017

bash Args, Signals, Functions Administrative Shell Scripting COMP2101 Fall 2017 bash Args, Signals, Functions Administrative Shell Scripting COMP2101 Fall 2017 Positional Arguments It is quite common to allow the user of a script to specify what the script is to operate on (e.g. a

More information

Shell Start-up and Configuration Files

Shell Start-up and Configuration Files ULI101 Week 10 Lesson Overview Shell Start-up and Configuration Files Shell History Alias Statement Shell Variables Introduction to Shell Scripting Positional Parameters echo and read Commands if and test

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

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80 CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Unix file system structure

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

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan DATA 301 Introduction to Data Analytics Command Line Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Why learn the Command Line? The command line is the text interface

More information

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line DATA 301 Introduction to Data Analytics Command Line Why learn the Command Line? The command line is the text interface to the computer. DATA 301: Data Analytics (2) Understanding the command line allows

More information

Linux and Network Administra3on. Lorenzo Bracciale Marco Bonola

Linux and Network Administra3on. Lorenzo Bracciale Marco Bonola Linux and Network Administra3on Lorenzo Bracciale Marco Bonola What is Linux? Outline Who is this guy? Who is this guy? Compiler Editor Human Interface Filesystem Networking OS Kernel Scheduler Device

More information

Essentials for Scientific Computing: Bash Shell Scripting Day 3

Essentials for Scientific Computing: Bash Shell Scripting Day 3 Essentials for Scientific Computing: Bash Shell Scripting Day 3 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Introduction In the previous sessions, you have been using basic commands in the shell. The bash

More information

Short Read Sequencing Analysis Workshop

Short Read Sequencing Analysis Workshop Short Read Sequencing Analysis Workshop Day 2 Learning the Linux Compute Environment In-class Slides Matt Hynes-Grace Manager of IT Operations, BioFrontiers Institute Review of Day 2 Videos Video 1 Introduction

More information

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016 Linux Boot Camp Jack, Matthew, Nishad, Stanley 6 Sep 2016 1 Connecting SSH Windows users: MobaXterm, PuTTY, SSH Tectia Mac & Linux users: Terminal (Just type ssh) andrewid@shark.ics.cs.cmu.edu 2 Let s

More information

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program Using UNIX. UNIX is mainly a command line interface. This means that you write the commands you want executed. In the beginning that will seem inferior to windows point-and-click, but in the long run the

More information

Utilities. September 8, 2015

Utilities. September 8, 2015 Utilities September 8, 2015 Useful ideas Listing files and display text and binary files Copy, move, and remove files Search, sort, print, compare files Using pipes Compression and archiving Your fellow

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

CSE 391 Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

CSE 391 Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors CSE 391 Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller and Ruth Anderson http://www.cs.washington.edu/391/

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

List of Linux Commands in an IPm

List of Linux Commands in an IPm List of Linux Commands in an IPm Directory structure for Executables bin: ash cpio false ln mount rm tar zcat busybox date getopt login mv rmdir touch cat dd grep ls perl sed true chgrp df gunzip mkdir

More information

CSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science

CSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science CSCI 211 UNIX Lab Shell Programming Dr. Jiang Li Why Shell Scripting Saves a lot of typing A shell script can run many commands at once A shell script can repeatedly run commands Help avoid mistakes Once

More information

LOG ON TO LINUX AND LOG OFF

LOG ON TO LINUX AND LOG OFF EXPNO:1A LOG ON TO LINUX AND LOG OFF AIM: To know how to logon to Linux and logoff. PROCEDURE: Logon: To logon to the Linux system, we have to enter the correct username and password details, when asked,

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

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

Last Time. on the website

Last Time. on the website Last Time on the website Lecture 6 Shell Scripting What is a shell? The user interface to the operating system Functionality: Execute other programs Manage files Manage processes Full programming language

More information

bash startup files Linux/Unix files stty Todd Kelley CST8207 Todd Kelley 1

bash startup files Linux/Unix files stty Todd Kelley CST8207 Todd Kelley 1 bash startup files Linux/Unix files stty Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 midterms (Feb 27 and April 10) bash startup files More Linux Files review stty 2 We customize our

More information

Introduction of Linux

Introduction of Linux Introduction of Linux 阳 oslab2018_class1@163.com 寅 oslab2018_class2@163.com PART I Brief Introduction Basic Conceptions & Environment Install & Configure a Virtual Machine Basic Commands PART II Shell

More information

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 Prof. Michael J. Reale Fall 2014 COMMAND KATA 7: VARIABLES Command Kata 7: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata7 and go

More information

CSC UNIX System, Spring 2015

CSC UNIX System, Spring 2015 CSC 352 - UNIX System, Spring 2015 Study guide for the CSC352 midterm exam (20% of grade). Dr. Dale E. Parson, http://faculty.kutztown.edu/parson We will have a midterm on March 19 on material we have

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

Unix Scripts and Job Scheduling. Overview. Running a Shell Script

Unix Scripts and Job Scheduling. Overview. Running a Shell Script Unix Scripts and Job Scheduling Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu/~spring Overview Shell Scripts

More information