0% found this document useful (0 votes)
24 views

What Is A File Unix

A file is a package of information with a name that is stored on a disk and persists after logging out. Files can contain data or programs and there is a limit to the total size of files that can be stored based on a user's quota. A stream is any sequence of characters that can come from or go to various sources like files, keyboards, or devices. A process is the execution of a program or command that transforms input streams into output streams. To execute a process, a user enters a command at the shell prompt. Commands can accept optional command line arguments to provide more information. The output of one command can be piped directly into the input of another command using the pipe symbol.

Uploaded by

harrry123654
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

What Is A File Unix

A file is a package of information with a name that is stored on a disk and persists after logging out. Files can contain data or programs and there is a limit to the total size of files that can be stored based on a user's quota. A stream is any sequence of characters that can come from or go to various sources like files, keyboards, or devices. A process is the execution of a program or command that transforms input streams into output streams. To execute a process, a user enters a command at the shell prompt. Commands can accept optional command line arguments to provide more information. The output of one command can be piped directly into the input of another command using the pipe symbol.

Uploaded by

harrry123654
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

What is a file?

A file is a package of information with a name attached to it.

Your files stay around after you have logged out.


Files are used for various purposes:
o Files can record data, such as text or numbers.
o Some files record ways to perform various processing procedures on
data. These are referred to as programs or commands.
Conceptually, a file is a sequence of characters, which resides somewhere on
a disk.
Files take up space on disk, so there is a limit to how many characters of files
you can store. This limit is called your quota; use the command quota -v to
check your limit.

What is a stream?
In the discussion of files, we learned that a file is a sequence of characters stored on
a disk.
The Unix operating system defines a slightly more general concept:
A stream is any sequence of characters.
An input stream can come from a file, from a keyboard, from a process, or
from any other device (such as a scanner or a network).
An output stream can be destined for a file, for a display, or to any other
device (such as a printer or a network)

What is a process?
In general, a Unix process is one execution of a program or command.
Every process transforms one or more input streams into one or
more output streams.
For example, if you use a word processor to produce a document, the word
processor is converting your keystrokes into a file (a stored representation of
the document). In this case the input stream is from the keyboard and the output
is to a file.
When you print the file, you are converting that file (as an input stream) into a
printed representation---the output stream goes to the printer.
Whenever you type a Unix command, you are creating a process to carry out
the work of that command

Executing a process
To execute a process under Unix:
1. Your terminal should display the shell prompt. It looks like this:
yourname@yourcomputer<18>%

2. Type the name of the command. For example, there is a date command that
tells you the current date and time. Here is how your screen might look after
you use this command:
3.
4.

yourname@yourcomputer<19>% date
Sat Jan 28 14:20:38 MST 1995

yourname@yourcomputer<20>%

What is a command line


argument?

Many Unix commands allow command line arguments, that is, additional words or
phrases that follow the name of the command and give more information about what
to do.
For example, the man command will give you information about any Unix command.
To get information about the date command, for example, you can type:
yourname@yourcomputer<21>% man date

A command can have any number of arguments. For example, the cat command
concatenates any number of files. Suppose you want to display the contents of three
files named names, dates, and addresses on your display screen. This command would
do it:

yourname@yourcomputer<22>% cat names dates addresses

Using pipelines
Suppose you want to take the output of some command, call it first, and use that
stream as the input of another command called second. This can be done via
redirection:
yourname@yourcomputer<28>% first >temp
yourname@yourcomputer<29>% second <temp

The output of the first command is redirected to a temporary file named temp, and
then the input of the second command is redirected from file temp.
We can do the same thing with a pipeline like this:
yourname@yourcomputer<30>% first | second

The pipe (|) symbol placed between two commands tells Unix to take the output
produced by the commands before the pipe symbol and make that the input of the
commands after the pipe symbol.

You might also like