The Linux File System
Goals: Introduction to the Linux File System, its structure and how to navigate around it, as well as creating, moving and copying files and folders.
What the file system is, and a typical organization / hierarchy.
Some high-level comparison to that of Windows.
Absolute vs relative paths.
Commands:
pwd
,cd
,ls
,mv
,cp
,mkdir
,rmdir
,rm
History:
history
File Ownership and Permissions.
Within this and following sections, we have tried to make the descriptions and examples generic.
If you are following along as part of a scheduled training or bootcamp, where you see
<project-name>
replace this with the project name being used for the workshop (which changes) and<username>
with your username.Also, the hostname that you might see might change depending on the cluster you’re using.
If you are training independently, please use your own project folder, but contact arcc-help@uwyo.edu if you would like a copy of the files and directories used in our examples.
- 1 Some high-level comparison to that of Windows
- 2 Linux OS General Structure
- 3 Linux Hierarchical Structure: Example
- 4 Absolute Path: /home/arcc-t05/
- 5 Absolute Path: /home/arcc-t05/workshop/projects/p01/etc/
- 6 Relative Path: workshop/projects/p01/etc/
- 7 Relative Path: p01/etc/
- 8 Ex: Starting at / (root), what is the absolute path to the bits folder?
- 9 Ex: Starting in the home folder what is the relative path to the Jan folder?
- 10 Commands:
- 11 pwd: Print the name of the current working directory
- 12 cd: Change the shell working directory
- 13 ls: List information about the FILEs (cwd by default)
- 14 mkdir: Create the DIRECTORY(ies), if they do not already exist
- 15 mv: Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY
- 16 cp: Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY
- 17 rmdir: Remove the DIRECTORY(ies), if they are empty
- 18 rm: Remove (unlink) the FILE(s)
- 19 rm: WARNING
- 20 history
- 21 Exercises: Navigation
- 22 File Ownership and Permissions
- 23 Permission Denied
- 24 Exercises: Permissions
Some high-level comparison to that of Windows
| Windows | Linux |
Structure | Uses (data) drives C:, D:, E:… | Uses a tree hierarchy starting at “ Known as the root directory. |
|
|
|
Syntax | Uses the back slash: “\” | Uses the forward slash: “/” |
Home folder |
|
|
Application Install |
|
|
Folder and Filenames | Case insensitive: FoLdEr = FOLDER | Case sensitive: FoLdEr ≠ FOLDER |
|
| Wherever you are within the hierarchy is known as your current working directory (cwd) |
Linux OS General Structure
Linux Hierarchical Structure: Example
Absolute Path: /home/arcc-t05/
Path starts with a “/”
Absolute Path: /home/arcc-t05/workshop/projects/p01/etc/
Relative Path: workshop/projects/p01/etc/
Path does not start with a “/”
Relative Path: p01/etc/
Ex: Starting at / (root), what is the absolute path to the bits folder?
Answer:
Ex: Starting in the home folder what is the relative path to the Jan folder?
Answer:
Commands:
Commands are used to perform certain operating system tasks through the Command Line Interface, as directed by the interpreter (as opposed to a Graphical Interface Interpreter we would usually use).
The next couple of parts list and briefly summarize the commands we will be covering within this section:
pwd
, cd
, ls
, mkdir
, mv
, cp
, rmdir
and rm
.
We will then follow up with examples on how to use them.
<command --help>
Command | Description |
pwd | pwd: pwd [-LP]
Print the name of the current working directory. |
cd | cd: cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory. |
ls | Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default) |
mkdir | |
mv |
<command --help>: continued
Command | Description |
cp | |
rmdir | |
rm |
pwd: Print the name of the current working directory
cd: Change the shell working directory
cd: Change working directory (cont)
Answer:
Did we define an an absolute or relative path?
cd: Change the shell working directory
Answer:
ls: List information about the FILEs (cwd by default)
mkdir: Create the DIRECTORY(ies), if they do not already exist
mkdir: Create the DIRECTORY(ies), if they do not already exist
mv: Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY
mv: Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY
cp: Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY
cp: folders
rmdir: Remove the DIRECTORY(ies), if they are empty
rm: Remove (unlink) the FILE(s)
rm: Remove (unlink) the FILE(s)
rm: folders and file(s)
rm: WARNING
From the command-line there is NO trash bin!
Using rm
/rmdir
is FINAL!
history
Exercises: Navigation
Answers
File Ownership and Permissions
File Ownership and Permissions
User: This is the owner of the file/folder. By default, the person who created it becomes its owner.
<username>
is the owner
Group: A group is a collection of users. The primary purpose of the group is to define a set of privileges for a given resource that can be shared among the users within the group.
<project-name>
is the group.In general, for a workshop, all attending users / the
arcc-txx
users (if being used) have been setup to be within this group.
Other: This is any other user who has access to the file/folder. This person has neither created the file, nor do they belong to a user group.
Permission Denied
If we change directories, and go to /project/<project-name>/intro_to_linux, what permissions do the contents of this directory have?
Exercises: Permissions
Answers
Previous | Workshop Home | Next |