Академический Документы
Профессиональный Документы
Культура Документы
OS Page 1
Enrollment No: [enter your number] Practical - 1
OS Page 2
Enrollment No: [enter your number] Practical - 1
OS Page 3
Enrollment No: [enter your number] Practical - 1
OS Page 4
Enrollment No: [enter your number] Practical - 1
Description: By default uname writes the operating system name to standard output.
When options are specified, one or more system characteristics are written to standard
OS Page 5
Enrollment No: [enter your number] Practical - 1
output. When more than one options is specified the output is in the order specified by the
-1 option below.
OS Page 6
Enrollment No: [enter your number] Practical - 1
2. The File-System:
OS Page 7
Enrollment No: [enter your number] Practical - 1
OS Page 8
Enrollment No: [enter your number] Practical - 1
Decription: you can move around in the file system the cd command. When used with
argument, it changes the current directory to the directory specified us as the argument.
Description: for each directory argument ls lists the Contents; for each file argument
the name and requested Information are listed. The current directory is listed if no file
argument appear. The listing is sorted by file name by default, except that file arguments
are listed before directory.
OS Page 9
Enrollment No: [enter your number] Practical - 1
Options :
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print octal escapes for nongraphic characters
--block-size=SIZE use SIZE-byte blocks
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information)
with -l: show ctime and sort by name
OS Page 10
Enrollment No: [enter your number] Practical - 1
OS Page 11
Enrollment No: [enter your number] Practical - 1
Description: command copies a file or group of files. It creates an exact image of the
file on the disk with a different name. The syntax requires at least two file names. When
both are ordinary files first is copied to the s
OS Page 12
Enrollment No: [enter your number] Practical - 1
OS Page 13
Enrollment No: [enter your number] Practical - 1
OS Page 14
Enrollment No: [enter your number] Practical - 1
OS Page 15
Enrollment No: [enter your number] Practical - 1
OPTIONS:
(1)-L, --lines : count the lines.
(2)-w, --words : count the words.
(3)-c, --bytes/chars : count the bytes.
OS Page 16
Enrollment No: [enter your number] Practical - 1
OS Page 17
Enrollment No: [enter your number] Practical - 1
OS Page 18
Enrollment No: [enter your number] Practical - 1
Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
Operator Description
+ adds the specified modes to the specified classes
- removes the specified modes from the specified classes
= the modes specified are to be made the exact modes for the specified classes
The second way to modify permissions with the chmod command is to use
a number to specify each set of permissions for the file.
Each permission is assigned a value, as the following table shows, and the
total of each set of permissions provides a number for that set.
OS Page 19
Enrollment No: [enter your number] Practical - 1
0 No permission
---
1 Execute permission
--x
2 Write permission -w-
Execute and write permission: 1 (execute) + 2 (write) =
3 -wx
3
4 Read permission r--
5 Read and execute permission: 4 (read) + 1 (execute) = 5 r-x
6 Read and write permission: 4 (read) + 2 (write) = 6 rw-
7 All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 rwx
5. Simple filters:
OS Page 20
Enrollment No: [enter your number] Practical - 1
Short Long
Option Description
Option Option
-c –bytes to print N bytes from each input file.
-n –lines to print N lines from each input file.
–silent, – Prevent printing of header information that
-q
quiet contains file name
-v –verbose to print header information always.
OS Page 21
Enrollment No: [enter your number] Practical - 1
Short Long
Option Description
Option Option
-c –bytes to print last N bytes from each input file
-f –follow to print appended data as and when the file grows
-n –lines to print last N lines from each input file
–pid with -f, to terminate after PID dies
–silent, –
-q to prevent printing of header information
quiet
to keep retrying to open a file even when it is not exist
–retry
or becomes inaccessible. Useful when it is used with -f
–sleep-
-s to sleep for N seconds between iterations
interval
-v –verbose to print header information always
Options:
–C : Extracting bytes rather than lines
Options:
Cutting columns: to extract specific columns , we need to follow the –c
option with a list of columns numbers , delimited by a comma. Ranges can also be
used with hyphen. For example following command extracts the name from the
shortlist file. Cut can also be used with multiple ranges as follows which gives
columns from 6 to 15 and 22 to 26. And here 30- shows columns number 30 to
the end of the line.
OS Page 22
Enrollment No: [enter your number] Practical - 1
Cutting fields: -c option is useful for fixed length lines. But suppose now we
want to cut 2 and 3 fields from our file then we can use –f option. For example
following command cuts 2 and 3 fields from our file. We have to use –d option to
specify the delimiter. In our file fields delimiter is symbol that we have specified
in double quotes. And we have to use –f option to specify field list.
Options :
-tchar : uses delimiter char to identify fields
-k n : sort in nth field
-k m,n : starts sort on mth field and ends sort on nth field
-k m.n : starts sort on nth columns of mth field
-u : removes repeated lines
-n : sorts numerically
OS Page 23
Enrollment No: [enter your number] Practical - 1
Examples : here –t option is used to specify the delimiter. Sort uses space as the
default separator.
Orting on primary key (-k) : let’s now use –k option to sort on the second
field(name)
Following command reverse the previous sorting order.
We can sort more than one key. If the primary key is the third field and secondary key is
the second field then we can use the following command where –k 3,3 indicates that sort
starts on third field and ends on the same field.
OS Page 24
Enrollment No: [enter your number] Practical - 1
Now we want to sort this file and want to remove the duplicate lines. For that we can use
the following command which sorts the designation file and uniq removes the duplicate
lines and puts the data in output file.
Options :
-u, --unique Only print unique lines.
-d, --repeated Only print duplicate lines.
-c, --count Print the number of times each line occurred along with the line
Options :
Complement the set of characters in string1, that is "-C ab" includes every character
-C
except for 'a' and 'b'.
OS Page 25
Enrollment No: [enter your number] Practical - 1
Squeeze multiple occurrences of the characters listed in the last operand (either
-s string1 or string2) in the input into a single instance of the character. This occurs
after all deletion and translation is completed.
Conclusion:
OS Page 26