The Basics of Unix

Here's how to refer to particular directories (or files)

thing is in the current directory.

dir/thing:  thing is in the directory dir, which is in the current directory.

dir/otherdir/thing:  thing is in otherdir, which is in dir, which is in the current directory

~/thing:  thing is in your directory, that is, the directory you're in when you first log in.

/somedir/otherdir/thing:  thing is in otherdir, which is in somedir, which is in the root directory of the entire machine.  In Windows, this would look like "C:\somedir\otherdir\thing," but Unix doesn't use "C:."

.. is the parent directory, as in:  ../thing

Commands

mkdir dirname Make a directory (folder) named dirname, in current directory
cd dirname Go to the directory, in current directory
pwd Print working directory (current directory)
ls List files in current directory
ls -la List files, with all the gory details
mv file newname Move (rename) file to "newname"
mv file dir Move file to the directory dir
cp file newname Copy file to "newname"
cp file dir Copy file to the directory dir
cat file Catalog (print contents of) file
cat > file Create file by typing, or pasting.  End with Ctrl-D
chmod permissions thing Change permissions on a file or directory "thing." 700 means I can do anything and nobody else can do anything:  chmod 700 myDir
rm file Remove file
rmdir dir Remove directory.  It must be empty.
exit exit
Bigger programs you'll want to know about
emacs & Editor
firefox & Browser
xterm & New command-prompt window

 

Neat tricks

Up arrow repeats your last command

!a repeats the last command starting with a (for example).  !! repeats the last command

If you have a file with a weird symbol in its name, or a space -- well, don't, it's a bad idea, but if you do -- put quotes around it:  rm "stupid file.txt"