Docsity

UNIX File System and Basic Commands - Prof. Donna Pompei, Study notes of Computer Science

Toggle sidebar
bg1
UNIX Introduction
The UNIX File System
Defn: A UNIX file is a collection of characters stored together.
Defn: A UNIX directory is a collection of UNIX files.
Defn: Your home directory is the directory you are in when
you first log into your UNIX account.
Note: You can move from one directory to another within the
UNIX file system.
Defn: Your current directory or working directory is the
UNIX directory you are working in at a particular time.
Example: When you first log into your account, your
working directory is your home directory.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download UNIX File System and Basic Commands - Prof. Donna Pompei and more Study notes Computer Science in PDF only on Docsity!

UNIX Introduction

The UNIX File System

Defn: A UNIX file is a collection of characters stored together. Defn: A UNIX directory is a collection of UNIX files. Defn: Your home directory is the directory you are in when you first log into your UNIX account. Note: You can move from one directory to another within the UNIX file system. Defn: Your current directory or working directory is the UNIX directory you are working in at a particular time. Example: When you first log into your account, your working directory is your home directory.

Defn: A UNIX file system is the organization of the UNIX files on a UNIX computer system. UNIX file systems are organized into a “tree” structure of files and directories. Terms: root, leaf, parent, child The root is referred to in writing commands as “/” not “root”.

Defn: A pathname is an address that uniquely specifies a file’s location in the UNIX file structure. Defn: An absolute pathname gives the position of a file from the root directory. Absolute pathnames always begin with / Examples: Filename Absolute pathname jack /home/jack jill /home/jill possum /home/jill/possum kangaroo /home/jill/Marsupials/kangaroo Your home directory has the pathname ~ Jack’s home directory has the pathname ~jack

Defn: A relative pathname is a pathname that begins at the working directory.

. (“dot”) = the current working directory .. (“dotdot”) = the parent of the current working directory Examples: Suppose your current working directory is jill. Filename Relative pathname possum possum kangaroo Marsupials/kangaroo jill. home .. jack ../jack

cp -- copy a file from pathname1 to pathname

unix> cp pathname1 pathname2 Example: With current working directory jill: unix> cp possum Marsupials/opossum

more -- view the contents of a file one page at a time

unix> more will display the next page will display one line at a time q will quit more Example: unix> ls > L1 -- redirects the output of ls into file L unix> more L1 -- displays L

less -- "less is more." less is like more except less will

let you page backwards through a file.

unix> less will display the next page b will display the previous page will display one line at a time q will quit less Example: unix> ls > L1 -- redirects the output of ls into file L unix> less L1 -- displays L

mkdir -- create a new directory

mkdir Example: If the current working directory is jill mkdir cecs

cd -- change your working directory

cd --returns to home directory cd Example: If the current working directory is jill, cd ../jack/Continents will move the working directory to /home/jack/Continents

rmdir -- remove a directory

rmdir rmdir will remove a directory if it is empty. If it still has files inside of it, it will give an error message. Example: If the current working directory is jill rmdir ../jack/Oceans will remove the directory Oceans

rm -- remove a file

rm Example: If the current working directory is Marsupials rm wombat -- will remove /home/jill/Marsupials/wombat The -r option will remove a directory and all of the files and subdirectories contained in the directory. Your working directory must be an ancestor directory of the directory to be removed when you enter the command. rm -r Example: If the current working directory is jill rm -r Marsupials -- will remove /home/jill/Marsupials and all its subdirectories and files