Professional Documents
Culture Documents
CUI GUI
Character User Interface Graphical User Interface
eg., MS-DOS,UNIX eg., LINUX , WINDOWS , MACINTOSH
A file is the basic structure used to store information on the UNIX system.The UNIX file system
provides a logical method for organizing,storing,retreiving,manipulating and information.
A file can store manuscripts and other word processing documents, instructions or programs for
the computer itself, an organized database of business information, a bitmap description of a
screen image, or any other kind of information stored as sequence of bytes on a computer.
Regular Files
Directory Files
Special Files
Explanation ::
Regular Files
As a user, the information that you work with will be stored as an ordinary file.Ordinary
files/Regualr file aggregates of characters that are treated as a unit by the UNIX system.
A Regualr file can contain normal ASCII characters such as text for manuscripts or
programs.Ordinary file can be created, changed, or deletedas you wish.
Directory Files
Directory is a file that holds other files and contain information about the locations and attributes
of these other files.For example a directory includes a list of all the files and sub directories that it
contains, as well as their addresses, characteristics, file types and other attributes.
Basic Commands
# system adimistrator prompt
$ user working prompt
$pwd :: It displays present working directory. (If you login with dwhlabs)
/home/dwhlabs
$banner "tecno"
Administrator Commands
#useradd user1
#password user1
Enter password ::
Retype password ::
ls command options
\ directory
* executable files
- symbolic link file
$ls -r ::It displays files and directories in reverse order.(descending order)
$ls -R:: Itr displays files and directories recursively.
$ls -t :: It displays files and directories based on date and time of creation.
$ls -i :: It displays files and directories along with inode number.
$ls -l :: It displays files and directories in long list format.
file type permission link uname group sizeinbytes date filename
- rw-r 1 tec group 560 nov 3 1:30 sample
d rwxr-wr 2 tec group 430 mar 7 7.30 student
- ordinary file
d directory file
b special block files
c special character file
l symboliclink file
* wild card
Filter Commands
$grep options
$grep -n pattern filename (It displays along with the line number)
Question ?
Q)How to remove blank lines in a file?
A)$grep -v "^$" file1>tmp | mv tmp>file1
Explanation :: Piping concept is used to combine more than one cammand.Here we first identifing
the non blank files in file1 and redirecting the result to tmp (temporary file).This temporary file is
input to the next command. Now we are renaming the tmp into file1.Now check the file1 result
<You will not find any blank lines>
fgrep ::
This command is used to search multiple strings or one string but not regular expression.
eg.$fgrep "unix
>c++
>Data Warehouse" stud
This command is used to search for single or multiple patterns and also regular expressions.
Filter Commands
$ cut :: This command is used to retreive the required fields or characters from a file.
100 Rake
101 Rama
102 Prab
103 Jyos
Delimeters
Default ( Tab )
: , ; * _
$cut options
$ sort :: This command is used to sort the file records in ascending or descending
$sort Options
$ uniq :: This command is used to filter the duplicate lines from a file
Note :: Always the file must be in sorting order.
$uniq Options
Question ::
$ tr :: Translate the character in string1 from stdin into those in string2 in stdout.
$ sed :: This command is used for editing files from a script or from the command line.
if then else
4 Write a script to check the givn number is positive or negative?
5 Write a script to check the given number is even or odd number?
6 Write a script to accept two strings and check the given strings are equal or not?
7 Write a script to delete the given file?
8 Write a script to check the given user is logged in or not?
9 Write a script to check the given type of file?
10 Write a script to open the given file?
case
12 Write a script to check the given type of character?
13 Write a script to create the menu creation?