UNIX on your ITLabs account
Listing files and directories
ls lists the files and directories in the current working directory
- ls directory
lists the files and directories in the named directory
- ls -a
lists the files and directories including all dot(hidden)
files (.cshrc, .login, ..)
- ls -l
lists all files and directories with their sizes and last-modification time
Directories
mkdir (make directory)
creates a directory
rmdir (remove directory)
removes an empty directory
pwd (print working directory)
find the current directory
cd (change directory)
creates a directory
- cd directory change to the named directory
- cd
change to home-directory
- cd ..
change to parent directory(move up a directory)
Files
mv file1 file2
moves (or renames) file1 to file2
rm file1 file2 file3 .....
removes (or deletes) files named file1 file2 file3 ...
cat file
displays the contents of file on the screen all at once.
emacs file1 &
starts emacs editor to edit file1
cp file1 file2
makes a copy of file1 in the current working directory
and calls it file2
- cp file1 your_directory
makes a copy of file1 in your_directory
- cp file1 your_directory/file2
makes a copy of file1 in your_directory
and calls it file2
more file displays the contents of file on the screen one page at a time.
- press space-bar to see the next page
- press q to quit reading
- press return to see the next line
lpr -Pcs4204 file1 file2 ..... prints files to EE/CS 4-204 printers
- Note that you should buy printer cards from the operators at EE/CS 4-204 -
they are $1 or $4, checks only, no cash or credit cards!
- To print 2 pages in one page do enscript -2Gr -Pcs4204 your_file or mpage -Pcs4204 -2 your_file
- To print 4 pages in one page do mpage -Pcs4204 -4 your_file
Other useful commands
man command Read on-line manuals on command
for example, typing man lpr gives an on-line manual page
for lpr
mozilla & Start a mozilla web browser to surf the net
pine Read/write email
quota -v Check how much space you have left on your account
Emacs (key stroke commands follow in ( ))
Change directory(cd) to the directory where you want to edit your files.
Type emacs & at the Unix prompt.
- To create a new file, go to the File menu and select Open File (C-x C-f) and type the filename you want.
- To open an already existing file, do the same as the above except use the name of the file you want to open.
- To save a file, go to File menu and select Save Buffer (C-x C-s)
- To save a file as a different file, go to File menu and Save Buffer As (C-x C-w)
- To close a file, select Kill Buffer (C-x k) from the File menu.
- To quit Emacs, select Exit Emacs (C-x C-c) from the File menu.
Copy and Paste
To copy text, hold down the left mouse button and select the desired text.
To paste, position your mouse at the desired place and press the middle mouse button.
Example
When you first log in...
kimx0320@ .... % ls
Mail/ News/
kimx0320@ .... % ls -a
./ ../ Mail/ News/
kimx0320@ .... % ls -l
total 2
drwx------ 2 kimx0320 student 512 Mar 9 1998 Mail/
drwx------ 2 kimx0320 student 512 Mar 9 1998 News/
kimx0320@ .... % ls -al
total 4
drwx------ 3 kimx0320 student 512 Mar 15 1999 ./
drwx------ 27 kimx0320 student 512 Sep 13 17:14 ../
drwx------ 2 kimx0320 student 512 Mar 9 1998 Mail/
drwx------ 2 kimx0320 student 512 Mar 9 1998 News/
To create a directory for csci 1901 course
kimx0320@ .... % mkdir csci1901
To see the directory you have just created
kimx0320@ .... % ls
Mail/ News/ csci1901/
To remove the directory you have just created
kimx0320@ .... % rmdir csci1901
To see if removing worked
kimx0320@ .... % ls
Mail/ News/
To re-create a directory for csci 1901 course
kimx0320@ .... % mkdir csci1901
To see the directory you have just created
kimx0320@ .... % ls
Mail/ News/ csci1901/
To change to the directory csci1901
kimx0320@ .... % cd csci1901
Mail/ News/ csci1901/
To find out where you are
kimx0320@ .... % pwd
/home/it19/kimx0320/csci1901
To create a directory for your homework #0
kimx0320@ .... % mkdir lab0
kimx0320@ .... % ls
lab0/
kimx0320@ .... % cd lab0
kimx0320@ .... % pwd
/home/it19/kimx0320/csci1901/lab0
Written by Sunny Kim for the Csci 1901 students