Post on 15-Sep-2020
UNIT-II
2. Basics of Operating System
2.1 Introduction
Modern general-purpose computers, including personal computers and
mainframes, have an operating system to run other programs, such as application
software. Examples of operating systems for personal computers include Microsoft
Windows, Mac OS (and Darwin), UNIX, and LINUX. The lowest level of any
operating system is its kernel. This is the first layer of software loaded into
memory when a system boots or starts up. The kernel provides access to various
common core services to all other system and application programs. These services
include, but are not limited to: disk access, memory management, task scheduling,
and access to other hardware devices. As well as the kernel, an operating system is
often distributed with tools for programs to display and manage a graphical user
interface (although Windows and the Macintosh have these tools built into the
operating system), as well as utility programs for tasks such as managing files and
configuring the operating system. They are also often distributed with application
software that does not relate directly to the operating system‘s core function,
various camps advocate micro-kernels, monolithic kernels, and so on. Operating
systems are used on most, but not all, computer systems. The simplest computers,
including the smallest embedded systems and many of the first computers did not
have operating systems. Instead, they relied on the application programs to manage
the minimal hardware themselves, perhaps with the aid of libraries developed for
the purpose. Commercially-supplied operating systems are present on virtually all
modern devices described as computers, from personal computers to mainframes,
as well as mobile computers such as PDAs and mobile phones.
Why Use Operating Systems
An operating system (OS) is a software program that manages the hardware and
software resources of a computer. The OS performs basic tasks, such as controlling
and allocating memory, prioritizing the processing of instructions, controlling
input and output devices, facilitating networking, and managing files. The first
computers did not have operating systems. However, software tool for managing
the system and simplifying the use of hardware appeared very quickly afterwards
and gradually expanded in scope. By the early 1960s, commercial computer
vendors were supplying quite extensive tools for streamlining the development,
scheduling, and execution of jobs on batch processing systems. Examples were
produced by UNIVAC and Control Data Corporation, amongst others. Through the
1960s, several major concepts were developed, driving the development of
operating systems. The development of the IBM System/360 produced a family of
mainframe computers available in widely differing capacities and price points, for
which a single operating system OS/360 was planned (rather than developing ad-
hoc programs for every individual model). This concept of a single OS spanning an
entire product line was crucial for the success of System/360 and, in fact, IBM‘s
current mainframe operating systems are distant descendants of this original
system; applications written for the OS/360 can still be run on modern machines.
OS/360 also contained another important advance: the development of the hard
disk permanent storage device (which IBM called DASD). Another key
development was the concept of timesharing: the idea of sharing the resources of
expensive computers amongst multiple computer users interacting in real time with
the system. Time sharing allowed all of the users to have the illusion of having
exclusive access to the machine; the Multics timesharing system was the most
famous of a number of new operating systems developed to take advantage of the
concept. Commercially-popular minicomputer operating system was VMS. One
notable early operating system was CP/M, which was supported on many early
microcomputers and was largely cloned in creating MS-DOS, which became
wildly popular as the operating system chosen for the IBM PC (IBM‘s version of it
was called IBM-DOS or PC-DOS), its successors making Microsoft one of the
world‘s most profitable companies. The major alternative throughout the 1980s in
the microcomputer market was Mac OS, tied intimately to the Apple Macintosh
computer. By the 1990s, the microcomputer had evolved to the point where, as
well as extensive GUI facilities, the robustness and flexibility of operating systems
of larger computers became increasingly desirable. Microsoft's response to this
change was the development of Windows NT, which served as the basis for
Microsoft‘s entire operating system line starting in 1999. Apple rebuilt their
operating system on top of a UNIX core as Mac OS X, released in 2001. Hobbyist-
developed reimplementation‘s of UNIX, assembled with the tools from the GNU
project, also became popular; versions based on the Linux kernel are by far the
most popular, with the BSD derived UNIX holding a small portion of the server
market. The growing complexity of embedded devices has a growing trend to use
embedded operating systems on them.
Note: Multics was an inspiration to a number of operating systems developed in
the 1970s, notably UNIX.
Present Scenario
Command line interface (or CLI) operating systems can operate using only the
keyboard for input. Modern OS‘s use a mouse for input with a graphical user
interface (GUI) sometimes implemented as a shell. The appropriate OS may
depend on the hardware architecture, specifically the CPU, with only Linux and
BSD running on almost any CPU. Windows NT has been ported to other CPUs,
most notably the Alpha, but not many. Mainframe computers and embedded
systems use a variety of different operating systems, many with no direct
connection to Windows or UNIX, but typically more similar to Unix than
Windows. Personal computers IBM PC compatible - Microsoft Windows and
smaller Unix-variants (like Linux and BSD) Apple Macintosh - Mac OS X,
Windows, Linux and BSD Mainframes - A number of unique OS‘s, sometimes
Linux and other UNIX variants. Embedded systems - a variety of dedicated OS‘s,
and limited versions of Linux or other OS‘s.
Unix-like
The UNIX-like family is a diverse group of operating systems, with several major
subcategories including System V, (Berkeley Software Distribution) BSD, and
Linux. The name ―UNIX‖ is a trademark of the open group which licenses it for
use to any operating system that has been shown to conform to the definitions that
they have cooperatively developed. The name is commonly used to refer to the
large set of operating systems which resemble the original UNIX systems run on a
wide variety of machine architectures. They are used heavily as server systems in
business, as well as workstations in academic and engineering environments. Free
software UNIX variants, such as Linux and BSD, are increasingly popular.
They are used in the desktop market as well, for example Ubuntu, but mostly by
hobbyists. Some UNIX variants like HP‘s HP-UX and IBM‘s AIX are designed to
run only on that vendor‘s proprietary hardware. Others, such as Solaris, can run on
both proprietary hardware and on commodity x86 PCs. Apple‘s Mac OS X, a
microkernel BSD variant derived from next step, mach, and free BSD, has replaced
Apple‘s earlier (non-UNIX) Mac OS. Over the past several years, free UNIX
systems have supplanted proprietary ones in most instances. For instance, scientific
modeling and computer animation were once the province of SGI‘s IRIX, present
scenario they are dominated by Linux-based. The team at bell labs who designed
and developed UNIX went on to develop and inferno, which were designed for
modern distributed environments. They had graphics built-in, unlike UNIX
counterparts that added it to the design later did not become popular because,
unlike many UNIX distributions.
Note: The first microcomputers did not have the capacity or need for the elaborate
operating system that had been developed for mainframes and minis; minimalistic
operating systems were developed.
Microsoft Windows
The Microsoft Windows family of operating systems originated as a graphical
layer on top of the older MS-DOS environment for the IBM PC. Modern versions
are based on the newer Windows NT core that first took shape in OS/2 and
borrowed from open VMS. Windows runs on 32-bit and 64-bit Intel and AMD
computers, although earlier versions also ran on the DEC alpha, MIPS, and power
PC architectures (some work was done to port it to the SPARC architecture). As of
2004, Windows held a near-monopoly of around 90% of the worldwide desktop
market share, although this is thought to be dwindling due to the increase of
interest focused on open source operating systems. It is also used on low-end and
mid-range servers, supporting applications such as web servers and database
servers. In recent years, Microsoft has spent significant marketing and R&D
money to demonstrate that Windows is capable of running any enterprise
application.
Operating System
Operating system (OS) is the lifeline of computer. You connect all the basic
devices like CPU, monitor, keyboard and mouse; plug in the power supply and
switch it on thinking you have everything in place. But the computer will not start
or come to life unless it has an operating system installed in it because OS −
Keeps all hardware parts in a state of readiness to follow user instructions
Co-ordinates between different devices
Schedules multiple tasks as per priority
Allocates resource to each task
Enables computer to access network
Enables users to access and use application software
Besides initial booting, these are some of the functions of an operating system −
Managing computer resources like hardware, software, shared resources, etc.
Allocating resources
Prevent error during software use
Control improper use of computer
One of the earliest operating systems was MS-DOS, developed by Microsoft for
IBM PC. It was a Command Line Interface (CLI) OS that revolutionized the PC
market. DOS was difficult to use because of its interface. The users needed to
remember instructions to do their tasks. To make computers more accessible and
user-friendly, Microsoft developed Graphical User Interface (GUI) based OS
called Windows, which transformed the way people used computers.
An operating system is an important part of almost every computer system. A
computer system can be divided roughly into four components: the hardware, the
operating system, the application programs, and the users (Figure below).
Figure : Abstract view of the components of a computer system.
The hardware-the central processing unit (CPU), the memory, and the input/output
(110) devices-provides the basic computing resources. The application programs-
such as word processors, spreadsheets, compilers, and web browsers-define the
ways in which these resources are used to solve the computing problems of the
users. The operating system controls and coordinates the use of the hardware
among the various application programs for the various users. The components of a
computer system are its hardware, software, and data.
The operating system provides the means for the proper use of these
resources in the operation of the computer system operating systems can be
explored from two viewpoints the user and the system.
Note: Since the early 1990s the choice for personal computers has been largely
limited to the Microsoft windows family and the UNIX-like family, of which Linux
and Mac OS are becoming the major choices.
Functions of Operating System
As you know, operating system is responsible for functioning of the computer
system. To do that it carries out these three broad categories of activities −
Essential functions − Ensures optimum and effective utilization of
resources
Monitoring functions − Monitors and collects information related to system
performance
Service functions − Provides services to users
Let us look at some of the most important functions associated with these
activities.
Processor management
Managing a computer’s CPU to ensure its optimum utilization is called processor
management. Managing processor basically involves allocating processor time to
the tasks that need to be completed. This is called job scheduling. Jobs must be
scheduled in such a way that −
There is maximum utilization of CPU
Turnaround time, i.e. time required to complete each job, is minimum
Waiting time is minimum
Each job gets the fastest possible response time
Maximum throughput is achieved, where throughput is the average time
taken to complete each task
There are two methods of job scheduling done by operating systems −
Preemptive scheduling
Non-Preemptive scheduling
Preemptive Scheduling
In this type of scheduling, next job to be done by the processor can be scheduled
before the current job completes. If a job of higher priority comes up, the processor
can be forced to release the current job and take up the next job. There are two
scheduling techniques that use pre-emptive scheduling –
Round robin scheduling − A small unit of time called time slice is defined
and each program gets only one time slice at a time. If it is not completed
during that time, it must join the job queue at the end and wait till all
programs have got one time slice. The advantage here is that all programs
get equal opportunity. The downside is that if a program completes
execution before the time slice is over, CPU is idle for the rest of the
duration.
Response ratio scheduling − Response ratio is defined as
ElapsedTimeExecutiontimereceivedElapsedTimeExecutiontimereceived
A job with shorter response time gets higher priority. So a larger program may
have to wait even if it was requested earlier than the shorter program. This
improves throughput of the CPU.
Non-preemptive Scheduling
In this type of scheduling, job scheduling decisions are taken only after the current
job completes. A job is never interrupted to give precedence to higher priority jobs.
Scheduling techniques that use non-preemptive scheduling are –
First come first serve scheduling − This is the simplest technique where
the first program to throw up a request is completed first.
Shortest job next scheduling − Here the job that needs least amount of time
for execution is scheduled next.
Deadline scheduling − The job with the earliest deadline is scheduled for
execution next.
Memory Management
Process of regulating computer memory and using optimization techniques to
enhance overall system performance is called memory management. Memory
space is very important in modern computing environment, so memory
management is an important role of operating systems.
As you know, computers have two types of memory – primary and secondary.
Primary memory is fast but expensive and secondary memory is cheap but
slower. OS has to strike a balance between the two to ensure that system
performance is not hurt due to very less primary memory or system costs do not
shoot up due to too much primary memory.
Input and output data, user instructions and data interim to program execution need
to be stored, accessed and retrieved efficiently for high system performance. Once
a program request is accepted, OS allocates it primary and secondary storage areas
as per requirement. Once execution is completed, the memory space allocated to it
is freed. OS uses many storage management techniques to keep a track of all
storage spaces that are allocated or free.
Contiguous Storage Allocation
This is the simplest storage space allocation technique where contiguous memory
locations are assigned to each program. OS has to estimate the amount of memory
required for the complete process before allocation.
Non-contiguous Storage Allocation
As the name suggests, program and associated data need not be stored in
contiguous locations. The program is divided into smaller components and each
component is stored in a separate location. A table keeps a record of where each
component of the program is stored. When the processor needs to access any
component, OS provides access using this allocation table.
In a real-life scenario primary memory space might not be sufficient to store the
whole program. In that case, OS takes the help of Virtual Storage technique,
where program is physically stored in secondary memory but appears to be stored
in primary memory. This introduces a miniscule time lag in accessing the program
components. There are two approaches to virtual storages –
Program paging − A program is broken down into fixed size pageand
stored in the secondary memory. The pages are given logical address or
virtual address from 0 to n. A page table maps the logical addresses to the
physical addresses, which is used to retrieve the pages when required.
Program segmentation − A program is broken down into logical units
called segments, assigned logical address from 0 to n and stored in
secondary memory. A segment table is used to load segments from
secondary memory to primary memory.
Operating systems typically use a combination of page and program segmentation
to optimize memory usage. A large program segment may be broken into pages or
more than one small segments may be stored as a single page.
File Management
Data and information is stored on computers in form of files. Managing file system
to enable users to keep their data safely and correctly is an important function of
operating systems. Managing file systems by OS is called file management. File
management is required to provide tools for these file related activities −
Creating new files for storing data
Updating
Sharing
Securing data through passwords and encryption
Recovery in case of system failure
Device Management
The process of implementation, operation and maintenance of a device by
operating system is called device management. Operating system uses a utility
software called device driver as interface to the device.
When many processes access the devices or request access to the devices, the OS
manages the devices in a way that efficiently shares the devices among all
processes. Processes access devices through system call interface, a programming
interface provided by the OS.
Security
Security module protects the resources and information of a computer system
against destruction and unauthorized access.
Command Interpretation
Command interpretation module takes care of interpreting user commands, and
directing system resources to process the commands. With this mode of interaction
with a system, users are not much concerned about hardware details of the system.
Types of Operating System
There are generally four types, categorized based on the types of computers they
control and the sort of applications they support. The categories are real-time
operating system, single user single task, and single user multitasking and multi-
user.
Real-Time Operating System (RTOS)
Real-time operating systems are used to control machinery, scientific instruments
and industrial systems such as embedded systems (programmable thermostats,
household appliance controllers), industrial robots, spacecraft, industrial control
(manufacturing, production, power generation, fabrication, and refining), and
scientific research equipment. A real time operating system typically has very little
user-interface capability, and no end-user utilities, since the system will be a
―sealed box‖ when delivered for use. A very important part of an RTOS is
managing the resources of the computer so that a particular operation executes in
precisely the same amount of time, every time it occurs. In a complex machine,
having a part move more quickly just because system resources are available may
be just as catastrophic as having it not move at all because the system is busy.
A RTOS facilitates the creation of a real-time system, but does not guarantee
the final result will be realtime; this requires correct development of the software.
A RTOS does not necessarily have high throughput; rather, an RTOS provides
facilities which, if used properly, guarantee deadlines can be met generally (soft
real-time) or deterministically (hard real-time). A RTOS will typically use
specialized scheduling algorithms in order to provide the real-time developer with
the tools necessary to produce deterministic behavior in the final system. A RTOS
is valued more for how quickly and/or predictably it can respond to a particular
event than for the given amount of work it can perform over time. Key factors in
an RTOS are therefore a minimal interrupt latency (the time between the
generation of an interrupt by a device and the servicing of the device which
generated the interrupt) and a minimal thread switching latency (the time needed
by the operating system to switch the CPU to another thread).
Single User, Single Task
The name implies, this operating system is designed to manage the computer so
that one user can effectively do one thing at a time. The palm OS for palm
handheld computers is a good example of a modern single-user, single-task
operating system.
Single User, Multitasking
This is the type of operating system most people use on their desktop and laptop
computers today. Microsoft's windows and Apple's Mac OS platforms are both
examples of operating systems that will let a single user have several programs in
operation at the same time. For example, it's entirely possible for a windows user
to be writing a note in a word processor while downloading a file from the Internet
while printing the text of an e-mail message.
Multi-user
Multi-user defines operating system or application software that allows concurrent
access by multiple users of a computer. A multi-user operating system allows
many different users to take advantage of the computer‘s resources simultaneously.
The operating system must make sure that the requirements of the various users are
balanced, and that each of the programs they are using has sufficient and separate
resources so that a problem with one user does not affect the entire community of
users. UNIX, VMS and mainframe operating systems, such as MVS, are examples
of multi-user operating systems. Time-sharing systems are multi-user systems.
Most batch processing systems for mainframe computers may also be considered
―multi-user‖, to avoid leaving the CPU idle while it waits for I/O operations to
complete.
Popular Operating Systems
Initially computers had no operating systems. Every program needed full
hardware specifications to run correctly as processor, memory and device
management had to be done by the programs themselves. However, as
sophisticated hardware and more complex application programs developed,
operating systems became essential. As personal computers became popular
among individuals and small businesses, demand for standard operating system
grew. Let us look at some of the currently popular operating systems −
Windows − Windows is a GUI operating system first developed by
Microsoft in 1985. The latest version of Windows is Windows 10.
Windows is used by almost 88% of PCs and laptops globally.
Linux − Linux is an open source operating system mostly used by
mainframes an supercomputers. Being open source means that its code is
available for free and anyone can develop a new OS based on it.
BOSS − Bharat Operating System Solutions is an Indian distribution of
Linux based on Debian, an OS. It is localized to enable use of local Indian
languages. BOSS consists of −
o Linux kernel
o Office application suite BharteeyaOO
o Web browser
o Email service Thunderbird
o Chat application Pidgim
o File sharing applications
o Multimedia applications
Mobile OS
An operating system for smart phones, tablets and other mobile devices is
called mobile OS. Some of the most popular OS for mobile devices includes−
Android − This Linux-based OS by Google is the most popular mobile OS
currently. Almost 85% of mobile devices use it.
Windows Phone 7 − It is the latest mobile OS developed by Microsoft.
Apple iOS − This mobile OS is an OS developed by Apple exclusively for
its own mobile devices like iPhone, iPad, etc.
Blackberry OS − This is the OS used by all blackberry mobile devices like
smart phones and playbooks.
Window Operating System
Windows 7
Windows 7 is an operating system that Microsoft has produced for use on personal
computers. It is the follow-up to the Windows Vista Operating System, which was
released in 2006. An operating system allows your computer to manage software
and perform essential tasks. It is also a Graphical User Interface (GUI) that allows
you to visually interact with your computer’s functions in a logical, fun, and easy
way.interact with your computer’s functions in a logical, fun, and easy way.*
The first screen appear after you turn on the power of computer is a desktop
• If it is a shared PC; more than one user use it, or one user with password
protected, you will arrive at Welcome Screen
or
1 - The Desktop
The Desktop is the main Windows 7 screen (see image below). It is the work area
where dialog boxes, windows, icons,and menus appear. Like an office desk, the
Windows 7 desktop contains items you can use to do your job. For instance, from
your desktop, you can perform file-management tasks and run software
applications. You can customize the appearance of the desktop to suit your
preferences.
Desktop Icons
The Desktop is where you’ll find icons (small pictures) for many of your most
frequently used programs. You’ll most likely see icons for Computer, Documents,
Recycle Bin, and Internet Explorer.
Computer – Allows you to see what drives are attached to your computer (for
example, your local hard disk drive, your CD/DVD drives, any networked shared
drives, and external drives, such as a USB flash drive). You can also view the files
that are located on these drives.
Documents– Supplies a ‘catch-all’ place for your personal files. Within here you
can see your files, any shared files from other computer users and any music or
pictures you may have stored. The Documents folder will sometimes be identified
by your name instead of the word “Documents.”
Recycle Bin– Stores any files you delete until you empty it.
Internet Explorer – Contains Windows’ built in web browser that integrates with
other Windows components (such as your folders and Documents).
The Desktop Components
The desktop for Windows 7 consists of two main components
1. Desktop that contains many components like icons "file, folder, shortcut. Etc…)
2. Task Bars
Desktop Components
1- Icons: An icon is a graphic image, a small picture or object that represents a
file, program, web page, or command. Icons help you execute commands, open
programs or documents quickly. To execute a command by using an icon, click or
double-click on the icon. It is also useful to recognize quickly an object in a
browser list. For example, all documents using the same extension have the same
icon.
We can classify icons as the following
• Folder Icons • File Icons • Shortcut Icons
Folder Icons File Icons Shortcut Icons
What is the difference between a file, a folder, and a shortcut?
All the data on your hard drive consists of files and folders. The basic difference
between the two is that files store data, while folders store files and other folders.
The folders, often referred to as directories, are used to organize files on your
computer. The folders themselves take up virtually no space on the hard drive.
Files, on the other hand, is a collection of data. stored in one unit, identified by a
filename. And filename period file extension can range from a few bytes to several
gigabytes. They can be documents, programs, libraries, and other compilations of
data. File name consists of two part name and extension
A shortcut is a link that points to a program on the computer. Shortcuts allow users
to create links to their programs in any folder, Start bar, Taskbar, Desktop or other
locations on their computer. A shortcut in Windows is commonly identified by a
small arrow in the bottom corner of the icon.
Special Icons on the desktop
• Recycle bin:
The Recycle Bin is a location (Folder) where deleted files are temporarily stored on
Microsoft Windows. The Recycling Bin allows users to recover files that have been
deleted in Windows.
• My Computer:
My Computer allows the user to explore the contents of their computer drives as
well as manage their computer files. Once My Computer is open you'll see all
available drives on your computer. For most users, you'll only be concerned with
the Local Disc (C:) drive, which is the hard drive and what stores all your files.
Icon Operations
• Arrange Icons On the Desktop
To change the arrangement of icons on the desktop do the following
1 - Right Click the desktop
2- Click Sort by
3- Select one of the 4 options to arrange icons from sub-menu
• View/Hide Icons
1- Right Click the desktop
2- 2- Click View
3- 3- Check to see if Auto Arrange has a check mark
4- 4- If it does uncheck it
• Change Icon size
1- Right Click the desktop
2- 2- Click View
3- 3- Show the required size
1- Right Click the desktop
2- Click View
3- Show the required size
• Auto Arrange Icon
1 - Right Click the desktop
2- Click View
3- Check to see if Auto Arrange has a check mark
4- If it does uncheck it
Start Menu Parts
The Start menu for Windows 7 consists of many Parts, to show Use the Start menu
to do these common activities:
• Start programs
• Open commonly used folders
• Search for files, folders, and programs
• Adjust computer settings
• Get help with the Windows operating system
• Turn off the computer
• Log off from Windows or switch to a different user account
Shutting Down the computer
At the bottom of the right pane is the Shut down button. Click the Shut down
button to turn off your computer. Clicking the arrow next to the Shut down button
displays a menu with additional options for switching users, logging off, restarting,
or shutting down.
• Switch user: If you have more than one user account on your computer,
Fast User Switching is an easy way for another person to log on to the
computer without logging you off or closing your programs and files.
• Log off: When you log off from Windows, all of the programs you were
using are closed, but the computer is not turned off.
• Lock: Locking your PC is a good option if you’ll be back soon. You'll
have to enter your password when you come back, which helps keep your
work more secure.
• Restart: The Restart button "reboots" your computer (it is sometimes
called a "warm boot" or "soft boot.") That means it saves your information
to the hard drive, turns off the computer for a moment, and then turns it back
on again.
• Sleep: Clicking on Sleep puts your computer in a low-power state, but
doesn't turn it off. The main advantage is that it allows you to get back to
work quickly, without having to wait for the computer to do a full reboot
Working with Windows
Whenever you open a program, file, or fo lder, it appears on your screen in a box or
frame called a window (that's where the Windows operating system gets its name).
Because windows are everywhere in Windows, it's important to understand how to
move them, change their size, or just make them go away. Parts of a window
Although the contents of every window are different, all windows share some
things in common. For one thing, windows always appear on the desktop - the main
work area of your screen. In addition, most windows have the same basic parts.
• Title bar. Displays the name of the document and program (or the folder
name if you're working in a folder).
•Minimize, Maximize, and Close buttons. These buttons hide the window,
enlarge it to fill the whole screen, and close it, respectively (more details on
these shortly).
• Menu bar. Contains items that you can click to make choices in a
program.
• Scroll bar. Let’s you scroll the contents of the window to see information
that is currently out of view.
• Borders and corners. You can drag these with your mouse pointer to
change the size of the window.
Moving a window
To move a window, point to its title bar with the mouse pointer . Then drag the
window to the location that you want. (Dragging means pointing to an item,
holding down the mouse button, moving the item with the pointer, and then
releasing the mouse button.)
Changing the size of a window
• To make a window fill the entire screen, click its Maximize button or double-
click the window's title bar.
• To return a maximized window to its former size, click its Restore button of the
Maximize button). Or, double-click the window's title bar. • To resize a window
(make it smaller or bigger), point to any of the window's borders or corners. When
the mouse pointer changes to a two headed arrow (see picture below), drag the
border or corner to shrink or enlarge the window.
• A window that is maximized cannot be resized. You must restore it to its
previous size first.
Hiding a window
• Hiding a window is called minimizing it. If you want to get a window out of the
way temporarily without closing it, minimize it.
• To minimize a window, click its Minimize button. The window disappears from
the desktop and is visible only as a button on the taskbar, the long horizontal bar at
the bottom of your screen.
• To make a minimized window appear again on the desktop, click its taskbar
button. The window appears exactly as it did before you minimized it.
Closing a window
• Closing a window removes it from the desktop and taskbar. If you're done with a
program or document and don't need to return to it right away, close it.
• To close a window, click its Close button
• If you close a document without saving any changes you made, a message
appears that gives you the option to save your changes.
Switching between windows
If you open more than one program or document, your desktop can quickly
become cluttered with windows. Keeping track of which windows you have open
isn’t always easy, because some windows might partially or completely cover
others.
Using the taskbar.
The taskbar provides a way to organize all of your windows. Each window has a
corresponding button on the taskbar. To switch to another window, just click its
taskbar button. The window appears in front of all other windows, becoming the
active window—the one you're currently working in.
To easily identify a window, point to its taskbar button. When you point to a
taskbar button, you'll see a thumbnail-sized preview of the window, whether the
content of the window is a document, a photo, or even a running video. This
preview is especially useful if you can't identify a window by its title alone.
• Using Alt +Tab. You can switch to the previous window by pressing
Alt+Tab, or cycle through all open windows and the desktop by holding
down Alt and repeatedly pressing Tab. Release Alt to show the selected
window.
• Using Aero Flip 3D. Aero Flip 3D arranges your windows in a
threedimensional stack that you can quickly flip through. To use Flip 3D:
• Hold down the Windows logo key & and press Tab to open Flip 3D.
Dialog boxes
A dialog box is a special type of window that asks you a question, allows you to
select options to perform a task, or provides you with information. You'll often see
dialog boxes when a program or Windows needs a response from you before it can
continue.
Unlike regular windows, most dialog boxes can't be maximized, minimized, or
resized. They can, however, be moved.
Understanding the parts of a window
When you open a folder or library, you see it in a window. The various parts of this
window are designed to help you navigate around Windows or work with files,
folders, and libraries more easily. Here's a typical window and each of its parts:
Window part What it's useful for
Navigation pane: Use the navigation pane to access libraries, folders, saved
searches, and even entire hard disks. Use the Favorites section to open your most
commonly used folders and searches; use the Libraries section to access your
libraries. You can also expand Computer to browse folders and subfolders.
Back and Forward buttons: Use the Back button and the Forward button to
navigate to other folders or libraries you've already opened without closing the
current window. These buttons work together with the address bar; after you use
the address bar to change folders.
Toolbar: Use the toolbar to perform common tasks, such as changing the
appearance of your files and folders, burning files to a CD, or starting a digital
picture slide show. The toolbar's buttons change to show only the tasks that are
relevant.
Address bar: Use the address bar to navigate to a different folder or library or to
go back to a previous one. Library pane The library pane appears only when you
are in a library (such as the Documents library). Use the library pane to customize
the library or to arrange the files by different properties.
Column headings: Use the column headings to change how the files in the file list
are organized. For example, you can click the left side of a column heading to
change the order the files and folders are displayed in, or you can click the right
side to filter the files in different ways. (Note that column headings are available
only in Details view.
File list: This is where the contents of the current folder or library are displayed. If
you type in the search box to find a file, only the files that match your current view
(including files in subfolders) will appear.
Search box: Type a word or phrase in the search box to look for an item in the
current folder or library. The search begins as soon as you begin typing—so if you
type "B," for example, all the files with names starting with the letter B will appear
in the file list.
Details pane Use the details pane to see the most common properties associated
with the selected file. File properties are information about a file, such as the
author, the date you last changed the file, and any descriptive tags you might have
added to the file.
Preview pane: Use the preview pane to see the contents of most files. If you select
an e-mail message, text file, or picture, for example, you can see its contents
without opening it in a program. If you don't see the preview pane, click the
Preview pane button in the toolbar to turn it on.
Viewing and arranging files and folders
When you open a folder or library, you can change how the files look in the
window. For example, you might prefer larger (or smaller) icons or a view that lets
you see different kinds of information about each file. To make these kinds of
changes, use the Views button in the toolbar.
Each time you click the left side of the Views button, it changes the way your files
and folders are displayed by cycling through five different views: Large Icons,
List, a view called Details that shows several columns of information about the
file, a smaller icon view called Tiles, and a view called Content that shows some of
the content from within the file.
If you click the arrow on the right side of the Views button, you have more
choices. Move the slider up or down to fine tune the size of the file and folder
icons. You can see the icons change size as you move the slider.
Working with file and folder
1. Selecting • Single object
To select a single object, click on it once.
• |Multiple object
There are several ways to select Multiple files or folders.
• To select a consecutive group of files or folders, click the first item, press
and hold down the Shift key, and then click the last item.
• To select Multiple files or folders that are near each other, drag the mouse
pointer to create a selection around the outside of all the items that you want
to include.
• To select non-consecutive files or folders, press and hold down the Ctrl
key, and then click each item that you want to select.
• To select all of the files or folders in a window, on the toolbar, click
Organize, and then click Select all. If you want to exclude one or more
items from your selection, press and hold down the Ctrl key, and then click
the items.
Notes: After selecting files or folders, you can perform many common tasks,
such as copying, deleting, renaming, printing, and compressing. Simply
right-click the selected items, and then click the appropriate choice.
2. Rename
• Click the file or folder to select it.
• Click the organize button on the toolbar, and then click Rename.
• With the name selected highlights, type a new name, or click to position
the insertion point, and then edit the name.
• Press Enter
Notes:
• Right-click the file or folder you want to rename, click Rename, type a
name, and then press Enter.
• You can also select the file, then press F2, type a name, and then press
Enter.
• File names can be up to 255 characters. You can use spaces and
underscores in names, but you can’t use the following characters: * : < > | ?
“ \ or /. Remember the best way to keep your files organized is with a
consistent naming convention.
3. Copying
When you copy an item, the original item remains in its original location—
plus you have the new copy
• Open the location that contains the file you want to copy.
• Right-click the file, and then click Copy.
• Open the location where you want to store the copy.
• Right-click an empty space within the location, and then click Paste. The
copy of the original file is now stored in the new location.
Notes:
• Another way to copy and paste files is to use the keyboard shortcuts
Ctrl+C (Copy) and Ctrl+V (Paste).
• You can also press and hold the right-mouse button and then drag the file
to the new location. When you release the mouse button, click Copy here.
4. Moving (cut)
Moving a file (or folder) is different from copying it. Moving cuts the item
from its previous location and places it in a new location. Copying leaves the
original item where it was and creates a copy of the item elsewhere. In other
words, when you copy something you end up with two of it. When you
move something, you only have the one thing.
• Open the drive or folder containing the file or folder you want to move.
• Select the files or folders you want to move.
• Click the Organize button on the toolbar, and then click Cut.
• Display the destination folder where you want to move the files or folder.
• Click the Organize button on the toolbar, and then click Paste.
Copy or Move a File or Folder Using Drag and Drop
• Open the drive or folder containing the file or folder you want to copy or
move.
• Select the files or folders you want to copy or move.
• In the Navigation pane, point to a folder list to display the expand and
collapse arrows.
• Click the arrows to display the destination folder, and then click the
destination folder.
• Right-click the selected files or folders, drag to the destination folder, and
then click Copy Here or Move Here.
Notes:
To move the selected items, drag them to the destination folder. To copy the
items, hold down the Ctrl key while you drag.
Another way to copy and paste files is to use the keyboard shortcuts Ctrl+X
(Cut) and Ctrl+V (Paste). Pay attention to pop-up messages that appear
when dragging—you can use these to find out what will happen when you
release the mouse button.
5. Create a Folder
• Open the drive or folder where you want to create a folder.
• Click the New folder button on the toolbar.
• With the New Folder name selected, type a new name.
• Press Enter.
Notes:
Right-click a blank area on the desktop or in the folder window, point to New, and
then click Folder.
6. Deleting
• Select the file or folder.
• Click the Organize button and select Delete from the pull-down menu.
• After you select delete a confirmation message appears.
Notes:
• You can also delete a file or folder by press right click on the item and then
click delete.
• Or press Del buttons on the keyboard.
• The easiest way to delete on the desktop by drag and drop it to recycle Bin.
• When you delete a file or folder from your hard disk, it's not deleted right
away. Instead, it's stored in the Recycle Bin until the Recycle Bin is emptied.
• If you delete a file or folder from a network folder or from a USB flash
drive, it might be
permanently deleted rather than being stored in the Recycle Bin.
• If a file cant be deleted, it might be in use by a program that's currently
running. Try closing the program or restarting your computer to fix the
problem. For more information.
Note: To permanently delete a file without first moving it to the Recycle Bin, select
the file, and then press Shift + Delete.
Permanently delete files from the Recycle Bin
• When you delete a file, it's usually moved to the Recycle Bin so that you
can restore the file later if necessary.
• To permanently remove files from your computer and reclaim any hard
disk space they were using, you need to delete the files from the Recycle
Bin. You can delete individual files from the Recycle Bin or empty the
entire Recycle Bin at once.
1. Open the Recycle Bin by double-clicking the Recycle Bin on the desktop.
2. Do one of the following:
• To permanently delete one file, click it, press Delete, and then click Yes.
• To delete all of the files, on the toolbar, click Empty the Recycle Bin, and
then click Yes.
Notes:
• You can empty the Recycle Bin without i £ Empty Recycle Bin opening it
by right-clicking the Recycle Bin and then clicking Empty Recycle Bin. •
You can permanently delete a file from your computer without sending it to
the Recycle Bin by clicking the file and then pressing Shift + Delete.
Restore item from recycle Bin
• Open the Recycle Bin by double-clicking the Recycle Bin on the desktop.
• Do one of the following:
• To restore a file, click it, and then, on the toolbar, click Restore this item.
• To restore all of the files, make sure that no files are selected, and then, on
the toolbar, click Restore all items.
• The files will be restored to their original locations on your computer.
7. Opening an existing file or folder
• To open a file, double-click it. The file will usually open in the program
that you used to create or change it. For example, a text file will open in
your word-processing program.
8. Search for a file and folder
Windows provides several ways to find files and folders. There isn't one best
way to search—you can use different methods for different situations.
A. Use the search box on the Start menu
You can use the search box on the Start menu to find files, folders, programs, and
e-mail messages Stored on your computer.
• Click the Start button and then type a word or part of a word in
the search box.
• Search result appear as soon as you start typing in the search box.
as you start typing in the search box. As you type, items that match your text will
appear on the Start menu. The search results are based on text in the file name, text
in the file, tags, and other file properties.
B. Use the search box in a folder or library
Browsing for the file might mean looking through hundreds of files and subfolders.
To save time and effort, use the search box at the top of the open window.
The search box filters the current view based on text that you type. The search
looks for text in the file name and contents; and in the file properties, such as in
tags. In a library, the search includes all folders included in the library as well as
subfolders within those folders. To search for a file or folder by using the search
box:
• Type a word or part of a word in the search box.
• As you type, the contents of the folder or library are filtered to reflect each
successive character you type. When you see the file that you want, stop
typing.
For example, now, suppose that you're looking for your invoice files, so you type
"invoice11 in the search box. As you type, the view is automatically filtered and
you see something like this:
Notes:
• You can use a question mark (?) as a wildcard for a single character and
an asterisk (*) as a wildcard for any number of characters.
• The easiest way to start search window is by press F3
• I f you know which file type it is, you can just enter the file extension
("JPG" for example) in the search box.
• You can also use other techniques in the search box to quickly narrow
down a search. For example, if you're searching for a file based on one or
more if its properties (such as a tag or the date the file was last modified),
you can use search filters to specify the property in your search. Or, you can
type keywords in the search box to narrow down your results even further.
Working with Control Panel
You can use Control Panel to change settings for Windows. These settings control
nearly everything about how Windows looks and works, and you can use them to
set up Windows so that it's just right for you.
• Open Control Panel by clicking the Start button and then clicking
Control Panel.
• You can display Control Panel screen with different view types as follow
Open control Panel by
There are two ways to find Control Panel items: o Use search: To find a setting
you're interested in or a task you want to perform, type a word or phrase in the
search box. For example, type "sound" to find specific settings for your sound card,
system sounds, and the volume icon on the taskbar. o Browse: you can explore
Control Panel by clicking different categories (for example, System and Security,
Programs, or Ease of Access), and viewing common tasks listed under each
category or, under View by, click either Large icons or Small icons to view a list
of all Control Panel items.
• The following table gives you a description of all the Control Panel
categories, including the various programs you can find by clicking each
category’s hyperlink*.
Category Name . . . To Display These Groups of Links
System and Security Action Center, Windows Firewall, System, Windows Update, Power
Options, Backup and Restore, BitLocker Drive Encryption, and Administrative Tools
User Accounts User Accounts, Windows Cardspace, Credential Manager, and Mail (32-bit)
Network and Internet
Network and Sharing Center,
Homegroup, and Internet Options
Appearance and Personalization Personalization, Display, Desktop Gadgets, Taskbar and Start Menu, Ease
of Access Center, Folder Options, and Fonts
Hardware and Sound Devices and Printers, AutoPlay, Sound,
Power Options, Display, and Windows Mobility
Center
Clock, Language, and Region Date and Time, and Region and Language
Programs Programs and Features, Default
Programs, and Desktop Gadgets
Ease of Access Ease of Access Center and Speech Recognition
Change desktop background (wallpaper)
Your desktop background (also called wallpaper) can be a digital picture from your
personal collection or one that comes with Windows. You can also select a color
for your desktop background or use a color to frame your background picture.
Windows comes with lots of desktop background choices.
• To change the desktop background
1. Open Desktop Background by clicking the Start button, clicking Control
Panel, clicking Appearance and Personalization, clicking Personalization, and
then clicking Desktop Background.
2. Click the picture or color you want for your desktop beck ground. If the picture
you want to use is not in the list of desktop background pictures, click the Picture
location down arrow to view other categories, or click Browse to search for the
picture on your computer. When you find the picture you want, double-click it. It
will become your desktop background and appear in the list of desktop
backgrounds.
3. Under How should the picture be positioned, choose to have the picture fit the
screen, tile, or be centered on the screen, and then click OK.
Note: You can make any picture stored on your computer (or a picture you are
currently viewing) your desktop background by rightclicking the picture, and then
clicking Set as Desktop Background.
Change screen saver
Windows comes with several screen savers. You can also create your own screen
savers from personal pictures you've saved on your computer, or some software
companies might develop additional screen savers for download or purchase.
To change a screen saver
1. Open Screen Saver Settings by clicking the Start button, clicking
Control Panel, clicking Appearance and Personalization, clicking
Personalization, and then clicking Screen Saver.
2. Under Screen saver, in the drop-down list, click the screen saver you
want to use.
3. Click Preview to see what your chosen screen saver will look like.
4. Click OK.
Note:
• To clear a screen saver, move your mouse or press any key.
• You can change wallpaper and screen saver by right click on the desktop
and then choose personalize
How to use the taskbar
You can customize the taskbar, including the way taskbar buttons look, how they
group together when you have more than one window open, change where the
taskbar is on your desktop, and decide what icons and apps are on it.
Linux/Unix Operating System
Classification of UNIX/Linux
UNIX is a Multi-User/Multi-Tasking operating system and exists in many
different versions (“derivates”): Solaris, AIX, XENIX, HP-UX, SINIX, Linux.
Operating system (OS): Sum of all programs which are required to operate a
computer and which control and monitor the application programs.
Essential features UNIX
• has been originally written in the programming language C, and is therefore a
classical platform for C-programs. UNIX contains well suited environments
for program development (C, C++, Java, Fortran, ...).
• is mainly used for scientific-technical applications on mainframes and
workstations, but has become, because of Linux, also popular for classical PC-
applications throughout the last years.
• is perfectly suited for application in networks. Larger systems and networks
require an administrator.
• offers various alternatives for the solution of most tasks. The multitude of
commands (more than in any other OS) are brief and flexible.
• is originally command-line oriented, but can be used via a graphical user
interface (X Window system).
Linux is available (also via internet) in different distributions (S.u.S.E., Fedora,
Debian etc.). Meanwhile there is a variety of direct-start (live) systems, which can
be started, without installation, directly from CD or other bootable storage devices
(Knoppix, Ubuntu, . . . ). There are also interesting “mini versions” (<100 MB)
designed for a start from USBsticks (e.g., Puppy). The source code of Linux is
free.
2 First steps at the computer
User, logon, logoff
Since UNIX is a multi-user operating system, it can deal with several users
simultaneously. Each user needs a user account.
Each user has a personal environment (home directory, shell), which can be
accessed only by her-/himself (and by the system administrator and those people
who know the password – legitimate or by hacking).
Inside the system the user is identified by his user ID (UID) and his group identity
(group ID, GID).
There are two user types:
• ‘normal’ users with restricted rights and the
• system administrator (root) with all privileges.
The latter is responsible for the installation, configuration and maintenance of the
system as well as the user administration.
Each user has to logon and to logoff from the system (login/logout). Each user
account is protected by a password.
Graphical user interface
Originally, UNIX is command-line oriented. The X Window system enables
convenient interaction via a window-oriented graphical interface, similar to other
OS. The window manager is responsible for the management and display of the
individual windows. Each window manager (and there are a variety of such
managers) can be distinguished by its own Look and Feel (appearance of window
decorations and control devices etc.). Most window managers can be chosen at the
login-menu.
Examples for simple window managers:
• twm: very simple and resource-saving
• mwm: Motif window manager, more common and more advanced
• xfce: convenient, simple, and resource-saving (recommended for use in virtual
machines)
Moreover, almost all Linux distributions provide graphical desktop environments
such as KDE or GNOME, which have a functionality far beyond simple window
managers.
command xterm
Syntax:
xterm [options]
Though there is a graphical interface, UNIX needs the possibility for direct
command input for practical use. Therefore, at least one terminal window needs to
be open. This can be accomplished via the window manager or the desktop
environment (‘console’)
More windows can then be opened with the command xterm.
Generally, all UNIX commands have a variety of options, which usually begin
with -. For the commands which will be introduced in the fo llowing, we will
provide only the most important ones.
Example:
wegner@arber:~ > xterm -geo 80x40 -fn 10x20
The command xterm is called with two options -geo, -fn, which, in this case, need
additional arguments (width and height of window, font name & size).
command man
Syntax:
man command
man -k expression
Displays the manual pages (“man pages”) for the provided command. man -k
searches for man pages containing the expression in the NAME section. A man
page usually consists of the following sections
• NAME command and purpose
• SYNOPSIS syntax of command
• DESCRIPTION of command effect
• FILES which are modified and/or needed
• OPTIONS if present
• EXAMPLE(S) for application (rarely)
• BUGS errors, if known
• SEE ALSO other commands in the same context
command passwd
Syntax:
Passwd
sets a new password.
Passwords should be constructed from a combination of letters, digits and special
characters, and should not appear in any dictionary or similar list. Otherwise, the
password can be hacked by systematic search algorithms.
The command to set/change the password and the required conventions (length,
number of digits/letters/special characters) can vary from system to system. The
following example is a common one, e.g., valid for the workstations at the CIP
Pool (but not for the workstations of the USM).
Example:
wegner@arber: ~ > passwd
Changing password for wegner
Old password: myoldpasswd
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
New password: mynewpasswd
Re-enter new password: mynewpasswd
Password changed.
Command who, whoami
Syntax:
who
whoami
who displays information about all users which are logged into the system
• user name,
• terminal where the corresponding user is working,
• time of login.
whoami is self-explanatory.
Example:
wegner@arber:~ > whoami
arber!wegner pts/5 Oct 20 12:45
Working at external terminals
To login to a distant host, one has to provide the corresponding IP address, either
numerical or as the complete host name name.domain. In local networks (CIP-
Pool), the brief host name (without domain) is sufficient. To establish the
connection and to encrypt the transmitted data, one should use exclusively the so-
called “secure” commands. Avoid ftp and use sftp instead. With ftp, even the
password is not encoded!
command ssh
Syntax:
ssh (-4) -X -l username hostname
ssh (-4) -X username@hostname
Enables logging in to an arbitrary host which can be located via an IP address (if
one knows the user account and the password). Logoff with exit, Ctrl-D or logout.
In case, the option -4 (without brackets) forces an IPv4 connection (if IPv6 is not
working)
Example:
wegner@arber:~ > ssh -X -l wegner lxsrv1.lrz-muenchen.de
Password: mypasswd
Last login: Sun Oct 22 ...
*********************
Mitteilungen
*********************
wegner@lxsrv1:~ > logout
Connection to lxsrv1.lrz-muenchen.de closed.
OR (if connection within “own” cluster)
Example:
wegner@arber:~ > ssh -X wegner@arber
Last login: Sun Oct 22 ...
etc. (keine Passwort-Abfrage)
An additional advantage of the secure shell is that the distant host hostname can
display X applications on the local terminal, without requiring the command xhost
(as in earlier times). For certain hosts, the command ssh requires the option -X to
enable this feature.
command scp
To copy files from one host to another, the command scp (“secure copy”) is used,
see also cp.
Syntax:
scp (-4) file1 username@hostname:file2
scp (-4) username@hostname:file1 file2
The first command copies the local file file1 to the external host under name file2,
the second command vice versa. Note the colon! scp -r enables to copy complete
directories recursively, compare cp -r.
3 File systems
Logics, file types
“In UNIX everything is a file.”The following file-system objects can be found
• ‘normal’ (text-) files
• executable files (binary files or shell scripts)
• directories
• device files
• pipes
• symbolic or hard links (references to files)
All files and file system objects are ordered within a hierarchical file tree with
exactly one root directory ‘/’.
In contrast to the MS-Windows file system, the UNIX file system does not
distinguish between different drives. All physical devices (hard disks, DVD,
CDROM, USB, floppy) are denoted by specific files inside a certain directory
within the file tree (usually within /dev).
File names consist of a sequence of letters, digits and certain special characters,
and must not contain slashes (for convenience, they should neither contain empty
spaces).
Avoid characters which might be interpreted by the shell in a special way. A file
can be referenced within the file tree by either an absolute or a relative path name.
An absolute path name consists of all directories leading to the file and the file
name, and always begins with a / (the root directory).
In many shells and application programs, the tilde denotes the home directory.
command pwd
Syntax:
pwd
displays the current directory.
Example:
wegner@arber:~ > pwd
/home/wegner
wegner@arber:~ >
command cd
Syntax:
cd [directory]
Changes into the given directory, or into the home directory when no parameter is
provided. As in MS-DOS/Windows, “..” denotes the parent and “.” the current
directory.
Example:
wegner@arber:~ > cd /home/puls
wegner@arber:/home/puls > pwd
/home/puls
wegner@arber:/home/puls > cd ..
wegner@arber:/home > pwd
/home
wegner@arber:/home > cd
wegner@arber:~ > pwd
/home/wegner
wegner@arber:~ >
Search pattern for file names
In principle, the shell is a specific program which deals with the interpretation of
input commands. If these commands have parameters which are file names, several
files can be addressed simultaneously by means of a search pattern, which is
expanded by the shell. In any case, the file name expansion is performed prior to
the execution of the command.
expression meaning
* ‘almost’ arbitrary (incl. empty) string of characters
? a single ‘almost’ arbitrary character
[...] a range of characters
[!...] a negated range of characters
‘almost’ arbitrary: leading dot (e.g., hidden files, ../ etc.) excluded
command ls
Syntax:
ls [-alR] [file/directory]
displays the names (and, optionally, the properties) of files or lists the content of a
directory. File and directory names can be be absolute or relative.
Important options
-a list also files/directories which begin with a dot (hidden)
-l long listing format. Displays permissions, user and group, time stamp,
size, etc.
-R for directories, all sub-directories will be displayed recursively.
Example:
wegner@arber:~ > ls
hello* hello.cpp hello.f90 nsmail/
wegner@arber:~ > ls -a
./ .bash_history .netscape/ hello.cpp
../ .bashrc* .ssh/ hello.f90
.Xauthority .history hello* nsmail/
wegner@arber:~ > ls /var/X11R6
app-defaults/ bin/ lib@ sax/
scores/ xfine/ xkb/
wegner@arber:~ > ls .b*
.bash_history .bashrc*
wegner@arber:~ > ls [a-h]*
hello* hello.cpp hello.f90
wegner@arber:~ > ls *.?[9p]?
hello.cpp hello.f90
wegner@arber:~ >
Copy, move and delete files/directories
In addition to ls there are other commands for working with files which can be
used together with file name patterns.
command mkdir, rmdir
Syntax:
mkdir directory
rmdir directory
mkdir creates an empty directory, rmdir deletes an empty directory.
Example:
wegner@arber:~ > ls
hello* hello.cpp hello.f90 nsmail/
wegner@arber:~ > mkdir numerik
wegner@arber:~ > ls
hello* hello.cpp hello.f90 nsmail/ numerik/
wegner@arber:~ > rmdir numerik
wegner@arber:~ > ls
hello* hello.cpp hello.f90 nsmail/
wegner@arber:~ >
command cp
Syntax:
cp file1 file2
cp file1 [file2 ...] directory
cp -r dir1 dir2
cp -r dir1 [dir2 ...] directory
copies files or directories. The original file/directory remains unmodified.
option:
-r directories are copied recursively with all subdirectories.
Several possibilities:
cp file1 file2
file1 is copied to file2. Attention: if file2 already exists, it is overwritten (mostly
without warning), and the original file2 is lost!!!
cp file1 [file2 file3] dir
If dir exists, file1 [, file2, file3] are copied into dir. If dir does not exist, you get
an error warning (for more than two arguments), or, for two arguments, dir is
interpreted as a file name and file1 is copied to a file named dir.
cp -r dir1 dir2
If dir2 already exists, dir1 is recursively copied into dir2. If dir2 does not exist, a
recursive copy of dir1 is created and named dir2.
cp -r dir1 dir2 dir3 dir4
If dir4 already exists, dir1, dir2, dir3 are copied into dir4. If dir4 does not exist,
you get an error warning, as well as for other combinations of files and directories
within the command.
Example:
wegner@arber:~ > ls
hello* hello.cpp hello.f90 nsmail/ numerik/
wegner@arber:~ > cp hello.cpp hello2.cpp
wegner@arber:~ > ls
hello* hello.f90 nsmail/
hello.cpp hello2.cpp numerik/
wegner@arber:~ > cp hello.cpp numerik
wegner@arber:~ > ls numerik
hello.cpp
wegner@arber:~ >
command mv
Syntax:
mv file1 file2
mv file1 [file2 ...] directory
mv dir1 dir2
mv dir1 [dir2 ...] directory
Rename or move files or directories. Similar to cp, but original is ‘destroyed’.
First command from above renames files, other commands move files/directories.
(Actually, only the pointer in the ‘inode table’ is changed, but there is no physical
move – except if you move the file to another file system).
Note: no option [-r] required
Several possibilities, analogue to cp.
Example:
wegner@arber:~ > ls
hello* hello.f90 nsmail/
hello.cpp hello2.cpp numerik/
wegner@arber:~ > mv hello2.cpp hello3.cpp
wegner@arber:~ > ls
hello* hello.f90 nsmail/
hello.cpp hello3.cpp numerik/
wegner@arber:~ > ls numerik
hello.cpp
wegner@arber:~ > mv hello3.cpp numerik
wegner@arber:~ > ls
hello* hello.cpp hello.f90 nsmail/ numerik/
wegner@arber:~ > ls numerik
hello.cpp hello3.cpp
wegner@arber:~ >
command rm
Syntax:
rm [-irf] file(s)/directory(ies)
Delete files and/or directories. After deleting, the deleted files cannot be
recovered! Use rm only with greatest caution. E.g., the command rm -r * deletes
recursively (in most cases without further inquiry) the complete file tree below the
current directory (leaving the hidden files/directories beginning with . though).
Options:
-i delete only after confirmation
-r directories will be recursively deleted (with all subdirectories)
-f force: suppress all safety inquiries.
Note: Varying from system to system, rm without the option -f might need a
confirmation or not (the latter is the standard).
Example:
wegner@arber:~/numerik > ls
hello.cpp hello3.cpp
wegner@arber:~/numerik > rm -i hello3.cpp
rm: remove ‘hello3.cpp’? y
wegner@arber:~/numerik > ls
hello.cpp
wegner@arber:~/numerik >
File permissions/Access rights
The UNIX file system distinguishes between three different access rights or file
mode bits. (Note: actually, there are more access rights, but these are of interest
only for administrators.)
r read: permits the reading of file contents, or, for directories, the listing of their
content.
w write: permits the modification of files (incl. delete). To create or delete files,
the parent directory(ies) need write access as well!
x execute: permits the execution of binary files (commands, programs) and of
shell scripts from the command line. For directories, the x bit is required to change
into this directory and to access the files/directories inside.
Access rights are individually defined for
u the owner of the object
g the group to which the object belongs
o all other users
a all users (i.e., u + g + o)
The access rights of a file can be changed by means of the command chmod.
command chmod
Syntax:
chmod [ugoa][+-=][rwx] file(s)/directory(ies)
Change the access rights of files or directories. These rights are displayed by ls -l
according to the pattern
uuugggooo
rwxrwxrwx
Example:
wegner@arber:~/numerik > ls -l
total 4
-rw-r--r-- 1 wegner stud 100 Oct 20 15:02 hello.cpp
wegner@arber:~/numerik > chmod go+w hello.cpp
wegner@arber:~/numerik > ls -l
total 4
-rw-rw-rw- 1 wegner stud 100 Oct 20 15:02 hello.cpp
wegner@arber:~/numerik >
4 Editing and printing text files
To modify (= edit) the content of a text file, an editor is needed. Within UNIX
there is a variety of editors, which can be distinguished mostly with respect to
ease of use and memory requirements.
The editor vi and vim
vi is the only editor which is present on all UNIX systems. The editor vi
• can be completely keyboard controlled
• is extremely flexible
• rather difficult to learn
vim is a derivate from vi, and can be controlled also by the mouse.
Those of you who enjoy a challenge should learn using this editor.
A somewhat simpler and more convenient alternative, which is also implemented
in (almost) all UNIX systems,is
The editor emacs
The editor emacs works in an own window, and can be controlled (in addition to
keys) by menus and mouse. emacs has rather large memory requirements (no
problem for today’s computers), since this ‘editor’ can do much more than only
editing.
More important commands
a2ps converts ASCII text to PostScript. Often required to print text under Linux.
a2ps [options] textfile
-1, -2, ..., -9 predefined font size and page layout.
E.g., with -2 two pages of text are displayed side-by-side on one
output page.
-o output file (*.ps)
-P NAME send output to printer NAME
diff file1 file2 compares two files. If they are identical, no output.
touch file sets the current time stamp for a file. Can be used to create an empty
file. finger account displays additional information for the
user of a certain account (name of user, project, etc.)
gv datei.ps displays PostScript files and files of related formats (e.g., *.eps, *.pdf).
acroread file.pdf displays pdf files and allows for simple manipulations (e.g., copy
text or figures to the clipboard).
gimp file starts the image manipulation program gimp (similar to photoshop).
Allows to view, manipulate and print image files (e.g., *.jpg, *.tif, *.png).
ps2pdf file.ps converts ps-files to pdf-files. The file file.pdf will be automatically
created.
gzip file. Compresses file via Lempel-Ziv algorithm. The file file.gz is created and
the file file deleted. Typical compression factor 3.
gunzip file.gz. Corresponding decompression.
tar “tape archive”. Nowadays mainly used to create one single file from a file tree,
which then, e.g., can be sent by email. Reverse process also with tar.
tar -cvf direc.tar direc creates (c) file (f) direc.tar from directory direc. Verbose
progress is displayed (v).
tar -xvf direc.tar re-creates original file tree under original name (./direc).
tar -zcvf direc.tgz direc
tar -zxvf direc.tgz additional compression/dekompression via gzip.
Note: This command is extremely ‘powerful’. Either read the man pages, or use
the command as given.