script Commandcd - Change Directorypwd - Show Your Current Directoryls - List the Contents of a Directorycat - Print the Contents of a Filerm - Delete a Filemkdir - Create a Directoryrmdir - Delete a Directorycp - Copy Filesmv - Move a File or DirectoryThe reading assignment for this week is chapter 2 of Sobell, Getting Started.
You will find a list of all reading assignments here.
There is a link to this page on the class web page.
I have posted homework 2.
As usual, it will be due this coming Sunday at 11:59 PM.
You will find a list of all homework assignments here.
The class web page has a link to this page.
The first graded quiz will be given next week.
The questions from the graded quiz are taken from the ungraded quizzes of the previous week.
script Commandscript command creates a transcript of you Unix sessionscript creates a text file named typescript ...script in the same directory ...script will obliterate the contents of the previous typescript filescript -a
-a option, script will add to the previous typescript filescript session ...-h as the help option ...--helpman or infoman or info with the name of the command
& : | * ? ' " [ ] ( ) $ < > { } # / \ ! ~
echo command prints whatever comes after it$ echo Hello World! Hello World!
echo ...$ echo ~ /home/tsoro
$ echo \~ ~
$ echo '~' ~ $ echo "~" ~
cd - Change Directorycd (change directory) changes your current directorycd to move from one directory to another
cd DIRECTORY_NAME
cd with the name of a directory ...cd without an argument ...cd
cd ..cd ../..
pwd - Show Your Current Directorypwd (print working directory) displays your current directory
pwd
pwd every time you use cdls - List the Contents of a Directoryls (list) is one of the most basic Unix commandsls is used without an argument ...ls followed by the name of a directory ...
ls DIRECTORY
ls followed by the name of a file ...-a (for all) option ...ls will list all files ...ls ...-a optionls is -l ...$ ls -l total 20 -rw-rw-r-- 1 ghoffman 103 Sep 11 14:34 basic.css -rw-r--r-- 1 ghoffman 3560 Aug 29 13:30 emacs_cheat_sheet.html -rw-r--r-- 1 ghoffman 701 Aug 29 13:30 index.html drwxr-xr-x 6 ghoffman 512 Sep 15 14:11 it_244 -rw-r--r-- 1 ghoffman 6831 Aug 29 13:30 tips.html -rw-r--r-- 1 ghoffman 6052 Aug 29 13:30 unix_cheat_sheet.html
cat - Print the Contents of a Filecat (concatenate) displays the contents of a file
$ cat foo.txt foo bar blecth
-n option cat displays line numbers
$ cat -n lines.txt
1 line 1
2 line 2
3 line 3
4 line 4
5 line 5
6 line 6
7 line 7
8 line 8
9 line 9
10 line 10cat on a long file ...more and less ...rm - Delete a Filerm (remove) deletes a file
rm FILENAME
rm does not ask you if you are sure ...
rm *
rmrm with the -i option ...rm -i foo.txt rm: remove regular file `foo.txt'? y [Enter]
rm *rm cannot be used on a directory ...mkdir - Create a Directorymkdir (make directory) creates a directory
mkdir DIRECTORY_NAME
rmdir - Delete a Directoryrmdir (remove directory) deletes a directory
rmdir IRECTORY_NAME
rmdir will not work on a directory ...cp - Copy Filescp (copy) makes a copy of a file ...cp takes two arguments
cp FILENAME NEW_FILENAME_OR_DIRECTORY
cp can copy an entire directory ...-r (for recursive) optionmv - Move a File or Directorymv (move) is a command that does two different things
mv FILENAME_OR_DIRECTORY_NAME NEW_DIRECTORY
mv FILENAME_OR_DIRECTORY_NAME NEW_FILENAME_OR_NEW_DIRECTORY_NAME
mv takes two arguments$ ls foo.txt it244 work $ ls work $ mv foo.txt work $ ls it244 work $ ls work foo.txt
$ ls foo.txt hold it244 work $ mv foo.txt bar.txt $ ls bar.txt hold it244 work