1. Unix Interview Questions You Should Be Ready For What is UNIX? How is UNIX different from Linux? What is a kernel?

Size: px
Start display at page:

Download "1. Unix Interview Questions You Should Be Ready For What is UNIX? How is UNIX different from Linux? What is a kernel?"

Transcription

1 1. Unix Interview Questions You Should Be Ready For What is UNIX? How is UNIX different from Linux? What is a kernel? What is the difference between multi-user and multi-tasking? What is a UNIX shell? What command can you use to display the first 3 lines of text from a file and how does it work?4 8. How can you remove the 7th line from a file? What is piping? How do you reverse a string? How can you find out what a command does? How are devices represented in UNIX? What is 'inode'? Brief about the directory representation in UNIX What are the Unix system calls for I/O? How do you change File Access Permissions? What are links and symbolic links in UNIX file system? What is a FIFO? How do you create special files like named pipes and device files? Discuss the mount and unmount system calls What is a shell? Brief about the initial process sequence while the system boots up What are various IDs associated with a process? Explain fork() system call Predict the output of the following program code Predict the output of the following program code List the system calls used for process management: How can you get/set an environment variable from a program?: How can a parent and child process communicate? What is a zombie? What are the process states in Unix? What Happens when you execute a program? What Happens when you execute a command? What is a Daemon? What is 'ps' command for? How would you kill a process? What is an advantage of executing a process in background?

2 38. How do you execute one program from within another? What is IPC? What are the various schemes available? What is major difference between the Historic Unix and the new BSD release of Unix System V in terms of Memory Management? Explain different types of Unix systems Explain kernal and shell What is ex and vi? Which are typical system directories below the root directory? What does the command $who sort logfile > newfile do? What does the command $ls wc l > file1 do? filter How is the command $cat file2 different from $cat >file2 and >> redirection operators? What difference between cmp and diff commands? What is the use of grep command? What is the difference between cat and more command? Write a command to kill the last background job? Which command is used to delete all files in the current directory and all its sub-directories? What is the use of the command "ls -x chapter[1-5]" Is it possible to count number char, line in a file; if so, How? How to switch to a super user status to gain privileges? What are shell variables? What is redirection? How to terminate a process which is running and the specialty on command kill 0? What is a pipe and give an example? How to print/display the last line of a file? How to display n-th line of a file? How to remove the first line / header from a file? How to remove the last line/ trailer from a file in Unix script? How to remove certain lines from a file in Unix? How to remove the last 5 lines from a file? How to check the length of any line in a file? How to reverse a string in unix? How to get the last word from a line in Unix file? How to get the n-th field from a Unix command output? How to replace the n-th line in a file with a new line in Unix? How to show the non-printable characters in a file? How to zip a file in Linux?

3 74. How to unzip a file in Linux? How to test if a zip file is corrupted in Linux? How to check if a file is zipped in Unix? How to connect to Oracle database from within shell script? How to execute a database stored procedure from Shell script? How to check the command line arguments in a UNIX command in Shell Script? How to fail a shell script programmatically? How to list down file/folder lists alphabetically? How to check if the last command was successful in Unix? How to check if a file is present in a particular directory in Unix? How to check all the running processes in Unix? How to tell if my process is running in Unix? How to get the CPU and Memory details in Linux server? netstat- "network statistics", who is connected to your system either through an incoming or outgoing connection TCP (-t) and UDP (-u) connections: If you want to turn off hostnames, or domain names, and display only IP numbers just add the - n option display this continuously to see as connections come and go add the -c option Show listening ports Find the port used by a program Check on the routing table, see the kernel IP routing table Show all statistics networking tcpdump will capture and display packets flowing through the eth0 network interface, a. To display that you'll need to run tcpdump with the -X option: What if you wanted to read another network interface, like eth1? Simple, just tell it to capture eth1 packets with the -i option: To listen for any and all traffic, just use -i any To disable resolving hostnames and domains, which can save a bit of time, and display only IP addresses use the -n option. To disable port names, use -nn. With these options the first example would look like this: To show only a certain number of packets and then stop instead of running indefinitely you can specify the -c 20 option, where -c stands for "count", and "20" would represent 20 packets Finally, if you want to make absolutely sure you see the maximum possible information that is being captured use the verbosity options. You can increase verbosity up to three times. With just -v, - vv, or -vvv for maximum verbosity. Also, we can use the -S option to show absolute rather than relative sequence numbers just to make sure we see the actual numbers. So let's construct a command that would show the maximum possible information on a sample of 100 packets, and store it into packets.txt Unix Interview Questions You Should Be Ready For January 2, 2014 by Alex Barbos 3

4 UNIX is based on the C programming languag Basic Theory Questions 2. What is UNIX? Unix is an operating system is not likely to impress the interviewer. The correct answer should look something like this: UNIX is a multi-user multitasking-optimized operating system that can run on various hardware platforms. 3. How is UNIX different from Linux? Linux is basically an open-source clone of UNIX so, while a lot of similarities between the two operating systems do exist, there are also a lot of differences. The main advantage of UNIX is that all the core components of the operating system come from the same vendor, which means greater overall stability and better software support from vendors. making UNIX the better choice for enterprise use. 4. What is a kernel? The kernel is the program that acts as a middle layer between software and hardware. When a program requires access to certain resources or processing power, the kernel is responsible for sending the correct signals to the CPU and managing all other running programs and services so that the resources are correctly allocated and no conflicts occur. 5. What is the difference between multi-user and multi-tasking? Multi-tasking means that a user can run multiple tasks simultaneously on a single machine, whereas multi-user means that multiple users can operate simultaneously on a machine. 6. What is a UNIX shell? A UNIX shell is an interface that acts as a command interpreter, translating user input into machineunderstandable language and then passing it to the kernel for execution. Once you ace the basic stuff, the interviewer is most likely to move on to some questions involving commands. Keep in mind that his role is not to see how good you are at memorizing commands, but rather how well you understand what those commands do and determine your ability to choose the right command in a certain situation. In order to successfully pass this part of the interview, make sure you formulate your answers as clear and as detailed as possible. 7. What command can you use to display the first 3 lines of text from a file and how does it work? There are two commands that can be used to complete this task: head -3 test.txt this uses the head command, along with the -3 parameter that indicates the number of lines to be displayed; sed 4,$ d test.txt this command uses the Sed text editor to perform the task. If the command was simply sed test.txt the whole file would have been displayed; however, in our example the delete parameter was used (d) to make Sed delete everything between the 4th and the last line (defined by the $ parameter), leaving only the first 3 lines of the file. It is important to mention that Sed does not actually delete the lines from the file itself, but just from the output result. 8. How can you remove the 7th line from a file? The easiest way is by using the following command: sed -i 7 d test.txt Unlike the previous Sed command, this command also has the -i parameter, which tells Sed to make the change in the actual file. 9. What is piping? Piping is a technique that consists of entering two or more consecutive commands, separated by the pipe symbol. Once the first command is executed, its output will be used as input for the second command, the output of the second command will be used as input for the third and so on, until the whole chain of commands is executed. 10. How do you reverse a string? You can reverse a string by using a simple piping of two commands: echo Mary rev 4

5 The first command will generate the output Mary, which will become the input for the rev command, making it return the reverse: yram. 11. How can you find out what a command does? You use man <command-name> in order to bring up the manual page that describes the actions of the specified command and any other additional options and parameters that command might have. These are some of the UNIX questions interviewers usually ask during basic interviews. However, if the interview is for a more technical position, you can expect to encounter questions that are more difficult; still, there is no reason to panic, as UNIX itself was created to be quite logical, so a good knowledge of the basic commands and a bit of imagination can help you get the job done. If it is for developing, he should be familiar with make and Makefiles, and some source control command line interface (svn, git, cleartool, hg, cvs...) 12. How are devices represented in UNIX? All devices are represented by files called special files that are located in/dev directory. Thus, device files and other files are named and accessed in the same way. 'regular file' is just an ordinary data file in the disk. 'block special file' represents a device with characteristics similar to a disk (data transfer in terms of blocks). 'character special file' represents a device with characteristics similar to a keyboard (data transfer is by stream of bits in sequential order). 13. What is 'inode'? All UNIX files have its description stored in a structure called 'inode'. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file. If the file is large, inode has indirect pointer to a block of pointers to additional data blocks (this further aggregates for larger files). A block is typically 8k. Inode consists of the following fields: File owner identifier File type File access permissions File access times Number of links File size Location of the file data 14. Brief about the directory representation in UNIX A Unix directory is a file containing a correspondence between filenames and inodes. A directory is a special file that the kernel maintains. Only kernel modifies directories, but processes can read directories The contents of a directory are a list of filename and inode number pairs. When new directories are created, kernel makes two entries named '.' (refers to the directory itself) and '..' (refers to parent directory). System call for creating directory is mkdir (pathname, mode). 15. What are the Unix system calls for I/O? open(pathname,flag,mode) - open file creat(pathname,mode) - create file close(filedes) - close an open file read(filedes,buffer,bytes) - read data from an open file write(filedes,buffer,bytes) - write data to an open file lseek(filedes,offset,from) - position an open file dup(filedes) - duplicate an existing file descriptor dup2(oldfd,newfd) - duplicate to a desired file descriptor fcntl(filedes,cmd,arg) - change properties of an open file ioctl(filedes,request,arg) - change the behaviour of an open file The difference between fcntl anf ioctl is that the former is intended for any open file, while the latter is for devicespecific operations. 5

6 16. How do you change File Access Permissions? Every file has following attributes: owner's user ID ( 16 bit integer ) owner's group ID ( 16 bit integer ) File access mode word 'r w x -r w x- r w x' (user permission-group permission-others permission) r-read, w-write, x-execute To change the access mode, we use chmod(filename,mode). Example 1: To change mode of myfile to 'rw-rw-r--' (ie. read, write permission for user - read,write permission for group - only read permission for others) we give the args as: chmod(myfile,0664). Each operation is represented by discrete values 'r' is 4 'w' is 2 'x' is 1 Therefore, for 'rw' the value is 6(4+2). Example 2: To change mode of myfile to 'rwxr--r--' we give the args as: chmod(myfile,0744). 17. What are links and symbolic links in UNIX file system? A link is a second name (not a file) for a file. Links can be used to assign more than one name to a file, but cannot be used to assign a directory more than one name or link filenames on different computers. 6 Symbolic link 'is' a file that only contains the name of another file.operation on the symbolic link is directed to the file pointed by the it.both the limitations of links are eliminated in symbolic links. Commands for linking files are: Link ln filename1 filename2 Symbolic link ln -s filename1 filename2 18. What is a FIFO? FIFO are otherwise called as 'named pipes'. FIFO (first-in-first-out) is a special file which is said to be data transient. Once data is read from named pipe, it cannot be read again. Also, data can be read only in the order written. It is used in interprocess communication where a process writes to one end of the pipe (producer) and the other reads from the other end (consumer). 19. How do you create special files like named pipes and device files? 1. The system call mknod creates special files in the following sequence. 2. kernel assigns new inode, 3. sets the file type to indicate that the file is a pipe, directory or special file, 4. If it is a device file, it makes the other entries like major, minor device numbers. 5. For example: 6. If the device is a disk, major device number refers to the disk controller and minor device number is the disk. 20. Discuss the mount and unmount system calls mount = attach a file system to a directory of another file system; unmount = detaches a file system. When you mount another file system on to your directory, you are essentially splicing one directory tree onto a branch in another directory tree. first argument directory is the current file naming system. second argument is the file system to mount to that point. When you insert a cdrom to your unix system's drive, the file system in the cdrom automatically mounts to /dev/cdrom in your system. 21. What is a shell? A shell is an interactive user interface to an operating system services that allows an user to enter commands as character strings or through a graphical user interface. The shell converts them to

7 system calls to the OS or forks off a process to execute the command. System call results and other information from the OS are presented to the user through an interactive interface. Commonly used shells are sh,csh,ks etc. 22. Brief about the initial process sequence while the system boots up. While booting, special process called the 'swapper' or 'scheduler' is created with Process-ID 0. The swapper manages memory allocation for processes and influences CPU allocation. The swapper inturn creates 3 children: 1. the process dispatcher, 2. vhand and 3. dbflush with IDs 1,2 and 3 respectively. This is done by executing the file /etc/init. Process dispatcher gives birth to the shell. Unix keeps track of all the processes in an internal data structure called the Process Table (listing command is ps -el). 23. What are various IDs associated with a process? Unix identifies each process with a unique integer called ProcessID. The process that executes the request for creation of a process is called the 'parent process' whose PID is 'Parent Process ID'. Every process is associated with a particular user called the 'owner' who has privileges over the process. The identification for the user is 'UserID'. Owner is the user who executes the process. Process also has 'Effective User ID' which determines the access privileges for accessing resources like files. getpid() -process id getppid() -parent process id getuid() -user id geteuid() -effective user id 24. Explain fork() system call. The `fork()' used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. We can tell which is which by checking the return value from `fork()'. The parent gets the child's pid returned to him, but the child gets 0 returned to him. 25. Predict the output of the following program code main() { fork(); // duplicate of the parent process printf("hello World!"); } Answer: Hello World!Hello World! Explanation: The fork creates a child that is a duplicate of the parent process. The child begins from the fork().all the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process. 26. Predict the output of the following program code main() { fork(); //2^1 fork(); //2^2 fork(); //2^3 printf("hello World!"); } Answer: 7

8 "Hello World" will be printed 8 times. Explanation: 2^n times where n is the number of calls to fork() 27. List the system calls used for process management: System calls Description fork() To create a new process exec() To execute a new program in a process wait() To wait until a created process completes its execution exit() To exit from a process execution getpid() To get a process identifier of the current process getppid() To get parent process identifier nice() To bias the existing priority of a process brk() To increase/decrease the data segment size of a process 28. How can you get/set an environment variable from a program?: getenv()'. Setting the value of an environment variable is done by using `putenv()'. 29. How can a parent and child process communicate? pipes, sockets, message queues, shared memory) special ways to communicate that take advantage of their relationship as a parent and child. One of the most obvious is that the parent can get the exit status of the child. 30. What is a zombie? When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status. To be able to get this information, the parent calls `wait()'; In the interval between the child terminating and the parent calling `wait()', the child is said to be a `zombie' `ps', the child will have a `Z' in its status field to indicate this. 31. What are the process states in Unix? As a process executes it changes state according to its circumstances. Unix processes have the following states: Running : The process is either running or it is ready to run. Waiting : The process is waiting for an event or for a resource. Stopped : The process has been stopped, usually by receiving a signal. Zombie : The process is dead but have not been removed from the process table. 32. What Happens when you execute a program? creates a special environment for that program. This environment contains everything needed for the system to run the program as if no other program were running on the system. Each process has process context, which is everything that is unique about the state of the program you are currently running. Every time you execute a program the UNIX system does a fork, create a process context 1. Allocate a slot in the process table, a list of currently running programs kept by UNIX. 2. Assign a unique process identifier (PID) to the process. 3. icopy the context of the parent, the process that requested the spawning of the new process. 4. Return the new PID to the parent process. This enables the parent process to examine or control the process directly. 8

9 9 5. After the fork is complete, UNIX runs your program. 33. What Happens when you execute a command? 1. create an environment for ls and the run it: 2. The shell has UNIX perform a fork. This creates a new process that the shell will use to run the ls program. 3. The shell has UNIX perform an exec of the ls program. This replaces the shell program and data with the program and data for ls and then starts running that new program. The ls program is loaded into the new process context, replacing the text and data of the shell. The ls program performs its task, 34. What is a Daemon? A daemon is a process that detaches itself from the terminal and runs, disconnected, in the background, waiting for requests and responding to them. Some of the most common daemons are: init: Takes over the basic running of the system when the kernel has finished the boot process. inetd: Responsible for starting network services that do not have their own stand-alone daemons. inetd usually takes care of incoming rlogin, telnet, and ftp connections. cron: Responsible for running repetitive tasks on a regular schedule 35. What is 'ps' command for? The ps command prints the process status for some or all of the running processes. The information given are the process identification number (PID),the amount of time that the process has taken to execute so far etc. 36. How would you kill a process? The kill - PID as one argument; 37. What is an advantage of executing a process in background? The most common reason to put a process in the background is to allow you to do something else interactively without waiting for the process to complete. At the end of the command you add the special background symbol, &. This symbol tells your shell to execute the given command in the background. Example: cp *.*../backup& (cp is for copy) 38. How do you execute one program from within another? execlp() execlp call overlays the existing program with the new one, runs that and exits. T execlp(path,file_name,arguments..); //last argument must be NULL execvp(). execvp is used when the number of arguments is not known in advance. execvp(path,argument_array); //argument array should be terminated by NULL 39. What is IPC? What are the various schemes available? The term IPC (Inter-Process Communication) describes various ways by which different process running on some operating system communicate between each other. 1. Pipes: One-way communication scheme through which different process can communicate. if common ancestor (parent-child relationship) use pipes (FIFO). 2. Message Queues : Message queues can be used between related and unrelated processes running on a machine. 3. Shared Memory: This is the fastest of all IPC schemes. 4. Various forms of synchronisation are mutexes, condition-variables, read-write locks, record-locks, and semaphores. 40. What is major difference between the Historic Unix and the new BSD release of Unix System V in terms of Memory Management? Historic Unix uses Swapping entire process is transferred to the main memory from the swap device, the Unix System V uses Demand Paging only the part of the process is moved to the main memory. Historic Unix uses one Swap Device and Unix System V allow multiple Swap Devices.

10 41. Explain different types of Unix systems. The most widely used are: 1. System V (AT&T) 2. AIX (IBM) 3. BSD (Berkeley) 4. Solaris (Sun) 5. Xenix ( A PC version of Unix) 42. Explain kernal and shell. Kernal: It carries out basic operating system functions such as allocating memory, accessing files and handling communications. Shell:A shell provides the user interface to the kernal.there are 3 major shells : C-shell, Bourne shell, Korn shell 43. What is ex and vi? ex is Unix line editor and vi is the standard Unix screen editor. 44. Which are typical system directories below the root directory? (1)/bin: contains many programs which will be executed by users (2)/etc : files used by administrator (3)/dev: hardware devices (4)/lib: system libraries (5)/usr: application software (6)/home: home directories for different systems. 45. What does the command $who sort logfile > newfile do? 1. who becomes the std input to sort, 2. sort opens the file logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) 3. sorted output is redirected to the file newfile. 46. What does the command $ls wc l > file1 do? ls wc which counts the number of lines it receives as input and instead of displaying this count, the value is stored in file filter cat, pg, head rogram which can receive a flow of data from std input, process (or filter) it and send the result to the std output. 48. How is the command $cat file2 different from $cat >file2 and >> redirection operators? is the output redirection operator when used it overwrites while >> operator appends into the file. 49. What difference between cmp and diff commands? cmp - Compares two files byte by byte and displays the first mismatch diff - tells the changes to be made to make the files identical 50. What is the use of grep command? grep is a pattern search command. It searches for the pattern, specified in the command line with appropriate 51. What is the difference between cat and more command? Cat displays file contents. If the file is large the contents scroll off the screen before we view it. 'more' is like a pager which displays the contents page by page. 52. Write a command to kill the last background job? Kill $! 53. Which command is used to delete all files in the current directory and all its sub-directories? rm -r * $ echo * It is similar to 'ls' command and displays all the files in the current directory. 10

11 54. What is the use of the command "ls -x chapter[1-5]" displays the list of the files that starts with 'chapter' with suffix '1' to '5', chapter1, chapter2, and so on. 55. Is it possible to count number char, line in a file; if so, How? Yes, wc-stands for word count. wc -c for counting number of characters in a file. wc -l for counting lines in a file. 56. How to switch to a super user status to gain privileges? Use su command. The system asks for password and when valid entry is made the user gains super user (admin) privileges. 57. What are shell variables? Shell variables are special variables, a name-value pair created and maintained by the shell. Example: PATH, HOME, MAIL and TERM 58. What is redirection? Directing the flow of data to the file or from the file for input or output. Example : ls > wc 59. How to terminate a process which is running and the specialty on command kill 0? With the help of kill command we can terminate the process. Syntax: kill pid Kill 0 - kills all processes in your system except the login shell. 60. What is a pipe and give an example? output of the preceding command to be passed as input to the following command. ls -l pr 61. How to print/display the last line of a file? The easiest way is to use the [tail] command. $> sed -n '$ p' test 62. How to display n-th line of a file? $> sed n '<n> p' file.txt 63. How to remove the first line / header from a file? $> sed '1 d' file.txt > new_file.txt $> mv new_file.txt file.txt 64. How to remove the last line/ trailer from a file in Unix script? $> sed i '$ d' file.txt 65. How to remove certain lines from a file in Unix? remove line <m> to line <n> from a given file, $> sed i '5,7 d' file.txt The above command will delete line 5 to line 7 from the file file.txt 66. How to remove the last 5 lines from a file? $> tt=`wc -l file.txt cut -f1 -d' '`;sed i "`expr $tt - 4`,$tt d" test As you can see there are two commands. The first one (before the semi-colon) calculates the total number of lines present in the file and stores it in a variable called tt. The second command (after the semi-colon), uses the variable and works in the exact way as shows in the previous example. 67. How to check the length of any line in a file? 11

12 12 We already know how to print one line from a file which is this: $> sed n '<n> p' file.txt Where <n> is to be replaced by the actual line number that you want to print. Now once you know it, it is easy to print out the length of this line by using [wc] command with '-c' switch. $> sed n '35 p' file.txt wc c The above command will print the length of 35th line in the file.txt. 68. How to reverse a string in unix? Pretty easy. Use the [rev] command. $> echo "unix" rev xinu 69. How to get the last word from a line in Unix file? 1. First we reverse the line. 2. Then we cut the first word, 3. then we reverse it again. $>echo "C for Cat" rev cut -f1 -d' ' rev Cat 70. How to get the n-th field from a Unix command output? We know we can do it by [cut]. Like below command extracts the first field from the output of [wc c] command $>wc -c file.txt cut -d' ' -f1 109 But I want to introduce one more command to do this here. That is by using [awk] command. [awk] is a very powerful command for text pattern scanning and processing. Here we will see how may we use of [awk] to extract the first field (or first column) from the output of another command. Like above suppose I want to print the first column of the [wc c] output. Here is how it goes like this: $>wc -c file.txt awk ' ''{print $1}' 109 The basic syntax of [awk] is like this: awk 'pattern space''{action space}' The pattern space can be left blank or omitted, like below: $>wc -c file.txt awk '{print $1}' 109 In the action space, we have asked [awk] to take the action of printing the first column ($More on [awk] later. 71. How to replace the n-th line in a file with a new line in Unix? This can be done in two steps. The first step is to remove the n-th line. And the second step is to insert a new line in n-th line position. Here we go. Step 1: remove the n-th line $>sed -i'' '10 d' file.txt Step 2: insert a new line at n-th line position $>sed -i'' '10 i This is the new line' file.txt # d stands for delete # i stands for insert 72. How to show the non-printable characters in a file? Open the file in VI editor. Go to VI command mode by pressing [Escape] and then [:]. Then type [set list]. This will show you all the non-printable characters, e.g. Ctrl-M characters (^M) etc., in the file. 73. How to zip a file in Linux? Use inbuilt [zip] command in Linux 74. How to unzip a file in Linux? Use inbuilt [unzip] command in Linux. $> unzip j file.zip 75. How to test if a zip file is corrupted in Linux? Use -t switch with the inbuilt [unzip] command $> unzip t file.zip

13 76. How to check if a file is zipped in Unix? $> file i file.zip file.zip: application/x-zip 77. How to connect to Oracle database from within shell script? You will be using the same [sqlplus] command to connect to database example, we will connect to database, fire a query and get the output printed from the unix shell. $>res=`sqlplus -s username/password@database_name <<EOF SET HEAD OFF; select count(*) from dual; EXIT; EOF` $> echo $res How to execute a database stored procedure from Shell script? $> SqlReturnMsg=`sqlplus -s username/password@database<<eof BEGIN Proc_Your_Procedure( your-input-parameters ); END; / EXIT; EOF` $> echo $SqlReturnMsg 79. How to check the command line arguments in a UNIX command in Shell Script? In a bash shell, you can access the command line arguments using $0, $1, $2, variables, where $0 prints the command name, $1 prints the first input parameter of the command, $2 the second input parameter of the command and so on. 80. How to fail a shell script programmatically? Just put an [exit] command in the shell script with return value other than 0. this is because the exit codes of successful Unix programs is zero. So, suppose if you write exit -1 inside your program, then your program will thrown an error and exit immediately. 81. How to list down file/folder lists alphabetically? Normally [ls lt] command lists down file/folder list sorted by modified time. If you want to list then alphabetically, then you should simply specify: [ls l] 82. How to check if the last command was successful in Unix? To check the status of last executed command in UNIX, you can check the value of an inbuilt bash variable [$?]. See the below example: $> echo $? 83. How to check if a file is present in a particular directory in Unix? Using command, we can do it in many ways. Based on what we have learnt so far, we can make use of [ls] and [$?] command to do this. See below: $> ls l file.txt; echo $? If the file exists, the [ls] command will be successful. Hence [echo $?] will print 0. If the file does not exist, then [ls] command will fail and hence [echo $?] will print How to check all the running processes in Unix? The standard command to see this is [ps]. 13

14 $> ps ef If you wish to see the % of memory usage and CPU usage, then consider the below switches $> ps aux customize the output of [ps] command, you may use -o switch like below. By using -o switch, you can specify the columns that you want [ps] to print out. $>ps -e -o stime,user,pid,args,%mem,%cpu 85. How to tell if my process is running in Unix? 4. You can list down all the running processes using [ps] command. 5. Then you can grep your user name or process name to see if the process is running. $>ps -e -o stime,user,pid,args,%mem,%cpu grep "groeten" 14:53 opera sleep :54 opera ps -e -o stime,user,pid,arg :54 opera grep opera How to get the CPU and Memory details in Linux server? In Linux based systems, you can easily access the CPU and memory details from the /proc/cpuinfo and /proc/meminfo, like this: $>cat /proc/meminfo $>cat /proc/cpuinfo 87. netstat- "network statistics", connections to and from others on the network, used network interfaces, services, ports, and routing tables. 88. who is connected to your system either through an incoming or outgoing connection netstat -a 89. TCP (-t) and UDP (-u) connections: netstat -tua 90. If you want to turn off hostnames, or domain names, and display only IP numbers just add the -n option. netstat -tuan 91. display this continuously to see as connections come and go add the -c option. netstat -tuanc 92. Show listening ports which services are actually listening for incoming connections, netstat -l 93. Find the port used by a program netstat -ap grep znc 94. Check on the routing table, see the kernel IP routing table netstat -r 14

15 95. Show all statistics networking. netstat -s 96. tcpdump will capture and display packets flowing through the eth0 network interface, a. To display that you'll need to run tcpdump with the -X option: tcpdump -X 97. What if you wanted to read another network interface, like eth1? Simple, just tell it to capture eth1 packets with the -i option: tcpdump -X -w packets.txt -i eth1 98. To listen for any and all traffic, just use -i any tcpdump -X -w packets.txt -i any 99. To disable resolving hostnames and domains, which can save a bit of time, and display only IP addresses use the -n option. To disable port names, use -nn. With these options the first example would look like this: tcpdump -Xnn 100. To show only a certain number of packets and then stop instead of running indefinitely you can specify the -c 20 option, where -c stands for "count", and "20" would represent 20 packets. tcpdump -Xnnc Finally, if you want to make absolutely sure you see the maximum possible information that is being captured use the verbosity options. You can increase verbosity up to three times. With just -v, -vv, or -vvv for maximum verbosity. Also, we can use the -S option to show absolute rather than relative sequence numbers just to make sure we see the actual numbers. So let's construct a command that would show the maximum possible information on a sample of 100 packets, and store it into packets.txt. tcpdump -XSvvvc 100 -w packets.txt 15

(MCQZ-CS604 Operating Systems)

(MCQZ-CS604 Operating Systems) command to resume the execution of a suspended job in the foreground fg (Page 68) bg jobs kill commands in Linux is used to copy file is cp (Page 30) mv mkdir The process id returned to the child process

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : LINUX PROGRAMMING Course Code : ACS010 Class : III

More information

Unix Processes. What is a Process?

Unix Processes. What is a Process? Unix Processes Process -- program in execution shell spawns a process for each command and terminates it when the command completes Many processes all multiplexed to a single processor (or a small number

More information

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Latest Solved from Mid term Papers Resource Person Hina 1-The problem with priority scheduling algorithm is. Deadlock Starvation (Page# 84) Aging

More information

UNIT I Linux Utilities

UNIT I Linux Utilities UNIT I Linux Utilities 1. a) How does Linux differ from Unix? Discuss the features of Linux. 5M b) Explain various text processing utilities, with a suitable example for each. 5M 2. a) Explain briefly

More information

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

Design Overview of the FreeBSD Kernel CIS 657

Design Overview of the FreeBSD Kernel CIS 657 Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%

More information

St. MARTIN S ENGINEERING COLLEGE Dhulapally,Secunderabad DEPARTMENT OF INFORMATION TECHNOLOGY Academic year

St. MARTIN S ENGINEERING COLLEGE Dhulapally,Secunderabad DEPARTMENT OF INFORMATION TECHNOLOGY Academic year St. MARTIN S ENGINEERING COLLEGE Dhulapally,Secunderabad-000 DEPARTMENT OF INFORMATION TECHNOLOGY Academic year 0-0 QUESTION BANK Course Name : LINUX PROGRAMMING Course Code : A0 Class : III B. Tech I

More information

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent? Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler

More information

Unix System Architecture, File System, and Shell Commands

Unix System Architecture, File System, and Shell Commands Unix System Architecture, File System, and Shell Commands Prof. (Dr.) K.R. Chowdhary, Director COE Email: kr.chowdhary@iitj.ac.in webpage: http://www.krchowdhary.com JIET College of Engineering August

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version... Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing

More information

Linux System Administration

Linux System Administration System Processes Objective At the conclusion of this module, the student will be able to: Describe and define a process Identify a process ID, the parent process and the child process Learn the PID for

More information

System Programming. Introduction to Unix

System Programming. Introduction to Unix Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Introduction

More information

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2) BANK ON & SHELL PROGRAMMING-502 (CORE PAPER-2) TOPIC 1: VI-EDITOR MARKS YEAR 1. Explain set command of vi editor 2 2011oct 2. Explain the modes of vi editor. 7 2013mar/ 2013 oct 3. Explain vi editor 5

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : LINUX PROGRAMMING Course Code : A70511 (R15) Class

More information

Shell Programming Overview

Shell Programming Overview Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some

More information

Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions

Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions 1. What are the different parts of UNIX system? i. Programs

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

The Unix Shell & Shell Scripts

The Unix Shell & Shell Scripts The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises

More information

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc. Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

Review of Fundamentals

Review of Fundamentals Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : LINUX PROGRAMMING Course Code : A70511 Class : IV B.

More information

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command.

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command. Unix Internal Assessment-2 solution 1 a.explain the mechanism of process creation. Ans: There are three distinct phases in the creation of a process and uses three important system calls viz., fork, exec,

More information

Creating a Shell or Command Interperter Program CSCI411 Lab

Creating a Shell or Command Interperter Program CSCI411 Lab Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell

More information

Linux & Shell Programming 2014

Linux & Shell Programming 2014 Unit -1: Introduction to UNIX/LINUX Operating System Practical Practice Questions: Find errors (if any) otherwise write output or interpretation of following commands. (Consider default shell is bash shell.)

More information

EECS2301. Lab 1 Winter 2016

EECS2301. Lab 1 Winter 2016 EECS2301 Lab 1 Winter 2016 Lab Objectives In this lab, you will be introduced to the Linux operating system. The basic commands will be presented in this lab. By the end of you alb, you will be asked to

More information

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02 Essential Unix (and Linux) for the Oracle DBA Revision no.: PPT/2K403/02 Architecture of UNIX Systems 2 UNIX System Structure 3 Operating system interacts directly with Hardware Provides common services

More information

Files and Directories

Files and Directories CSCI 2132: Software Development Files and Directories Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Files and Directories Much of the operation of Unix and programs running on

More information

Implementation of a simple shell, xssh

Implementation of a simple shell, xssh Implementation of a simple shell, xssh What is a shell? A process that does command line interpretation Reads a command from standard input (stdin) Executes command corresponding to input line In simple

More information

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

More information

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

More information

2) clear :- It clears the terminal screen. Syntax :- clear

2) clear :- It clears the terminal screen. Syntax :- clear 1) cal :- Displays a calendar Syntax:- cal [options] [ month ] [year] cal displays a simple calendar. If arguments are not specified, the current month is displayed. In addition to cal, the ncal command

More information

Basic Linux Command Line Interface Guide

Basic Linux Command Line Interface Guide This basic Linux Command-Line Interface (CLI) Guide provides a general explanation of commonly used Bash shell commands for the Barracuda NG Firewall. You can access the command-line interface by connecting

More information

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

Bamuengine.com. Chapter 7. The Process

Bamuengine.com. Chapter 7. The Process Chapter 7. The Process Introduction A process is an OS abstraction that enables us to look at files and programs as their time image. This chapter discusses processes, the mechanism of creating a process,

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

Outline. Structure of a UNIX command

Outline. Structure of a UNIX command Outline Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission (owner, group, rwx) File and directory

More information

CS2028 -UNIX INTERNALS

CS2028 -UNIX INTERNALS DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY,SIRUVACHUR-621113. CS2028 -UNIX INTERNALS PART B UNIT 1 1. Explain briefly details about History of UNIX operating system? In 1965, Bell Telephone

More information

UNIT I Linux Utilities and Working with Bash

UNIT I Linux Utilities and Working with Bash Subject with Code :(16MC814)Course& Branch: MCA Year & Sem: II-MCA& I-Sem UNIT I Linux Utilities and Working with Bash 1. a) How does Linux differ from Unix? Discuss the features of Linux.6M b) Explain

More information

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu CPSC 341 OS & Networks Processes Dr. Yingwu Zhu Process Concept Process a program in execution What is not a process? -- program on a disk A process is an active object, but a program is just a file It

More information

Department of Computer Science and Technology, UTU 2014

Department of Computer Science and Technology, UTU 2014 Short Questions 060010601 Unix Internals Unit 1 : Introduction and Overview of UNIX 1. What were the goals of Multics System? 2. List out the levels in which UNIX system architecture is divided. 3. Which

More information

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1 Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 These notes are available on

More information

ITST Searching, Extracting & Archiving Data

ITST Searching, Extracting & Archiving Data ITST 1136 - Searching, Extracting & Archiving Data Name: Step 1 Sign into a Pi UN = pi PW = raspberry Step 2 - Grep - One of the most useful and versatile commands in a Linux terminal environment is the

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 11: WWW and Wrap up Tian Guo University of Massachusetts Amherst CICS 1 Reminders Assignment 4 was graded and scores on Moodle Assignment 5 was due and you

More information

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Embedded Linux Systems Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Generic Embedded Systems Structure User Sensors ADC microcontroller

More information

PROCESSES. Jo, Heeseung

PROCESSES. Jo, Heeseung PROCESSES Jo, Heeseung TODAY'S TOPICS What is the process? How to implement processes? Inter-Process Communication (IPC) 2 WHAT IS THE PROCESS? Program? vs. Process? vs. Processor? 3 PROCESS CONCEPT (1)

More information

Processes. Jo, Heeseung

Processes. Jo, Heeseung Processes Jo, Heeseung Today's Topics What is the process? How to implement processes? Inter-Process Communication (IPC) 2 What Is The Process? Program? vs. Process? vs. Processor? 3 Process Concept (1)

More information

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions Lanka Education and Research Network Linux Architecture, Linux File System, Linux Basic Commands 28 th November 2016 Dilum Samarasinhe () Overview History of Linux Linux Architecture Linux File System

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

UNIX Kernel. UNIX History

UNIX Kernel. UNIX History UNIX History UNIX Kernel 1965-1969 Bell Labs participates in the Multics project. 1969 Ken Thomson develops the first UNIX version in assembly for an DEC PDP-7 1973 Dennis Ritchie helps to rewrite UNIX

More information

h/w m/c Kernel shell Application s/w user

h/w m/c Kernel shell Application s/w user Structure of Unix h/w m/c Kernel shell Application s/w. user While working with unix, several layers of interaction occur b/w the computer h/w & the user. 1. Kernel : It is the first layer which runs on

More information

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication

More information

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview

More information

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc. Appendix B WORKSHOP SYS-ED/ Computer Education Techniques, Inc. 1 Introduction There are no workshops for this chapter. The instructor will provide demonstrations and examples. SYS-ED/COMPUTER EDUCATION

More information

Module A: The FreeBSD System

Module A: The FreeBSD System Module A: The FreeBSD System History Design Principles Programmer Interface User Interface Process Management Memory Management File System I/O System Interprocess Communication A.1 History First developed

More information

Module A: The FreeBSD System

Module A: The FreeBSD System Module A: The FreeBSD System History Design Principles Programmer Interface User Interface Process Management Memory Management File System I/O System Interprocess Communication A.1 History First developed

More information

Basic Linux Command Line Interface Guide

Basic Linux Command Line Interface Guide This basic Linux Command-Line Interface (CLI) Guide provides a general explanation of commonly used Bash shell commands for the Barracuda NG Firewall. You can access the command-line interface by connecting

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Useful Unix Commands Cheat Sheet

Useful Unix Commands Cheat Sheet Useful Unix Commands Cheat Sheet The Chinese University of Hong Kong SIGSC Training (Fall 2016) FILE AND DIRECTORY pwd Return path to current directory. ls List directories and files here. ls dir List

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Appendix A: FreeBSD. Operating System Concepts 9 th Edition

Appendix A: FreeBSD. Operating System Concepts 9 th Edition Appendix A: FreeBSD Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Module A: The FreeBSD System UNIX History Design Principles Programmer Interface User Interface Process Management

More information

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS SOLUTIONS ENGR 3950U / CSCI 3020U (Operating Systems) Midterm Exam October 23, 2012, Duration: 80 Minutes (10 pages, 12 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Question 1 (Computer Systgem)

More information

Processes. CS3026 Operating Systems Lecture 05

Processes. CS3026 Operating Systems Lecture 05 Processes CS3026 Operating Systems Lecture 05 Dispatcher Admit Ready Queue Dispatch Processor Release Timeout or Yield Event Occurs Blocked Queue Event Wait Implementation: Using one Ready and one Blocked

More information

S E C T I O N O V E R V I E W

S E C T I O N O V E R V I E W INPUT, OUTPUT REDIRECTION, PIPING AND PROCESS CONTROL S E C T I O N O V E R V I E W In this section, we will learn about: input redirection; output redirection; piping; process control; 5.1 INPUT AND OUTPUT

More information

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Stephen Pauwels Computer Systems Academic Year 2018-2019 Overview of the Semester UNIX Introductie Regular Expressions Scripting Data Representation Integers, Fixed point,

More information

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results.

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results. Volume: 230 Questions Question No: 1 You located a file created in /home successfully by using the slocate command. You found that the slocate command could locate that file even after deletion. What could

More information

CSC209 Review. Yeah! We made it!

CSC209 Review. Yeah! We made it! CSC209 Review Yeah! We made it! 1 CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files 2 ... and C programming... C basic syntax functions

More information

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29 UNIX The Very 10 Short Howto for beginners Soon-Hyung Yook March 27, 2015 Soon-Hyung Yook UNIX March 27, 2015 1 / 29 Table of Contents 1 History of Unix 2 What is UNIX? 3 What is Linux? 4 How does Unix

More information

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Introduction to remote command line Linux. Research Computing Team University of Birmingham Introduction to remote command line Linux Research Computing Team University of Birmingham Linux/UNIX/BSD/OSX/what? v All different v UNIX is the oldest, mostly now commercial only in large environments

More information

CST Algonquin College 2

CST Algonquin College 2 The Shell Kernel (briefly) Shell What happens when you hit [ENTER]? Output redirection and pipes Noclobber (not a typo) Shell prompts Aliases Filespecs History Displaying file contents CST8207 - Algonquin

More information

Process Management! Goals of this Lecture!

Process Management! Goals of this Lecture! Process Management! 1 Goals of this Lecture! Help you learn about:" Creating new processes" Programmatically redirecting stdin, stdout, and stderr" (Appendix) communication between processes via pipes"

More information

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes CSE 390a Lecture 2 Exploring Shell Commands, Streams, Redirection, and Processes slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture

More information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010 Unix Basics Benjamin S. Skrainka University College London July 17, 2010 Overview We cover basic Unix survival skills: Why you need some Unix in your life How to get some Unix in your life Basic commands

More information

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

More information

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 3: UNIX Operating System Organization Tian Guo CICS, Umass Amherst 1 Reminders Assignment 2 is due THURSDAY 09/24 at 3:45 pm Directions are on the website

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes Getting to know you Processes A process is an abstraction that supports running programs A sequential stream of execution in its own address space A process is NOT the same as a program! So, two parts

More information

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018 GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux

More information

Linux Systems Administration Getting Started with Linux

Linux Systems Administration Getting Started with Linux Linux Systems Administration Getting Started with Linux Network Startup Resource Center www.nsrc.org These materials are licensed under the Creative Commons Attribution-NonCommercial 4.0 International

More information

What is a Process? Processes and Process Management Details for running a program

What is a Process? Processes and Process Management Details for running a program 1 What is a Process? Program to Process OS Structure, Processes & Process Management Don Porter Portions courtesy Emmett Witchel! A process is a program during execution. Ø Program = static file (image)

More information

Operating Systems. II. Processes

Operating Systems. II. Processes Operating Systems II. Processes Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ @OS Eurecom Outline Concepts Definitions and basic concepts Process

More information

Operating Systems Lab 1 (Users, Groups, and Security)

Operating Systems Lab 1 (Users, Groups, and Security) Operating Systems Lab 1 (Users, Groups, and Security) Overview This chapter covers the most common commands related to users, groups, and security. It will also discuss topics like account creation/deletion,

More information

Introduction. Let s start with the first set of slides

Introduction. Let s start with the first set of slides Tux Wars Class - 1 Table of Contents 1) Introduction to Linux and its history 2) Booting process of a linux system 3) Linux Kernel 4) What is a shell 5) Bash Shell 6) Anatomy of command 7) Let s make our

More information

(a) About Unix. History

(a) About Unix. History Part 1: The Unix Operating System (a) About Unix History First roots in the Bell Laboratories, early 60s Kernel rewrite in C by Ritchie / Thompson in the early 70s Source code licenses for Universities

More information

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one] Data and Computer Security (CMPD414) Lab II Topics: secure login, moving into HOME-directory, navigation on Unix, basic commands for vi, Message Digest This lab exercise is to be submitted at the end of

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

UNIX System Programming Lecture 3: BASH Programming

UNIX System Programming Lecture 3: BASH Programming UNIX System Programming Outline Filesystems Redirection Shell Programming Reference BLP: Chapter 2 BFAQ: Bash FAQ BMAN: Bash man page BPRI: Bash Programming Introduction BABS: Advanced Bash Scripting Guide

More information

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Introduction to UNIX Stephen Pauwels University of Antwerp October 2, 2015 Outline What is Unix? Getting started Streams Exercises UNIX Operating system Servers, desktops,

More information

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering ENG224 Information Technology Part I: Computers and the Internet Laboratory 2 Linux Shell Commands and vi Editor

More information

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12.

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12. CIE- 25 Marks Government of Karnataka Department of Technical Education Bengaluru Course Title: Linux Lab Scheme (L:T:P) : 0:2:4 Total Contact Hours: 78 Type of Course: Tutorial, Practical s & Student

More information