User Tools

Site Tools


ops102:filesystem_basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ops102:filesystem_basics [2024/01/10 17:53] – [Relative Pathnames] chrisops102:filesystem_basics [2024/05/04 01:41] (current) – external edit 127.0.0.1
Line 13: Line 13:
 =====  Filenames  ===== =====  Filenames  =====
  
-The rules for valid filenames vary with the filesystem, but generally, filenames may include letters, numbers, dashes, underscores, and periods. Other punctuation marks may be acceptable in some filesystems but not in others, and are therefore best avoided, especially if files may be transferred between different types of filesystems or between computers.+The rules for valid filenames vary with the type of filesystem, but generally, filenames may include letters, numbers, dashes, underscores, and periods. Other punctuation marks may be acceptable in some filesystems but not in others, and are therefore best avoided, especially if files may be transferred between different types of filesystems or between computers.
  
 Spaces may be included in filenames, but may require quoting if accessed from the command-line, so that the shell does not interpret the filename as two or more separate filenames. For example, the filename "red leaf" may be interpreted as two separate filenames if written without quoting: Spaces may be included in filenames, but may require quoting if accessed from the command-line, so that the shell does not interpret the filename as two or more separate filenames. For example, the filename "red leaf" may be interpreted as two separate filenames if written without quoting:
Line 59: Line 59:
   cd ops102   cd ops102
  
-To see the name of the current directory, use 'pwd' (Print Working Directory) on Linux or 'cd' on Windows.+To see the name of the current directory, use the command ''pwd'' (Print Working Directory) on Linux or ''cd'' on Windows.
  
-To change your current directory to your home directory on Linux, use the 'cd' command by itself (with no arguments).+To change your current directory to your home directory on Linux, use the ''cd'' command by itself (with no arguments).
  
 =====  Pathnames  ===== =====  Pathnames  =====
Line 67: Line 67:
 A //pathname// is a filename that includes information about the directory in which the file is stored. (Sometime pathnames are simply called filenames!). A //pathname// is a filename that includes information about the directory in which the file is stored. (Sometime pathnames are simply called filenames!).
  
-There are three types of pathnames:+There are three types of pathnames, each of which has advantages and disadvantages. It is often necessary to use multiple types of pathnames in one command -- for example, when copying information from one directory to another directory. 
 + 
 +These are the three types of pathnames: 
  
 ====  Absolute Pathname  ==== ====  Absolute Pathname  ====
Line 176: Line 179:
   \Users\jdoe\Downloads\example.txt</code>   \Users\jdoe\Downloads\example.txt</code>
  
-Relative pathnames are often the shortest form of pathname, but the meaning of a relative pathname changes based on the current working directory.+Relative pathnames are often the shortest form of pathname //if// the target file is in the current working directory or a subdirectory of the current working directory, but the meaning of a relative pathname changes based on the current working directory
 + 
 +===== Directory vs File Names ===== 
 + 
 +It is often impossible to tell whether a pathname refers to a file or to a directory. For example, the Linux pathname ''/home/chris/presentation'' might refer to a file named ''presentation'' or to a directory named ''presentation''
 + 
 +If you wish to explicitly indicate that a pathname refers to a directory, append a slash or backslash to the pathname.
  
 =====  Volume Designators  ===== =====  Volume Designators  =====
  
-On Windows systems, a volume designator consisting of a letter followed by a colon may prefix a pathname. The volume may be a partition on a disk drive (HDD or SSD), a network storage location, or a multi-drive volume, where multiple partitions or disks are combined into a single storage pool.+On Windows systems, a volume designator consisting of a letter followed by a colon may prefix a pathname. The volume may be a partition on a disk drive (HDD or SSD), a shortcut to a network storage location, or a multi-drive volume, where multiple partitions or disks are combined into a single storage pool.
  
 Since the original IBM PC was designed to have up to two floppy disk drives, designated A: and B:, the main/first disk drive in a Windows system is usually designated as volume C: Since the original IBM PC was designed to have up to two floppy disk drives, designated A: and B:, the main/first disk drive in a Windows system is usually designated as volume C:
Line 191: Line 200:
 The volume designator is case-insensitive. The volume designator is case-insensitive.
  
-Each unique volume on a Windows system has its own current/working directory.+Each unique volume on a Windows system has its own current/working directory. You can switch between volumes by typing the volume designator by itself.
  
 On a Linux system, instead of using drive designators, volumes are //mounted// into the filesystem hierarchy -- that is, volumes are attached as directories, creating a unified hierarchy with a single root directory. On a Linux system, instead of using drive designators, volumes are //mounted// into the filesystem hierarchy -- that is, volumes are attached as directories, creating a unified hierarchy with a single root directory.
  
 +=====  Basic Commands for Dealing with Files and Directories  =====
 +
 +Here are some basic commands for creating and removing files and directories, changing and displaying the current directory, and displaying a tree diagram of a directory hierarchy. We will look at other commands and 
 +
 +^ Description ^ Linux Command ^ Windows Command ^ Notes ^
 +| Make a Directory | mkdir //directory// | mkdir //directory// | |
 +| Remove a Directory (Must be empty)| rmdir //directory// | rmdir //directory// | |
 +| Change (Working) Directory | cd //directory// | cd //directory// | |
 +| Print Current Working Directory | pwd | cd | |
 +| Change to Home Directory | cd | | |
 +| List Contents of Directory | ls \\ ls -l | dir | Linux: -l option displays long listing (including permissions, ownership, size, modification date/time) |
 +| Create an Empty File | touch //file// | copy nul //file// | |
 +| Remove/Delete a File | rm //file// | del //file// | |
 +| Display a Tree Diagram starting at Current Directory | tree | tree\\ tree /f | Windows: /f causes tree to display files (otherwise only directories are shown) |
 +| Copy a file | cp //sourcefile// //destinationfile// | copy //sourcefile// //destinationfile// | |
 +| Move or rename a file | mv //currentfilename// //newfilename// | move //currentfilename// //newfilename// | |
 +| Display the text contents of a file | cat //file// | type //file// | Note: Using these commands on a file that contains non-text data may look very strange. |
ops102/filesystem_basics.1704909194.txt.gz · Last modified: 2024/04/16 18:10 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki