This blog has been designed for QIS COLLEGE OF ENGINEERING AND TECHNOLOGY, MCA Students
Showing posts with label UNIX. Show all posts
Showing posts with label UNIX. Show all posts

Basic UNIX commands

Click the following link view the basic UNIX commands

UNIX Network programming Textbook



This link directs to a good text book on UNIX named "UNIX NETWORK PROGRAMMING by W.Richard

Click the following link to download UNIX Network programming Textbook

UNIX--The Complete Reference

Click the following link to download UNIX complete reference 
 

UNIX important questions

The following important questions are given according to B.Tech UNIX syllabus. We have also all those units as our topics in MCA, but we have more topics than the B.Tech UNIX syllabus. So these all questions are useful to us.

UNIX PROGRAMMING
Unit 1 Important Questions
1. What is a process. List and Explain various process utilities with suitable examples.
2. Explain basic file attributes. Discuss the appropriate commands associated with these attributes.
3. "Operating systems like UNIX provide services both for programs and users". Jus- tify this statement with suitable examples.
4. Explain the significance of the following commands. i. ls - ld ii. ls - l.
5. Give a note on vi editor.
6. What is an operating system? Explain How UNIX fulfills more than that role. Discuss suitable examples.
7. Explain various commands available in UNIX for networking. Discuss suitable examples.
8. Write short notes on:
(a) Unix system services
(b) Shell responsibilities
? Inode block.
9. Define Shell and kernel. Differentiate them.
10. Illustrate the cycle of command execution by Unix. 1. (a) What is the difference between the text editing provided by ‘ed’ & ‘vi’ text editors.
11. What are the two operational modes of vi editor? What is the use of each?
________________________________________
UNIX PROGRAMMING
Unit 2 Important Questions
1. Explain the different approach taken by diff command to display file differences.
2. Describe ‘comm’ command. Explain the output with -1,-2, or -3 options in ‘comm’ command.
3. Which is the command used for ordering a file? Discuss all the options available for this command. For every option Explain with an example.
4. What is a filter in UNIX? Explain any four filters in detail with examples.
5. How to remove duplicate lines from a file using sort?
6. How to count the number of ordinary files in home directory tree?
7. Select lines 5 to 10 of a file in two ways.
8. Discuss the various backup utilities available in UNIX. Ilustrate with suitable ex- amples.
9. Which is the command used for ordering a file? Discuss all the options available for this command. For every option Explain with an example.
10. . Explain awk, tar, cpio with necessary examples.
11. What is the usage of filters?
12. Explain the following filters. more, cmp, tr, uniq.
13. Explain the following Unix shell commands with examples. cut, paste, egrep, fgrep.
14. What is the purpose of cat?
15. When using cat>abc, What happens if abc already contains something?
16. What happens when you use cat abc>abc?
17. Is the output of the following command be directed to the standard output. Cat abc xyz >/dev/tty

________________________________________
UNIX PROGRAMMING
Unit 3 Important Questions
1. Explain about the usage of multiple commands on the shell command line with example.
2. Write a menu driven shell script Which has following options.
i. Contents of /etc/passwd.
ii. List of users who have currently logged in.
iii. Present working directory.
iv. Exit. .
Make use of case statement. The menu should be placed appropriately in the centre of the screen and should be displayed in bold using the tput command. .
3. While executing a shell script either the LOGNAME or the UID is supplied at the command prompt. Write a shell script to find out at How many terminals has this user logged in?
4. Write a shell script to display first n numbers of Fibonacci series.
5. If x has the value 5, and you reassign it with x="expr $x+10", What is the new value of x? What would have been the value if single quotes were used? What’s wrong with all this anyway?
6. Devise a script that accept 2 directory names bar1 and bar2, and deletes those files in bar2 whose contents are identical to their namespaces in bar1.
7. Write a shell script Which reports names and sizes of all files in a directory (directory would be supplied as an argument to the shell script) whose size is exceeding 1000 bytes. The filename should be printed in descending order of their sizes. The total number of such files should also be reported.
8. Write a C program to search for the word ‘exam’ in a Given file, using Com- mand line arguments.
9. Write a shell script to accept a string from the terminal and use ‘case’ to echo a suitable message if the string does not have at least 10 characters using: i. case ii. expr
10. Write a shell script to display the processes in the system five times every 30 seconds using: i. while loop ii. for loop.
11. Write a shell script for the following task. The word ‘unix’ is present in only some of the files supplied as arguments to the shell script. Your shell script should searched each of these files in turn and stop at the first file that it encounters containing the word ‘unix’. This filename should be displayed on the screen.
12. Write a C program Which receives file names as command line arguments and display those filenames in ascending order according to their sizes.
13. Write a shell script Which will receive any number of filenames as arguments. The shell script should check whether every argument supplied is a file or a directory. If it is a directory it should be appropriately reported. If it is a Filename then name of the file as well as the number of lines present in it should be reported.
14. Write a C program to simulate ‘tail’ command.
15. Write short notes on:
(a) program development & debugging commands
(b) necessary commands to carry on day to day activities.
16. Write a shell script to simulate cp command.
17. Write short notes on shell script arguments.
18. Write a shell script to check whether a Given file is a directory. If so, empty the contents of the directory and remove the directory.
19. How do you clean the screen and place the cursor at row 15 and column 20?
20. Write a shell script to find the decimal equivalent of 1101001.

________________________________________
UNIX PROGRAMMING
Unit 4 Important Questions
1. Explain about different conditional exp?ressions available in Bourne shell.
2. Write a shell script Which receives two filenames as arguments. It should check whether the two file’s contents are same or not. If they are same then second file should be deleted. Use ‘cmp’ command to compare files.
3. What is metacharacter? List and Explain about any 7 metacharacters available in unix.
4. Write a shell script Which will receive either the filename or the filename with it’s full path during execution.this script should obtain information about this file as Given by ls - l and display in proper format.
5. What is a shell? What are the responsibilities of a shell?
6. What are the different types of shells available in unix.
7. Write a shell script Which gets executed the moment the user logs in. It should display the message "good morning/good afternoon/good evening" depending upon the time at Which the user logs in.
8. Explain about here documents with an example.
9. Explain following
(a) Shell meta characters
(b) Shell types in Unix
10. What is a loop? Compare and contrast while and until loops.
11. How for loop is used with command line arguments? Explain with a suitable example
12. Write short notes on following commands Trap, export, exit, expr, break, continue
13. Define Unix shell. Explain shell environment.
14. Briefly Explain Different shells available in Unix.

________________________________________
UNIX PROGRAMMING
Unit 5 Important Questions
1. Write a C program to print the type of specified file (Regular, device, directory)
2. Write and Explain about hard and symbolic links.. give an example for each.
3. Explain about file descriptors & i-node?
4. Write the difference between fgetc and getc system calls.
5. Write the syntax of fflush system call give an example.
6. Write about ulink system call and give an example.
7. Write about Write system call and illustrate with an example.
8. Explain the differences between fgets, gets system call.
9. Explain link, unlink, remove and rename functions with syntaxes.
10. What are fflush and fseek functions? Explain.
11. Explain in detail about lseek function.
12. What is fcntl function? What is the purpose of using it?
13. Write the syntax of creat function. Explain, how this function is equivalent to open function.
14. Explain in detail, how an opened file can be positioned.
15. What are stat, fstat and lstat functions? Explain.
16. Give the syntaxes for chmod and fchmod functions and state their importance.
17. Write the syntax of following system calls.
o open
o creat
o read
o Write
o chmod
o chown
o unlink
o link.

________________________________________
UNIX PROGRAMMING
Unit 6 Important Questions
1. Write a program to illustrate the vfork function call.
2. Write a program for signal implementation.
3. Write a program which used both kill and raise functions.
4. Write a program which uses abort function.
5. Write a program which used both kill and raise functions.
6. Write the differences between wait and waitpid system calls.
7. Explain threads.
8. Write the system calls for process termination in detail.
9. Explain process creation and process termination in detail.
10. What is a process? Explain waiting for a process in detail.
11. What are the uses of fork function?
12. Write a short note on zombie process.
13. What are the different properties that are inherited by the child from its parent. Explain.
14. What are the differences between parent and child processes.
15. What are the differences between sleep and abort functions? Explain.
16. What is a zombie process? Explain.
17. What are the various properties that are inherited by the child from their parent?
18. Differentiate between parent and child processes.
19. Write the syntax of following functions. Explain each argument.
o kill
o raise
o alarm
o exit

________________________________________
UNIX PROGRAMMING
Unit 7 Important Questions
1. Write a comparative study of adversary and mandatory locking.
2. Write in detail about locking regions.
3. Explain the concept of requesting and releasing a lock.
4. Write in detail about locking regions.
5. Write about different Unix locking techniques.
6. Write a C program to use a function lock test to test for a lock.
7. Write about lockf function.
8. Write the differences between fcntl function and flock function.
9. Write and Explain locking routines using a create( ) system call.
• Explain with examples, competing locks and locking regions in detail.
• Write a short note on competing locks.
• Explain the usage of read and Write functions with locking.
• State the importance of file locking and Explain locking regions in detail.
• What is a null pointer? Explain with example, What happens when we try to access a null pointer.

________________________________________
UNIX PROGRAMMING
Unit 8 Important Questions
1. Write about system call pipe . Give an example which uses pipe system call.
2. Explain the logic for opening or creating an IPC channel
3. Explain the following concepts about pipes
o Pipes between two process
o Pipes among three process in a shell
4. Explain the concept of IPC between two processes on a single system. Give Example.
5. What is the data stored by the kernel when a semaphore is created.
6. What is the system call that is used to create a shared memory segment and Explain each field in detail.
7. The syntax of msgget system call is int msgget(key t key, int flag)
o Explain type of key
o Explain What value it returns
o What is the use of flag
8. Explain the following concepts
o Pipes in single process
o Pipes in single process, immediately after fork
9. Explain the concept of IPC between two processes on a single system. Give Example
10. What are the advantages and disadvantages of system v IPC?
11. What is a FIFO? Why FIFOs are called as named pipes? Explain
12. Write a program to create a pipe and to execute it on the client.
13. Mention the rules for writing information into the pipe.
14. Compare the IPC functionality provided by pipes and message queues. What are the advantages and drawbacks of each? When is one more suitable than the other.
15. Define Inter Process Communication? Explain IPC between two processes on different systems.
16. What is a pipe? Using pipe, how IPC can be implemented.

UNIX Material-2

Hi Fiends.
This material also contains all topics in UNIX. it is useful for your preparation. Download it by clicking the following link.

CLICK HERE TO DOWNLOAD

UNIX material


The following all links give you the power point slides of UNIX. These slides are designed topic wise. These will give you an idea about the topics in UNIX.

Click the following link to download UNIX slides








POSIX Thread libraries

Click here to open the tutorial

Threads in UNIX

Click the following open the tutorial about Basic Theory and libraries in thread programming in UNIX.

Click here to open

File System calls

Click here to open File System calls in UNIX

UNIX System Calls

Click here to open Tutorial about UNIX System class

Working in the Shell environment

Click here to open the tutorial

Tutotial on shell script

Click here to open Shell Script tutorial in UNIX

Shell programming in UNIX

Click the following link to open Tutorial about shell programming in UNIX.

Click here to open

File handling commands

Click here to view File Handling Commands in UNIX

Common UNIX commands


Common UNIX commands and utilities

Program listings are organized by general subject categories. Keys preceded by a ^ character are CONTROL key combinations. Access the online manual with the man program to get more information on these programs, for example,
      man cp
To find a program not on this list (and there are hundreds), try the man program with the -k option followed by a keyword, for example,
      man -k tape

to find all on-line manual entries that refer to programs that work with tapes.

Terminal control characters for C-shell (csh)

^h, backspace erase previously typed character
^u erase entire line of input so far typed
^d end-of-input for programs reading from terminal
^s suspend writing to terminal (freezes terminal)
^q continue writing to terminal
^z suspend currently running job; restart with bg or fg
^c kill currently running program and allow clean-up before exiting
^\ emergency kill of currently running program with no chance of cleanup
Also see a list of special characters that should not be used in filenames.

Login and authentication

login access computer; start interactive session
logout disconnect terminal session
passwd change local login password; you must set a strong password that is not easily guessed
kinit obtain kerberos ticket for connections to other kerberized computers
kdestroy destroy kerberos tickets (authorizations)

Information

date show date and time
history list of previously executed commands
man show online documentation by program name
info online documentation for GNU programs
w, who who is on the system and what they are doing
whoami who is logged onto this terminal
top show system stats and top CPU using processes
uptime show one line summary of system status

File management

cat combine files
cp copy files
ls list files in a directory and their attributes
mv change file name or directory location
rm remove files
ln create another link (name) to a file
chmod set file permissions
crypt encode/decode a file with a private key
gzip, gunzip compress/decompress a file
find find files that match specific criteria

Display contents of files

cat copy files to display device
more show text file on display terminal with paging control
head show first few lines of a file(s)
tail show last few lines of a file; or reverse line order
vi full-featured screen editor for modifying text files
pico simple screen editor for modifying text files
grep display lines that match a pattern
lpr send file to printer
pr format file with page headers, multiple columns, etc.
diff compare two files and show differences
cmp compare two binary files and report if different
comm compare two files; show common or unique lines
od display binary files as eqivalent octal/hex codes
strings show printable text embedded in binary files
file examine file(s) and guess type: text, data, program, etc.
wc count characters, words, and lines in a file

Directories

cd change to new directory
mkdir create new directory
rmdir remove empty directory (you must remove files first)
mv change name of directory
pwd show current directory

Disks

df summarize free space on disk filesystems
du show disk space used by files or directories

Special character handling for C-shell (See man csh)

* match any characters in a file name
~user shorthand for home directory of user
$name substitute value of variable name
\ turn off special meaning of character that follows
' in pairs, quote string with special chars, except !
" in pairs, quote string with special chars, except !, $
` in pairs, substitute output from enclosed command

Controlling program execution for C-shell (See man csh)

& run job in background
^c kill job in foreground
^z suspend job in foreground
fg restart suspended job in foreground
bg run suspended job in background
; delimit commands on same line
() group commands on same line
! re-run earlier commands from history list
jobs list current jobs
ps show process information
kill kill background job or previous process
nice run program at lower priority
at run program at a later time
crontab run program at specified intervals
limit see or set resource limits for programs
alias create alias name for program (normally used in .login file)
sh, csh execute command file

Controlling program input/output for C-shell (See man csh)

| pipe output to input
> redirect output to a storage file
< redirect input from a storage file
>> append redirected output to a storage file
tee copy input to both file and next program in pipe
script make file record of all terminal activity

Email and communication

msgs read system bulletin board messages
mailx send/read email; can be run by other programs to send exisiting files via email
uuencode
uudecode
encode/decode a binary file for transmission via email
rn read USENET news groups

Editors and formatting utilities

sed programmable text editor for data streams
vi full-featured editor for character terminals
emacs GNU emacs editor for character terminals
xemacs GNU emacs editor for X Window terminals
pico very simple text editor
fmt fill and break lines to make all same length
fold break long lines to specified length

X Window client programs (output to X terminal or server)

xterm provide login shell window
xauth manipulate authorization files
xload show system load
xman full screen online manual viewer
xemacs GNU emacs editor
gv interface to contol gs to display PostScript or PDF files on screen
xdvi display DVI files on X Window (screen preview)
gnuplot interactive data plotting on screen

TeX typesetting system

tex process TeX files to DVI (device independent) output
latex process LaTeX files to DVI
dvips print DVI files on Postscript laser printer
xdvi display DVI files on X Window (screen preview)
latex2html translate LaTeX files to HTML (for web pages)

Printing (BSD based)

lpr send file to print queue
lpq examine status of files in print queue
lprm remove a file from print queue
enscript convert text files to PostScript format for printing

Interpreted languages and data manipulation utilities

sed programmable text editor for data streams
awk pattern scanning and processing language
perl Practical Extraction and Report Language
sort sort or merge lines in a file(s) by specified fields
tr translate characters
cut cut out columns from a file
paste paste columns into a file
dd copy data between devices; reblock; convert EBCDIC

Graphics and mapping

gnuplot interactive data plotting; outputs to PostScript or X Window
gs "ghostscript" converter displays PostScript files on X Window displays or other devices

Networking/communications

ssh remote login/command execution; encrypted
scp remote non-interactive file copy; encrypted
sftp remote interactive file copy; encrypted
telnet remote network login; plain text password - not recommended
ftp network file transfer program; plain text password - not recommended
host find IP address for given host name, or vice versa
lynx web browser for character based (text-only) terminals
gzip, gunzip compress/decompress a file
tar combine multiple files/dirs into single archive
uuencode
uudecode
encode/decode a binary file for transmission via email

Compilers, interpreters and programming tools

csh command language interpreter (C-shell scripts)
ksh command language interpreter (Korn-shell scripts)
sh command language interpreter (Borne-shell scripts)
f77 Fortran 77 compiler
f2c convert fortran source code to C source code
gcc GNU C compiler
g++ GNU C++ compiler
dbx command-line symbolic debugger for compiled C or Fortran
make recompile programs from modified source
cflow generate C flow graph

Programming libraries (see man library_name)

lapack Fortran 77 routines for numerical linear algebra (supersedes LINPACK and EISPACK)
X routines to interface with X window system (no man page -- get the X Toolkit book)
dbm database routines
xdr library routines for external data representation
netcdf routines for machine independent data representation

Tape manipulation and archiving

mt manipulate tape drive and position tape
dd unformatted tape read and write; file conversion
tar archive disk files on tape or disk
ltf read/write ANSI standard label tapes

Frequently asked Questions in UNIX Programming

Click here to open Frequently asked questions in UNIX Programming

Introduction to UNIX

In this you can know about UNIX History,Versions, Shells, Commands Files,Directories, File manipulation commands, Directory manipulation commands, Miscellaneous Commands, vi Editor, File Protection, Command Processing etc....

UNIX tutorial-1

Click here to open the tutorial

UNIX Programming Examples

Click following link to view the Example programs in UNIX including Thread programming

Click here to open