User Tools

Site Tools


opus:spring2012:smalik2:unixpart1

unix Keywords

THIS IS THE LIST –

The following is a list of the major topics being covered in this course:

DONE: Local host
DONE: Remote host
DONE: Home directory
DONE: Current working directory
DONE: Types of files (regular, directory, special)
DONE: File manipulation
DONE: Text Processing
DONE: The VI editor
DONE: The UNIX Shell
DONE: Environment variable
DONE: $PATH
DONE: wildcards
DONE: tab completion
DONE: Job Control
DONE: The UNIX Programming Environment
DONE: Compiler, Assembler, Linker, Loader
DONE: Source Code, Object Code, Binary Code, Library
DONE: Pattern Matching
DONE: Regular Expressions
DONE: Filtering
DONE: Shell Scripting
DONE: networking, UNIX Networking Tools
DONE: Security
DONE: X Window System

1: File manipulation

Definition

The ability to control files, such as moving them, removing them, copying them, organizing them.

Demonstration

In this command line sample, you can see me moving files between directories, or for the sake of renaming, copying files, making directories, and removing a file. All of this is file manipulation.

lab46:~$ cd src/cprog
lab46:~/src/cprog$ ls
Feb14    Feb2.c    JAN26_printf_examples.c  JAN31_pointers3.c
Feb14.c  Feb7.c    JAN26_printf_pointers.c  MessingAround
Feb16    Feb7x0.c  JAN31_pointers.c         Projects
Feb16.c  Feb9.c    JAN31_pointers2.c        out.txt
lab46:~/src/cprog$ cd MessingAround
lab46:~/src/cprog/MessingAround$ ls
Algorithm.c   RepetitiveDoWhile.c  files    numbers.txt  pointers
Repetitive.c  RepetitiveWhile.c    files.c  output.txt   pointers.c
lab46:~/src/cprog/MessingAround$ rm files
rm: remove regular file `files'? y
lab46:~/src/cprog/MessingAround$ mv pointers lookitrenamed
lab46:~/src/cprog/MessingAround$ cp lookitrenamed lookanothercopy!!
cp lookitrenamed lookanothercopymv pointers lookitrenamed
cp: target `lookitrenamed' is not a directory
lab46:~/src/cprog/MessingAround$ cp lookitrenamed lookanothercopy
lab46:~/src/cprog/MessingAround$ mkdir lookanewdirectory
lab46:~/src/cprog/MessingAround$ mv lookitrenamed lookanewdirectory
lab46:~/src/cprog/MessingAround$ ls
Algorithm.c          RepetitiveWhile.c  lookanothercopy  pointers.c
Repetitive.c         files.c            numbers.txt
RepetitiveDoWhile.c  lookanewdirectory  output.txt
lab46:~/src/cprog/MessingAround$ cd lookanewdirectory
lab46:~/src/cprog/MessingAround/lookanewdirectory$ ls
lookitrenamed
lab46:~/src/cprog/MessingAround/lookanewdirectory$ 

2: Home directory

Definition

The home directory is your default directory. Whenever you open up a cmd prompt this is the file location that you start at.

Demonstration

So here, you can see that right when I log into lab46 my home directory is denoted by ~$. Using the pwd command (to show the full file structure) reveals that my home directory is at /home/smalik2

saad@saad-Satellite-P775:~$ ssh smalik2@lab46.corning-cc.edu
smalik2@lab46.corning-cc.edu's password: 
 __         _     _ _   __   . . . . . . . . . . . . . . . . . . . . . . . . .
|  |   __ _| |__ / | |_/ /   . Basic System Usage:  Type 'usage' at prompt   .
|  |__/ _` | '_ \\_  _/ _ \  . Events and News:     Type 'news' at prompt    .
|_____\__,_|_.__/  |_|\___/  . Broken E-mail?       Type 'fixmail' at prompt .
---------------------------  . Check Lab46 Mail:    Type 'alpine' at prompt  .
c o r n i n g - c c . e d u  . . . . . . . . . . . . . . . . . . . . . . . . .

 Lab46 is the Computer & Information Science Department's Student Development
 Server for Computer-related coursework, projects, and exploration.  For more
 information, please check out:
  .. .  .    .        .                .                .        .    .  . ..
 .  Lab46 Web Page:       http://lab46.corning-cc.edu/                       .
 .  Lab46 Help Form:      http://lab46.corning-cc.edu/help_request           .
 .  Help E-mail:          haas@corning-cc.edu or wedge@lab46.corning-cc.edu  .
  .. .  .    .        .                .                .        .    .  . ..
      _        
  .-./*)       
_/___/   `.    
  U U      'You can delete files with the 'rm' command.'
No mail.
Last login: Fri Feb 17 19:09:50 2012 from cpe-69-205-204-88.stny.res.rr.com
lab46:~$ pwd
/home/smalik2
lab46:~$ 

In this example, you can see me moving to a different directory using the cd command. The cd command with no argument takes you back to your home directory.

lab46:~$ pwd
/home/smalik2
lab46:~$ cd src/cprog/Projects
lab46:~/src/cprog/Projects$ pwd
/home/smalik2/src/cprog/Projects
lab46:~/src/cprog/Projects$ cd
lab46:~$ pwd
/home/smalik2
lab46:~$ 

3: Current working directory

Definition

The current working directory is the directory that you're in.

Demonstration

The current working directory is basically the directory that you are in. The cd command with no arguments will change your current working directory to your home directory.

The pwd command reveals the current working directory.

lab46:~$ pwd
/home/smalik2
lab46:~$ 

4: Types of files (regular, directory, special)

Definition

There are three types of files, regular files (such as .txt), directories (technically a file with other file locations in it), and special files (a directory is a type of special file, or C programs).

Demonstration

In the example we see that there are regular files, which are the .c files, directories, and then the special files (the compile C code).

lab46:~$ cd src/cprog
lab46:~/src/cprog$ ls
Feb14    Feb2.c    JAN26_printf_examples.c  JAN31_pointers3.c
Feb14.c  Feb7.c    JAN26_printf_pointers.c  MessingAround
Feb16    Feb7x0.c  JAN31_pointers.c         Projects
Feb16.c  Feb9.c    JAN31_pointers2.c        out.txt
lab46:~/src/cprog$ 

5: Local Host

Definition

The device that is running the session.

Demonstration

My laptop is running Ubuntu. The terminal on my laptop screen is an example of a local host, because my device (the laptop) is what the services are being ran on.

6: Remote Host

Definition

A remote host is a device that is running services remotely.

Demonstration

My laptop is connected to lab46.corning-cc.edu via ssh, which is an example of a remote host.

7. The VI editor

Definition

The VI editor is a text editor where in one mode you can always insert, and in another mode you enter commands. To toggle command mode you hit escape, and to enter insert mode you push i when in command mode.

Demonstration

lab46:~/src/cprog$ vim Hello.txt
lab46:~/src/cprog$ cat Hello.txt
I couldn't type until I hit I to enter insert mode.

Now, to exit VI editor (and save the work) I will hit the ESCAPE key to enter command mode, from there I will type :wq to quit and save my work.  If I didn't want to save, I would use :q!
lab46:~/src/cprog$ 

After typing vim Hello.txt, this appeared on my screen.

I couldn't type until I hit I to enter insert mode.

Now, to exit VI editor (and save the work) I will hit the ESCAPE key to enter command mode, from there I will type :wq to quit and save my work.  If I didn't want to save, I would use :q!
~                                                                               
~     

8: Text Processing

Definition

Manipulating text

Demonstration of the chosen keyword.

You can print the contents of a file using the cat command. You can manipulate text using many things. The nano and vim text editors are really good for editing text based files.

Just nano filename.txt or vim to open the editor.

unix Objective

unix Objective

Familiarity with the structure of UNIX systems.

Definition

Basically this means that I will become much more familiar with how UNIX systems look like, like the file structure and whatnot.

Method

If I can tell if a system is based off the UNIX system based on the file structure.

Measurement

I think I can do this pretty well, as I can recognize that mobile phones (such as my android powered phone and my previous iPhone) are based off of UNIX because of their file structure. They have the files named var, usr, bin, and others.

Analysis

I think I did pretty well. Not particularly, unless if there is some other discrepancy that I am unaware of. I don't think so. If there was a quick description associated with the objective.

opus/spring2012/smalik2/unixpart1.txt · Last modified: 2012/05/10 01:12 by smalik2