Agenda


Use the terminal/command line for

  • listing files in a directory
  • navigate between directories
  • view contents of a file
  • copy files
  • rename files
  • remove/delete files
  • move file to a new folder
  • remove directory
  • word count
  • get help

pwd


pwd
## /cygdrive/j/R/courses/tutorial_slides/github

who am i


whoami
## aravind\hp

ls


ls
## _output.yaml
## commands.Rmd
## commands.html
## file1.txt
## forcats.png
## git_banner.png
## github_tour.Rmd
## intro.Rmd
## intro.html
## pages.Rmd
## pages.html
## projects.Rmd
## projects.html
## setup.Rmd
## shell.Rmd
## shell.html
## shell_banner.png
## ssh.png
## styles.css
## thankyou.png

cat


cat shell.Rmd
## ---
## output: _output.yaml
## ---
## 
## ## {data-background="shell_banner.png"}
## 
## ## Agenda
## 
## <hr>
## 
## Use the terminal/command line for
## 
## - listing files in a directory
## - navigate between directories
## - view contents of a file
## - copy files
## - rename files
## - remove/delete files
## - move file to a new folder
## - remove directory
## - word count
## - get help
## 
## ## pwd
## 
## <hr>
## 
## ```{sh pwd}
## pwd
## ```
## 
## ## who am i
## 
## <hr>
## 
## ```{sh who}
## whoami
## ```
## 
## ## ls
## 
## <hr>
## 
## ```{sh ls}
## ls
## ```
## 
## ## cat
## 
## <hr>
## 
## ```{sh cat}
## cat shell.Rmd
## ```
## 
## ## cp
## 
## <hr>
## 
## ```{sh cp}
## cp shell.Rmd cyg.Rmd
## ```
## 
## ## echo
## 
## <hr>
## 
## ```{sh echo2}
## echo "hello" > file1.txt
## ```
## 
## ## ls
## 
## <hr>
## 
## ```{sh ls5}
## ls
## ```
## 
## ## mv
## 
## <hr>
## 
## ```{sh mv}
## mv file1.txt file2.txt
## ```
## 
## ## rm
## 
## <hr>
## 
## ```{sh rm}
## rm cyg.Rmd
## ```
## 
## ## head
## 
## <hr>
## 
## ```{sh head}
## head shell.Rmd
## ```
## 
## ```{sh mv2, echo=FALSE}
## mv file2.txt file1.txt
## ```
## 
## ## mkdir
## 
## <hr>
## 
## ```{sh mkdir}
## mkdir examples
## ```
## 
## ## rmdir
## 
## <hr>
## 
## ```{sh rmdir}
## rmdir examples
## ```
## 
## ## wc
## 
## <hr>
## 
## ```{sh wc1}
## # characters, words and lines
## wc shell.Rmd
## ```
## 
## ## wc
## 
## <hr>
## 
## ```{sh wc2}
## # characters
## wc shell.Rmd -c
## ```
## 
## ## wc
## 
## <hr>
## 
## ```{sh wc3}
## # words
## wc shell.Rmd -w
## ```
## 
## ## wc
## 
## <hr>
## 
## ```{sh wc4}
## # lines
## wc shell.Rmd -l
## ```
## 
## 
## ## References
## 
## <hr>
## 
## - http://www2.imm.dtu.dk/courses/02333/cygwin_tutorial/index.html
## - https://tutorial.djangogirls.org/en/intro_to_command_line/
## - https://ss64.com/
## - https://www.learnenough.com/command-line-tutorial
## 
## ## {data-background="thankyou.png"}

cp


cp shell.Rmd cyg.Rmd

echo


echo "hello" > file1.txt

ls


ls
## _output.yaml
## commands.Rmd
## commands.html
## cyg.Rmd
## file1.txt
## forcats.png
## git_banner.png
## github_tour.Rmd
## intro.Rmd
## intro.html
## pages.Rmd
## pages.html
## projects.Rmd
## projects.html
## setup.Rmd
## shell.Rmd
## shell.html
## shell_banner.png
## ssh.png
## styles.css
## thankyou.png

mv


mv file1.txt file2.txt

rm


rm cyg.Rmd

mkdir


mkdir examples

rmdir


rmdir examples

wc


# characters, words and lines
wc shell.Rmd
##  170  219 1590 shell.Rmd

wc


# characters
wc shell.Rmd -c
## 1590 shell.Rmd

wc


# words
wc shell.Rmd -w
## 219 shell.Rmd

wc


# lines
wc shell.Rmd -l
## 170 shell.Rmd

References