EGR 103/UNIX Lab
Jump to navigation
Jump to search
This page has some references from the first EGR 103 lab.
Contents
Typos / Changes
- Spring 2019: None Yet!
Items Learned
During the UNIX Demonstration
pwd
: print working directory - see where you are in the file systemls
: list - see what files, folders, links, and other items are in the directory specified or, if nothing is specified, the current directoryls -a
: list all the things, including hidden files whose names begin with a periodls -l
: list the additional information about items, such as who owns them and how big they arels -la
ORls -al
: list all the things including the additional information
cd
: change directory - move from wherever you are to wherever you need to becd
with no path after it means change to the user's home directory
/
is used at the very beginning of a path to indicate that the path is an absolute path from the root of the file system/
is used after the name of a folder in a path to indicate that what follows is the name of a folder or a file within that folder~
is used at the start of a path as an absolute shortcut for the user's home directory~ID
is used at the start of a path as an absolute shortcut for ID's home directory - with CIFS, the only person's directory you can access is you so this is less useful now.
is a shortcut meaning the current directory..
is a shortcut meaning the directory "above" the current one in the file tree- Combinations of folder names and .. shortcuts may be strung together in any order; generally, any required .. go at the beginning.
- The folder
/afs
contains links to many different institutions throughout the world, but most of us only really have access to Duke's system.
While Creating/Using EGR103 Folder
mkdir PATH
: creates a new directory. If the PATH is simply a name, the folder is created within the current folder.cp -i SOURCE(S) TARGET
: safely copies the files indicated inSOURCE(S)
to theTARGET
. There are several variations of this:- If
SOURCE
is a single file andTARGET
is the name of a folder, a duplicate of SOURCE, also namedSOURCE
, will be copied into TARGET - If
SOURCE
is a single file andTARGET
is a name that does not exist yet, a duplicate ofSOURCE
will be made and it will be called TARGETcp -i MyFile.txt ACopyOfMyFile.txt
- This will take the data from
MyFile.txt
and duplicate it in a file within the current directory to be namedACopyOfMyFile.txt
- This will take the data from
- If
SOURCES
contain several files, the TARGET must be the name of an existing folder. Duplicates of theSOURCES
will be copied into the TARGET and will maintain their original names
- If any of the files
cp
wants to make already exist and the-a
flag is used,cp
will ask before overwriting a file.
- If
- The
*
symbol can be used to make a pattern for finding files; it will replace any number of characters, including no characters.ls /afs/*ath*
will list all items in the/afs
folder that haveath
somewhere in the name, regardless of any characters before or after theath