Linux Installation and Basic Running Yun Weonhee Keimyung
Linux Installation and Basic Running Yun, Weonhee (Keimyung University)
Maintenance • Where to get information about Linux related issues? • The Linux Documentation Project • Introduction to Linux • Command line continuation and multiple commands in a line • >> ls • -l • >>ls ; mkdir testdir
Contents (Day 3) • • • Getting help from man pages Becoming a “root”, the system administrator Adduser File permission Aliases Edtors Standard I/O and filtering with pipelines I/O Redirection Shell variables and positional parameters String operators Flow control (if else fi, for do done) • Condition tests (string comparison and arithmetic conditionals)
File download • Type ‘project Gutenberg’ in the google search panel. • Search ‘Alice in wonderland’ and download the text file. • You are at ~/ • Create directories under ~/projects • • ~/projects/syntax ~/projects/data ~/projects/bin Copy the text file into the ~/projects/data/alice. txt
Getting help from man pages • >> man command or >> info command • >> man cp or >> info command • Difference? man from original Unix and info from GNU group
How to become a “root” • To change system files such as /etc/hosts, root privilege is needed. • user@hufs >> who • user@hufs >> sudo su • user@hufs >> [sudo] password for user: • hostname user >> whoami • apt-get install package • sudo means “substitute user do”
Addusers • Menu – System-settings – Administration – Users and group • Create user 2 with a group name learners • >> touch file 1 • >> chgrp learners file 1 • >> ls -l •
File permission and attribution • >> ls -l • Directory (d) • drwxrwxrwx username groupname size date directory • File (-) • -rwxrwxrwx username groupname size date file 1 • -User group others (u, g, o, ug, go, uo) • • • >> chmod u+r file 1, >> chmod g-w file 1 >> chmod u+x, g-x file 1 r=4, w=2, x=1, 0 >> chmod 444 file 1 >> chmod 400 file 1
Aliases • Alias enables a replacement of a word by another string. • It is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command. • >> alias go=cd • >> alias gosyntax=‘cd /home/user/projects/syntax’ • >> alias rm=‘rm –i’ • >> alias cp=‘cp –i’
Editors • Editors (emacs) • sudo apt-get install emacs • sudo apt-get install vim-gnome • >> emacs file 1
• cd, cp, mkdir, rmdir, touch, rm, mv • ln –s • >> cat (concatenate), more, less, head, tail • >> cat alice. txt • >> cat file 1 file 2
Standard I/O and filtering with pipelines • • • Standard input (stdin) Standard output (stdout) Standard error (stderr) Standard input and output with the cat command >> cat > file 1 >> cat file 1 file 2 >> cat <file 1> file 2 >> rm nofile. txt (remove a file that does not exist in the directory) • rm nofile. txt 2> /dev/null
Pipeline • A pipeline is a sequence of processes chained together by their standard streams, so that the output of each process (stdout) feeds directly as input (stdin) to the next one. • >> ls –l |grep projects
Shell variables • Setting up variables • • • var 1=3 var 2=4 var 3=books var 4=“a book” echo $var 1 $var 2 $var 3 $var 4 Echo “type letters” ; cat > file 1 • Bash shell script.
System variables • HOME, LANG, TERM, USER, BASH, PS 1, PATH, HOSTNAME • >> echo $HOME • After setting up a system variable, do “>> export VAR=VALUE
Bash shell script and positional variables • Open your bash shell file, myshell 1. sh with emacs. • Insert #! and the output of $BASH • >> echo “type letters” ; cat > file 1 • myshell 1. sh filename $0 $1
• Different ways to achieve the purpose • >> myshell 1. sh “print this” file 1
String operator • ${var: -value} • If var exists and isn’t null, return its value, otherwise return value. • ${var: =value} • If var exists and isn’t null, return its value, otherwise set it to value and then return its value. Positional and special parameters cannot be assigned this way. • Script : • • • var 2=${var 1: -word} echo $var 1 $var 2 Var 2=${var 1: =word} Echo $var 1 $var 2 Use positional variables for the value
String comparisons • Str 1 = Str 2 • Str 1 != Str 2 • Str 1 < Str 2 • Str 1 > Str 2 • [ $Str 1 == $Str 2 ]
Integer conditionals • [ $a –lt $b ] less than • -le less than or equal • -eq equal • -ge greater than or equal • -gt greater than • -ne not equal
Control (if then fi) • if [ ! –d testdir ] ; then mkdir testdir ; fi • File attribute operators • -d file exists and is a directory • -e file exists • -f file exists and is a regular file (not a directory or other special type of file) • -r file You have read permission on file • -w file You have write permission on file • -x file You have execute permission on file • if condition ; then commands; elif condition; then commands ; else commands ; fi
For loop • for i in 1, 2, 3, 4; do echo $i; done • files. txt • test 1, test 2, test 3…
Kaldi Installation
Kaldi Installation Procedure • >> sudo apt-get install git • >> sudo apt-get install libatlas 3 -base • >> sudo apt-get install wget • >> mkdir ~/usr • >> cd ~/usr • >> git clone https: //github. com/kaldi-asr/kaldi. git kaldi --origin upstream • >> cd kaldi • >> cat INSTALL
• >> cd tools/ • >> cat INSTALL • >>. /extras/check_dependencies. sh • >> sudo apt-get install zlib 1 g-dev automake autoconf libtool subversion • >> sudo apt-get install g++ • >> dpkg --list |grep compiler • >> make • >>. /extras/install_irstlm. sh
• >> cd. . /src • >> cat INSTALL • >>. /configure --shared • >> make depend • >> make
Tux, the official mascot of the Linux kernel
- Slides: 27