By UNIX convention, default stdin (standard input) is your keyboard, and default stdout (standard output) is your display. stderr (standard error) also defaults to the display.
UNIX makes extensive use of hierarchical inverted-tree directory structures. The path to any directory or file is defined from the root directory (/). Subsequent / characters in a path separate directory and subdirectory names, e.g., /home/grumpy/myfiles/.... Note that this separator is not the same as the PC separator "\".
UNIX file names can be pretty much any practical length. Avoid names containing spaces or other reserved characters, or you will have to surround these with quotation marks. The . (period) character has no special meaning in a file name unless it is the first character in the name, which causes it to be hidden from routine directory listings. A UNIX file named "my.big.file.txt" isn't any problem within UNIX, although if it is transferred to a PC, Windows will rename it "my_big_file.txt". The underscore character "_" is commonly used in multi-word filenames in both UNIX and Windows. Unlike Windows, UNIX filenames are case-sensitive: MY_FILE.TXT, My_File.txt and My_file.txt would all be different files. It's easiest to stick with lower-case characters when naming UNIX files.
The pwd ("print working directory") command prints the path of your current directory to stdout
The ls command lists the files and subdirectories in your current directory. The command ls -l includes a "flag" that makes the ls command print a longer listing including file and subdirectory permissions, ownerships, file sizes for each entry in the current directory. ls -a lists all files, including "hidden" files whose names begin with a period such as .cshrc and .login (these are two files in your home directory which set default paths, environment variables, command aliases, etc.). You can usually combine the flags associated with a command: e.g., ls -al prints a long listing of all files. You can list the contents of any other directory if you specify the correct path to it: ls -l /home/grumpy/otherfiles.
Here's a sample line from a long directory listing (ls -l):
-rwxr-xr-x 1 johnmack other 1287 Feb 5 1996 rainbow.gif
The leftmost character in each line of a long listing
tells you whether the directory entry is an ordinary file (-), subdirectory
(d) link (l) or other special file. The next nine characters indicate
the presence or absence of read (r), write (w) and execute (x)
permissions for three classes of user: owner, other group members
and all other users. An absent permission is marked with a hyphen
(-). The following fields indicate number of links to this file,
the individual owner, the group owner, the file size in bytes, the
date the file was last modified (or created) and the file name.
You can change permissions on files you own with the chmod ("change mode") command. Here's the quickest way: a read permission is represented by a 4; a write permission by a 2; an execute permission by a 1. Each combination of permissions sums to a unique number between 0 (no permissions set) and 7 (all 3 permissions set) for each class of user. So you can set all nine permissions for your file myfile, for example, with the command chmod 754 myfile. This sets read, write and execute permissions for you, read and execute permissions for other group members, and read-only permission for all other users, so the first 10 characters in the long listing are changed to -rwxr-xr--. Obviously you want to be careful about giving write permissions to other users.
If this method of changing permissions doesn't make sense to you, use the man command to read the on-line manual entry for the chmod command, which explains other techniques for changing permissions: man chmod. Every UNIX command has a detailed man entry explaining its syntax, options and usage.
You can use wildcard characters to reference files and directories. The * character represents any string of zero or more characters. The ? character represents any one character. So you could list all files and subdirectories whose names begin with the string dat using the command ls dat* or all files with 4-character names beginning with d using the command ls d???
You can specify square-bracketed ranges of characters to match to: ls [a-f]* lists all files with names beginning with the characters a through f. The command ls *[!a-f] lists all files with names which do not end with the characters a through f.
The command cd /new/directory/path changes your current directory to the absolute path /new/directory/path defined from the root directory /. Typing cd without a path returns you to your home directory. You can reference your home directory as ~ and any other user's home directory as ~username. You can reference the parent of your current directory as .. (2 dots). Relative paths can also be defined: cd ~username/data switches you to the data subdirectory within username's home directory (assuming username has given you permissions to list it). cd ../../otherdir/junk takes you two levels up the directory tree from your current directory, then to otherdir and its subdirectory junk.
The rm command removes (erases) a file. UNIX does not have file undelete capabilities like DOS, so be careful, particularly when using wildcards to remove multiple files.
The cp command copies a file. The command cp myfile /home/grumpy/myotherdir/newfile copies myfile from the current directory as newfile in the (existing) directory myotherdir (assuming there isn't a subdirectory named newfile). The command cp myfile /home/grumpy/myotherdir copies myfile to the directory myotherdir.
The mv command moves (renames) a file in pretty much the same way. Moving and renaming are basically the same thing in UNIX. The command mv myfile newfile renames myfile in the current directory, unless there's already a subdirectory named newfile to which myfile will be moved. The command mv myfile /home/grumpy/myotherdir moves myfile from the current directory to the (existing) subdirectory myotherdir.
The commands mkdir and rmdir create and remove directories. rmdir won't let you remove a directory containing files, but you can remove a directory junkdir and all the files in it with the recursive remove command rm -r junkdir. (Caution: careless misuse of rm -r can really ruin your day!)
The ln command creates a hard link to an existing file on the same device; ln -s creates a symbolic link to a file or directory (which doesn't have to exist) anywhere on the disk system. You can even create symbolic links across file systems.
You can print the contents of any file to stdout in several ways. The command cat myfile prints ("catenates") the entire contents of a myfile. If it's a long file, it will go scrolling by faster than you can read. The command more myfile works like cat, but prints the file one screenful at a time so you can read it all. The Enter key moves you through the file one line at a time; the Spacebar key moves you one screenful at a time. The less command works like more, but has more options like paging backwards.
The command head -12 myfile prints just the first 12 lines of myfile. The command tail -16 myfile prints just the last 16 lines of myfile.
UNIX lets you pipe output from one command or process as input to another command or process. The pipe character is | (vertical bar) . For example, you can pipe the output stream from the cat command to the more command: cat myfile | more
A less trivial example is scanning myfile for lines with a particular character string charstring using the grep ("global regular expression print") utility. The command cat myfile | grep charstring will print only the lines from myfile containing the string charstring. If charstring contains spaces or other special characters, put it in quotes.
UNIX also lets you redirect output with the > character or input with the < character. For example, you could redirect the output of cat to a file rather than to stdout: the command cat myfile > newfile creates a new copy of myfile. Most users will have a "noclobber" option set in their .cshrc file, which prevents a redirection from overwriting an existing version of newfile. You can override this with cat myfile >! newfile. Or you can append the contents of myfile to the stuff already in newfile with the command cat myfile >> newfile.
The command cat < myfile >> newfile does the same thing, using the input redirect as well.
cat can be used concatenate multiple files or parts of files into one (hence its name). For example, the command cat file1 file2 file3 | grep "string" > newfile extracts all lines containing string from the three input files and catenates them into newfile.
The ps command lists running processes. The command ps -au username lists all running processes owned by username. You may occasionally have runaway processes tying up the CPU. You identify process ID's with ps, and then can kill unwanted processes with the kill command, e.g., kill -9 12345 kills (the -9 flag means forcefully) the process with PID 12345.
By default, commands or "jobs" entered at the shell prompt run in foreground, and tie up the shell until completed. But you can run any job in background and free your shell for other simultaneous processes. Appending the & character at the end of a command starts it as a background job and returns you to the shell prompt immediately. You can suspend an already-running foreground job with ctrl-Z and then restart it in background with the bg command, or in foreground with the fg command. The jobs command lists the status of your currently-running jobs.
On an X-terminal, you can also open multiple shell windows to support simultaneous processes.