notepad
—that’s a Windows program.
man
commandname
or help
commandname (for built-in commands).
cat
), use it to check your work.
For example, if you’re making a copy of a file, don’t just have faith
that you did it correctly. Use cat
to verify your success.
/
).
FOOBAR
is different than foobar
.
/
or ~
, it’s an absolute path.
cd
command changes your current directory. With no argument,
it takes you back to your home directory.
pwd
commands tells you where you are.
~
is your home directory.
~bob
is bob’s home directory.
~/foo
is the directory foo
underneath your home directory.
.
(dot) is the current directory—think “here”.
..
(dot-dot) is the parent directory—one level up from where you are.
cd
command to go to info
’s home directory.
cd
to go to the bin
directory under cs253
’s home directory.
cd
to go back to your home directory.
You are copy & pasting all your commands into another file, to show the TA, right? It would be a shame to do all this and not have anything to show to the TA.                 
~info/printers
.
~cs253/pub/hamlet.txt
. Did you get all that?
~cs253/pub/hamlet.txt
. Use q
to exit less
.
~cs253/pub/hamlet.txt
.
~cs253/pub/hamlet.txt
.
A few file commands:
ls -l
: a long listing of files in the current directory
ls -l
filename: a long listing of some file somewhere
ls -l
directory: a long listing of another directory
ls -l -d
directory: a long listing of the directory itself,
not what it contains.
ls -ld
directory: same thing
cp
old new: copy a file
mv
old new: move (rename) a file
rm
file: remove (delete) a file
mkdir
directory: create a directory
rmdir
directory: remove an empty directory
rm -r
directory: remove an directory, and the files
it contains, and all the directories underneath it, etc. dwarfs
from ~cs253/pub
to your home directory.
seven
.
Zulu
.
seven
to that new directory.
seven
.
date
: show the current date & time
diff
file1 file2: show the differences between two files
grep
pattern file: show lines that match a pattern
wc
file: count lines, words, and characters
dwarfs
from ~cs253/pub
to your home directory.
dwarfs
?
Use a command do do the counting.
Do not just cat
the file and count it yourself.
dwarfs
.
diff
to show the changes you’ve made.
grep
to find the dwarfs whose names contain a “y”.
>
sends the output to a file, overwriting any previous contents.
>>
appends the output to a file, adding to any previous contents.
|
sends the output to another program.
now
.
~cs253/pub/dwarfs
to the end of now
.
~cs253/pub/common-words.txt
that contain “xy”, and then send that output to sort
to put them
in alphabetical order.
grep
.
?
: matches any single character
*
: matches anything of any length
[aq%]
: The letter a
, the letter q
, or the percent sign.
[3-9]
: Any digit 3
through 9
, inclusive.
*
: all files
a*b
: any file whose name begins with a
and ends with b
.
zulu[aeiou]
: any file whose name is with zulu
followed immediately by a vowel, which ends the name:
zulue
, zulua
, zuluo
, but not zuluooo
or zuluax
.
~cs253/pub
.
under
, for undergrads.
We might have a grad
or two.
%
is my prompt:
% ls -l ~cs253/pub/dwarfs -rw-r--r-- 1 cs253 class 45 Aug 28 2022 /s/bach/a/class/cs253/pub/dwarfs
-
indicates that this is a plain file.
rw-
means that the owner can read, write, but not
execute this file.
r--
means that other users in this group can read,
but not write or execute this file.
dwarfs
file to your home directory.
chmod ug=rw dwarfs
to give yourself
(the user) and others in your group (other students)
read & write access to this file.
ls
.
Show your work to the TA for credit.                 
User: Guest