Online Help
Unix
Unix Commands
ls
ls soc453will list all the files in the soc453 directory.
ls -lAnother option is ls -F which will place a "/" after any directories, making them easier to distinguish from regular files.
cp soc.data psy.dataYou can also copy a file from one directory to another For example, issue the following command to copy a file from temporary storage to the current working directory:
cp /scratch/tempdir/big.dta big.dta
rm soc.dataThe system will respond with:
Remove soc.data?You can type y if you do want to remove the file or n if you do not.
find . -name "filename.txt" -printThis will search all the directories below your home directory for filename.txt. If you only remember a part of the file name, try
find . -name "*filenamepart*" -printYou must include the double quotes.
grep -i "phrase to find"To search through all the files in your account, cd to your home directory and type
grep -i "phrase to find" `find . -name "*" -print`The command 'find . -name "*" -print' finds all the files in or below your current directory, and the backquotes send those files to the grep command.
Files on UNIX are stored in directories. These are much like the directories on a PC or folders on a Mac. When you log on to your UNIX account, you are placed in your "home directory." Within your home directory you can have other directories, called "sub-directories." These sub-directories can also have other directories within them.
Directories make organizing your files easy. You can put all of your data files in one directory and all your programs in another, or, you can have a directory for each class you are taking. The term "path" is often used to refer to directories and their subdirectories.
cd soc453will make soc453 your current or working directory. If you give the ls command, you will see a list of files in that directory. Any new files you create will, by default, be created in that directory. If you issue the command:
cd ..
you will move up one level in the directory structure, to what
is called the parent directory. In this example, the parent directory would be your home
directory. You can return to your home directory at any time by issuing
the cd command with no operands:
cd
mkdir thesisOr issue the following command to make a subdirectory named programs with the directory soc453:
mkdir soc453/programs
Before printing, you must determine which printer you want to use; not all printers are capable of printing from UNIX. Also, check the size of the file before you print it to avoid uneccesary use of paper and toner. To see a list of available printers, issue the command:
printers -L | more
This will give you a list of printers and their locations, as well as the alias by which you can refer to them. Once you have identified the printer you want to use, issue the lpr command
lpr -P [printeralias] [filename]
where printeralias is the alias for a printer and filename is the name of the file you would like to print. For example:
lpr -P nslaser test.do
will print a file named test.do, to nslaser, a printer in New South Building.
Your UNIX account has a certain amount of space in which you can store files. The following command will show you how much space you are given ("quota") and how much you are currently using ("usage").
quota -v
Running out of space is a common reason why you cannot create, copy or transfer new files into your account. Files created or modified when you are at or over your quota may be corrupted! There is a buffer space (the difference between your quota and your "limit"). However, this is small and only temporary. If you do not clear space that is over your quota, you will lose files. See below for solutions if you need more space.
Sometimes you may need extra space for just a short time, say to edit a very large file. You can access temporary storage in the /scratch directory. To do this, simply issue the command:
mkdir /scratch/[userid]
where userid is your userid. Be sure to use the slash (/) in front of scratch.
Now you can cd to this new directory and work with files in it just as you would in your own account. The system automatically erases files in the scratch directory 24 hours after they were last modified, so be careful not to leave anything important there.
If you find that you need more space on a permanent basis, then you can apply for a larger quota. Although there is a charge involved, academic departments will pay it for students who require the space for their research. See your department's undergraduate or graduate secretary. You can pick up the application at OIT (87 Prospect Ave) then get your department to authorize it.
There are several text editors available on UNIX. Among these are vi, emacs, and pico. Which one you use is a matter of personal preference. Try each and see what suits your needs best. Pico is similar to the editor used in the mail program, Pine, so if you already use Pine, Pico may be a good choice.
You can get help on any command in UNIX by using the following command:
man [command]
where command is the command with which you need help. For example, to get information on the copy command, cp, your would type:
man cp
If you do not know the command you want you can type
man -k [keyword]
where keyword is a topic rather than a specific command. You can also use the Internet to look up UNIX man pages.