Fundamentals of Computer Science II (CSC-152 2000F)


Some of the things you wanted to know about Linux, but didn't know where to look

Introductory Notes

This is a ``quick and dirty'' guide to some of the commands and such you'll need in Linux. I've tried to set it up as a quick reference, but I'll also include some narrative materials. Expect changes oer the next few days. Let me know what you want to see!

Note that prompts differ from user to user. I use % as the default prompt.

Common Tasks

To list files in a directory

% ls directory

If you leave out the directory name, the shell assumes the current working directory.

To list files in a directory along with modification times and other information

% ls -l directory

To list files in a directory with the most recent first.

% ls -lt directory

To move a file to another directory

% mv filename directory

Note that the enclosing directory (the parent directory) is called ... Hence, if I have a file in /home/rebelsky/stuff and want to move it to /home/rebelsky, I use "mv filename ..". I can also use "mv filename /home/rebelsky".

To determine the present working directory

% pwd

To remove a file

% rm filename

To rename a file

% mv oldname newname

Some Notes on Directories

Coming soon.

Personal Commands

At times, you'll want to create your own commands (or, more precisely, shorthands for existing commands or combinations of commands). You can write these aliases so that they only exist for one session or so that are more-or-less permanent.

For a short-term alias, you write

% alias shorthand="longer-command"

For example, in CSC152 you might write

% alias compile="/net/jdk1.2.2/bin/javac"
% alias run="/net/jdk1.2.2/bin/java"

Eventually, you'll find that you want those commands to be permanent. To make them permanent, you need to put them in a special file called .bashrc. That file is in your home directory. Open it with an editor and add lines of the previous form.

Some Useful Aliases

Coming soon

History

Monday, 4 September 2000


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2000F/Handouts/linux.html

Source text last modified Mon Sep 4 08:46:35 2000.

This page generated on Mon Sep 4 08:45:58 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu