Basic Linux Procedures

Basic linux Procedures


Introduction

Most computers have a system of organizing information. On unix/linux computers this is done through the creation of files and directories. A file is a place where actual information is stored. For instance email messages, programs, and data are all stored in files. A directory is like a folder in which files are stored. In it you can place files and other directories. When you initially logon to the Meteorology Linux computers or to ISU machine running linux or unix, you are placed in your home directory. This is a place where you can create files, store files and create other directories.

Help

There are a few basic commands that you need in order to work with files and directories. You can read more about any of these commands by entering

man

For instance if you want to read about the “change directory” command, type:

man cd

Directory Commands

The commands used in maniputating directories are:

   command                       action
-----------------       --------------------------------------------
ls directory            lists the contents of a directory
mkdir directory         creates a directory in the current directory
rmdir directory         removes a directory 
cd directory            changes to that directory

In the case of “ls” and “cd” the directory name is optional. If the directory name is omitted, the “ls” command will display the contents of a the current directory. If the directory name is omitted from the “cd” command your home (login) directory will become the current directory. If ” ..” is placed after “ls ” (ls ..) the contents of the parent directory (the directory in which the current directory resides) will be displayed. If ” ..” is placed after “cd ” (cd ..) the parent directory will become the current directory.

In the case of “ls”, “cd” and “rmdir” the directory must be exist in the current directory. In the case of “mkdir” the directory will be created in the current directory. When a directory is removed it must be empty (contain no files).

Excercises: Directory commands

Log on to one of the Meteorology computers by following the procedures for accessing meteorology computers .

View the contents of your home directory:

ls

View the contents of the directory containing your homepage:

ls WWW

Make the homepage directory the current directory:

cd WWW

List the contents of the homepage directory:

ls

List the contents of your home directory:

ls ..

Make your home directory the current directory:

cd ..

List the contents of your home directory:

ls

Exercises: Editing commands

Working with files is no more difficult than working with directories. There are two basic type of files. These are ascii files and binary files. Ascii files are ones that contain information that we can read when we use an editor like “emacs”, “pico” or “vi”. Binary files contain information that are instructions to the computer (compiled computer programs for instance) or data. We will only be concerned here with using ascii files.

First we will learn how to create a file. This is usually done by either copying an existing file, or typing information in through the use of an editor.

An editor is a program that reads and/or creates an ascii file and lets you add or change the contents. The editor we will use is emacs. To start emacs enter:

emacs testname &

at the prompt.

A new window will appear on your screen with the contents of the file “testname” displayed. If the “testname” does not exist in the current directory, a blank file will appear and the file will be created when it is saved. At this point the file can be edited by entering or changing information in the emacs window. Emacs has its own set of commands. At present, we will only be concerned with two of them. These are how to save a file and how to exit emacs:

 Keystrokes        Effect
-------------    ------------
ctrl x ctrl s    Saves a file
ctrl x ctrl c    exits emacs

When entering these commands hold down the ctrl key while you press x and then press either s or c. The ctrl key has to be held down through both successive key strokes. The x is not held down while the last key is entered.


 
Enjoyed this video?
Basic Linux Procedures
"No Thanks. Please Close This Box!"