Linux File System Commands Navigating the File System ls - list the files in the current directory File and directory names are case sensitive cd /home/pi/Robot - cd change directory to the Robot directory; the absolute path starts at the root cd Desktop - cd change directory to the Desktop; this relative path starts at the current directory Copyright (c) 2017 by Dr. E. Horvath
Copyright (c) 2017 by Dr. E. Horvath File Operations Copy a file to a directory cp filename.py directoryname Copy a file to a new file cp filename.py newfilename.py Make a backup copy of your files to a USB Flash Drive; replace D786-BE1B with the identifier for your USB Flash Drive cp filename.py /media/pi/D786-BE1B When done, click on the upper right hand corner to safely eject the USB Flash Drive Copyright (c) 2017 by Dr. E. Horvath
Copyright (c) 2017 by Dr. E. Horvath File Operations Rename a file mv filename.py newfilename.py Move a file to a directory mv filename.py directoryname Copyright (c) 2017 by Dr. E. Horvath
Using the nano Text Editor Editing files with nano nano filename.py nano robot_move.py # Make changes to the file; navigate with # the arrow keys Ctrl+O # Control plus O to write out Hit the Enter Key # Accept the changes Ctrl+X # Control plus X to exit Copyright (c) 2017 by Dr. E. Horvath
Running Python in the command prompt Type python3 to execute a Python file python3 filename.py Example: python3 robot_move.py Copyright (c) 2017 by Dr. E. Horvath
Copyright (c) 2017 by Dr. E. Horvath Finding Files Searching for files with a specific name. The * are wildcards. This example shows a search for any Python files which have robot in the file name. Search the home directory find ~ -name *robot*.py Search the USB Flash Drive; replace D786-BE1B with the identifier for your USB Flash Drive find /media/pi/D786-BE1B -name *robot*.py Copyright (c) 2017 by Dr. E. Horvath