Unofficial Cheat Sheet will display the complete name of the current directory. will create a subdirectory immediately beneath your current directory. will the subdirectory you specify the current subdirectory. will display the first ten lines of a text . will show the names of the files you have created in the current directory. This command does not differentiate between files and subdirectories. ls -F will show the names of the files you have created in the current directory. It will place / after the name of each subdirectory. Use ls –sF to display the size of the files. ls -aF

will show the names of all the files in the current directory. You will have created some. Editors will have created others. Computer Services created some when you first received your account. UNIX itself may have created some. Use ll to display files with ownership permissions. Or use ls –lF.

If you specify the name of a directory when you issue the ls command, it will show the files in that subdirectory. cd .. will make the parent of the current directory the new current directory. will copy a file from one location to another. After you use cp, you have two files with the same contents. For example, cp Hello.java cosc111 will copy the file named Hello.java from the home directory to the cosc111 subdirectory, with the same name in both places. cp Hello.java cosc111/Greeting.java will give it a different name in the subdirectory. will move a file from one location to another or will rename a file. For example, mv Hello.java cosc111 will move a file from the home directory to a subdirectory. It will have the same name in the subdirectory as it had in the home directory but it will no longer be in the home directory. mv Hello.java lab1.java will leave the file in the current directory but will give it a new name. lpr will send a file to the printer. Make sure the file is a text file, one that you can load into an editor. For example, lpr Hello.java will print the Java source code you wrote for the lab. lpq requests a status report on specified printer. lpq –P printername. Typing lpq with no options gives info about the default printer only.

Page 1 Unofficial UNIX Cheat Sheet lpstat Use lpstat –o to check the status of the print que. will remove a file. Once it is gone, it can not be "unremoved". You will need to re-create it. will remove a subdirectory. You must first remove all the files in the subdirectory. will display the contents of a text file. The first part of the file will scroll off the top of the screen if the file is too long. will display the contents of a text file. It will pause the display whenever it fills a screen. Hit the space key to scroll. man will display help about the topic you specify. For example, try the following five commands: man cat , man less , man head , man , man man . (man is short for manual.) will display a list of all the Unix commands whose descriptions include the word you specify. For example, apropos copy will show all Unix commands that are associated with copying something, usually files. tail will display the last ten lines of text in a text file. use to search for running processes. (e.g. to search for running SYBYL processes use: ps –ef | sybyl.exe ) ps –u will display username’s running processes/jobs. use this command to change permissions on a file. (Permissions: read r; w; execute x) (User : User u; Group g; Other o; All a)

Examples:

chmod go+r yourfile adds read only priviledge for group and other to yourfile.

chmod o-r yourfile removes read only priviledge from other.

chmod go+rx yourfile adds read and execute permissions for group and other to yourfile. quota Use quota –v to display your disk quota.

Page 2 Unofficial UNIX Cheat Sheet

Use kill PID (process ID #) to stop a running process (e.g. a frozen program or batch job). Use the ps command to the PID. You may only kill your own processes! grep Use grep string filename1 to search for “string” in filename1. clear clears x-window/terminal display Use exit to logoff when using telnet or ssh. Use Desktop > Logout in SGI. chsh Use to change your . For example, use “chsh username /usr/bin/csh” to change your unix shell to c shell. which Useful command for finding the location (directory ) of files on your unix system.

e.g. which csh gives > /usr/bin/csh ssh Secure Shell – Always use secure shell when you telnet to a remote computer. Communications are encrypted! e.g. ssh –X username@remote_host.yourschool.edu will connect to the remote host and prompt you for a password (you will be prompted to accept an encryption keycode only on your initial use of ssh; just answer “yes” if you trust the host). The –X specifier transmits your local display settings for remote use of X-window software.

scp Secure Copy – Useful for encrypted copying of files to a remote host.

e.g. scp intro.txt [email protected]:/usr/people/username/project1

copies intro.txt to /usr/people/username/project1/intro.txt on the remotehost.school.edu.

sftp Secure FTP. Encrypted file transfer program.

e.g. sftp [email protected] connects to the remotehost for secure file transfer. Same commands as ftp. Use binary transfer mode to transfer non-text files. The default is ascii. To switch to binary just type “binary” . Use get to get a file from the remote host. Use put to transfer a file to the remote host. You may use the normal unix commands for examining directory contents (e.g. ls –F and pwd). To exit the program use “bye”.

Page 3