Linux File System Commands Navigating the File System

  • Slides: 6
Download presentation
Linux File System Commands Navigating the File System ls - list the files in

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 E. I. Horvath and E. A. Horvath

File Operations Copy a file to a directory cp filename. py directoryname Copy a

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 D 786 -BE 1 B with the identifier for your USB Flash Drive cp filename. py /media/pi/D 786 -BE 1 B When done, click on the upper right hand corner to safely eject the USB Flash Drive

File Operations Rename a file mv filename. py newfilename. py Move a file to

File Operations Rename a file mv filename. py newfilename. py Move a file to a directory mv filename. py directoryname

Using the nano Text Editor Editing files with nano filename. py nano robot_move. py

Using the nano Text Editor Editing files with 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

Running Python in the command prompt Type python 3 to execute a Python file

Running Python in the command prompt Type python 3 to execute a Python file python 3 filename. py Example: python 3 robot_move. py

Finding Files Searching for files with a specific name. The * are wildcards. This

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 D 786 -BE 1 B with the identifier for your USB Flash Drive find /media/pi/D 786 -BE 1 B -name *robot*. py