35 Working with Files

In this chapter you will learn how to inspect contents of files, and how to perform typical file operations:


  • wc
  • head
  • tail
  • cat
  • less
  • file

Typical file operations:

  • create a directory, e.g. mkdir lab05
  • create an empty file, e.g. touch README.md
  • rename a file, e.g. mv report.Rmd document.Rmd
  • move a file to another directory, e.g. mv myscript.R lab05/
  • copy a file, e.g. cp data1.csv data2.csv
  • remove a file, e.g. rm datafile.csv