ops102:filesystem_basics
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ops102:filesystem_basics [2024/01/10 17:53] – [Relative Pathnames] chris | ops102: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, | + | The rules for valid filenames vary with the type of filesystem, but generally, filenames may include letters, numbers, dashes, underscores, |
Spaces may be included in filenames, but may require quoting if accessed from the command-line, | Spaces may be included in filenames, but may require quoting if accessed from the command-line, | ||
Line 59: | Line 59: | ||
cd ops102 | cd ops102 | ||
- | To see the name of the current directory, use ' | + | 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 ' | + | 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 // | A // | ||
- | 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</ | \Users\jdoe\Downloads\example.txt</ | ||
- | 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 |
+ | |||
+ | ===== 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 ''/ | ||
+ | |||
+ | 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/ | + | Each unique volume on a Windows system has its own current/ |
On a Linux system, instead of using drive designators, | On a Linux system, instead of using drive designators, | ||
+ | ===== Basic Commands for Dealing with Files and Directories | ||
+ | |||
+ | Here are some basic commands for creating and removing files and directories, | ||
+ | |||
+ | ^ Description ^ Linux Command ^ Windows Command ^ Notes ^ | ||
+ | | Make a Directory | mkdir // | ||
+ | | Remove a Directory (Must be empty)| rmdir // | ||
+ | | Change (Working) Directory | cd // | ||
+ | | 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, | ||
+ | | Create an Empty File | touch //file// | copy nul //file// | | | ||
+ | | Remove/ | ||
+ | | 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 // | ||
+ | | Move or rename a file | mv // | ||
+ | | 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)