
 |
Basic Linux Commands 
The Linux operating system is currently very similar to the Microsoft Windows
Operating System. The primary differences are that Linux is free (thus it is
very popular with researchers, universities, and many private corporations), Linux
can run on many different hardware architectures (from servers to microcontrollers),
and Linux is still strongly controlled form the command-line. While most will find
that file management and program execution from the GUI is straight-forward, the
equivalent commands at the terminal will be useful when compiling programs. The
following sections detail basic file management commands and informational tips
that can be executed from the terminal.

 |
File System
The file system of Linux is laid out similarly to that of Microsoft Windows. Both
systems use a tree structure where directories (or folders, as they are called in
Windows) contain files and other folders. Unlike Windows, however, there are no
drive letters. Instead, Linux uses a path system that is similar to a complete
URL path. For example, instead of having the C-drive, the Linux operating system
has the root directory, denoted as "/".
All directories/folders are contained within the root directory. Floppies,
CDs, flash memory devices, and all other removable and non-removable storage
devices are accessed as (what appear to be) subdirectories of the root
directory. For example, the home directory for most CSE students is
"/cs/ /". Since the details of accessing other removable devices
are cryptic and non-intuitive, they will be omitted for the time being, though
they can be researched online and may be covered in later classes.
One additional point of importance to those familiar with the Windows operating
system is that file extensions (e.g. ".exe") are not used. While binary files may be
executed directly, there is no association that tells the operating system to execute,
for example, ".mp3" files with a media player. The program that handles a specific file
must be called directly, with the data file as an argument (if that is how the program
operates).
|
 |

 |
Terminal Commands
All Linux commands can be issued from a terminal window and will be executed by
the system in the current terminal process. While you can have multiple terminal
windows open, it is often useful to understand how to issue commands and what
options ara available to make terminal sessions cleaner and more productive.
The first thing that students should be aware of is that the command-line options
available for use with any given command or program can be accessed by following
the command with the "--help" option, as in:
Another source of information about virtually any aspect of the Linux operating
system - not just commands - is the infamous "man page", or "manual page", for
the command. Most versions of Linux install with the "man pages" automatically, allowing
users to look up information about any installed application, feature, or other question
they may have. The "man pages" are accessed via the man command, followed by the
keyword(s) related the information sought. The following is an example that searches
for information on Xemacs:
One additional point is that programs can be executed from the terminal in two ways. The
first is by simply typing the program name, as in "xemacs". The other option is to execute
the program in a spearate process/window that keeps the current terminal free for use. To
do this, simply end your command with an ampersand ("&"). The following example shows how
to call the Xemacs editor to open a file in another process:
The execution of built-in Linux commands, programs, and applications is accomplished
by simply typing the name of the executable. For user programs, it is often necessary
to specify that the program is located in teh current directory by prefixing the name
of the executable with "./" as in:
|
 |


 |
Accessing Directories
Accessing subdirectories of the current directory (or folder) is a simple task. To change the current
directory location, use the cd command, followed by the directory to which you want
to be, in relation to the current directory. For example, we use the following command
to access a subdirectory of the current directory:
To access the parent directory of the current directory, we simply replace the directory
name with .., as in
You can also change your location to any other directory by specifying the absolute path
of the directory where you want to be. For example, to switch to your web directory from
any location, use the following command:
|
 |
 |
Listing Directory Contents
The contents of any directory may be listed using the ls command. While there are
several arguments that allow you to see the hidden files (those that begin with a ".") and other
information, such as the following:
|
 |
 |
Deleting Files
The removal of files is also done using a simple command: rm. The only required parameter
is the filename that you wish deleted. While many other parameters can be used, such as the "-r"
option to remove directories, the basic usage is:
|
 |
|
|
 |
|
|