Unix File Structure

File Hierarchy

Unix file system is a hierarchy of files

Absolute pathname

Directory files vs. ordinary files

Directories, data, executable code and I/O devices are all files

File names

Hidden files have names that start with '.'

Special characters have special meanings to the shell

Special characters may be quoted with '\'

Directories

Working directory is the directory you are RinS

Home directory

Relative path names

File Operations

Creating and removing directories

File manipulation

Listing Files Listing files in a directory with ls

Access Permissions

Checking access permissions (ls -l)

Changing access permissions

Links

Hard links

Soft links

Creating/removing links


Using the Shell

Command line basics

Syntax: command [arg1] [arg2] ... [argn]

Arguments

Options

Executing the command

Operating system searches for command

Commands generally open 3 files represented by their file descriptors

The terminal is a file

Redirection

Indicates other file(s) are to be used as standard input/output/error

Standard input

Standard output

Standard error

Pipes

Pipes pass standard output of one process to the standard input of another

Filters

Sending output to terminal AND a file with tee

Background processes

Running a process in the background

Process status

Killing a job

Filename generation

Metacharacters or wild cards represent variations on file names


Shell Scripts

Simple Shell Scripts

A shell script is a file that contains commands to be executed by the shell.

You need to make the file executable with chmod