Most of the time you can happily use the desktop GUI world of icons & click-click-click to navigate your directory(folder) setup. However, for this course and in order to set up new packages you will find a survival set of understandings about the underlying textual command interface of Unix very helpful.
Here's some Unix commands you'll find useful from time to time.
ls
| list contents of current directory(folder)
ls can be used alone or in targeted way
ls
ls ~ ('~' is shorthand for your home folder)
ls .. ('..' is parent of current working directory)
ls ../*.java (* is a "wild card")
The "/" symbol separates folder levels in the path
|
cd
| change current directory(folder)
cd can be used alone or in targeted way
cd ( when you don't specify which one; default is your home folder)
cd ~ ( specifically your home folder )
cd .. ( change to the parent folder )
cd ../.. ( change to the parent of the parent folder )
cd ~/cs157 ( change to subfolder of home folder )
|
pwd
| "print working directory" |
mkdir
| make a new directory(folder) from the command line
mkdir cs284
mkdir cs284/hw4
mkdir ../tiasStuff
mkdir ~/html/project3
|
diff
| diff is used to compare two files and report any and all differences between their contents. You must provide two files to compare.
grep index_A.php index_B.php
grep index_B.html ..
grep work.html ../StyleHW0/
|
grep
| grep is used to search files for strings (aka simple "regular expressions") The first field is the regular expression.
grep navigation *.html ( search for the word 'navigation' in all html files in current folder )
grep // *.php ( search for side by side slashes in all php files in current folder )
|
cp
| cp is used to make copies of one or more files The first field is what you want a copy of.
cp index.html index.php (copies a single file)
cp *.php phpTIAS/ (copies all files ending in .java into subdirectory phpTIAS)
cp -rf cs284/ SavaAllcs284Files/ (makes a copy of the entire directory & all subdirectories)
cp ../work.html . (copies file found in parent directory(..) to current directory(.) )
new file has same name as original
cp ../work.html workOfArt.html (copies file found in parent directory(..) to current directory(.) )
new file has a different name than original
|
mv
| mv is used to move a file or files from one place to another (or one name to another)
mv tias.html tias_01.html (renames a single file)
mv *.html cs284Archives/ (moves all files ending in .html into subdirectory cs284Archives)
mv ../*.html . (moves all files ending in .html from parent directory to current)
mv JavaPkgs/ SavaAllJavaPkgs/ (renames a directory)
mv ../one.html two.html (moves file found in parent directory(..) to current directory(.) )
file has a different name
|
rm
| rm is used to remove/DELETE a file or files Remove/DELETE one or more files. BE CAREFUL!!!
rm FirstClient.java (deletes a single file)
rm *.class (deletes all files ending in .class in current directory)
rm */*.class (deletes all files ending in .class from all subdirectories;
does NOT remove those in current directory)
rm ../*.class (deletes all files ending in .class from parent directory)
rm * (deletes all files in directory. BE CAREFUL!!!)
|