1 of 4

1.4 Working with files

2 of 4

Inspecting and manipulating files

  • less – examine file contents
  • grep – search file contents

  • wc – word count
  • head – show lines from beginning
  • tail – show lines from end
  • nano – text editor
  • sort – change order of lines
  • ??? mystery command

  • cp – copy file
  • mv – move file
  • rm – remove file
  • touch – create an empty file (or change modification date)

  • mkdir – make a directory
  • rmdir – remove a directory

Advanced: check out other common commands https://www.thegeekstuff.com/2010/11/50-linux-commands/

3 of 4

LIVE DEMO: working with files

Rear Adm. Grace Hopper

(1906 -1992)

Commands

wc

wc -l

head -n

tail -n

nano

sort

cp

mv

rm

Objectives

  • Explore multiple ways to inspect files
  • Use nano as file editor
  • Learn about finding command options
  • Practice file manipulations
  • Find a linux command on your own

4 of 4

Your turn...

  • Open the notebook Module-1_bash-jupyter-git/1.4_working-with-files.ipynb
  • Practice your new bash commands using the prompts shown
  • Complete the homework tasks