- What is a shell?
- What are the different types of commonly used shells on a typical linux system?
- What is the equivalent of a file shortcut that we have on window on a Linux system?
- What is the difference between soft and hard links?
- How will you pass and access arguments to a script in Linux?
- What is the significance of $#?
- What is the difference between $* and $@?
- Use sed command to replace the content of the file (emulate tac command)
- Given a file , write a command sequence to find the count of each word.
- How will you find the 99th line of a file using only tail and head command?
- Print the 10th line without using tail and head command.
- In my bash shell I want my prompt to be of format ‘$”Present working directory”:”hostname”> and load a file containing a list of user defined functions as soon as I login , how will you automate this?
- Explain about “s” permission bit in a file?
- I want to create a directory such that anyone in the group can create a file and access any person’s file in it but none should be able to delete a file other than the one created by himself.
- How can you find out how long the system has been running?
- How can any user find out all information about a specific user like his default shell, real life name, default directory,when and how long he has been using the sytem?
- What is the difference between $$ and $!?
- What are zombie processes?
- How will you copy file from one machine to other?
- I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
- I want to connect to a remote server and execute some commands, how can I achieve this?
- I have 2 files and I want to print the records which are common to both.
- Write a script to print the first 10 elemenst of Fibonacci series.
- How will you connect to a database server from linux?
- What are the 3 standard streams in Linux?
- I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?
- What will happen to my current process when I execute a command using exec?
- How will you emulate wc –l using awk?
- Given a file find the count of lines containing word “ABC”.
- What is the difference between grep and egrep?
- How will you print the login names of all users on a system?
- How to set an array in Linux?
- Write down the syntax of “for “ loop
- How will you find the total disk space used by a specific user?
- Write the syntax for “if” conditionals in linux?
- What is the significance of $? ?
- How do we delete all blank lines in a file?
- How will I insert a line “ABCDEF” at every 100th line of a file?
- Write a command sequence to find all the files modified in less than 2 days and print the record count of each.
- How can I set the default rwx permission to all users on every file which is created in the current shell?
- How can we find the process name from its process id?
- What are the four fundamental components of every file system on linux?
- What is a boot block?
- What is a super block?
- What is an inode block?
- How can I send a mail with a compressed file as an attachment?
- How do we create command aliases in shell?
- What are “c” and “b” permission fields of a file?
- What is the use of a shebang line?
Shell is a interface between user and the kernel. Even though there can be only one kernel ; a system can have many shell running simultaneously . Whenever a user enters a command through keyboard the shell communicates with the kernel to execute it and then display the output to the user.
csh,ksh,bash,Bourne . The most commonly used and advanced shell used today is “Bash” .
Shortcuts are created using “links” on Linux. There are two types of links that can be used namely “soft link” and “hard link”
Soft links are link to the file name and can reside on different filesytem as well; however hard links are link to the inode of the file and has to be on the same filesytem as that of the file. Deleting the orginal file makes the soft link inactive (broken link) but does not affect the hard link (Hard link will still access a copy of the file)
Arguments can be passed as:
scriptName “Arg1” “Arg2”….”Argn” and can be accessed inside the script as $1 , $2 .. $n
$# shows the count of the arguments passed to the script.
$@ treats each quoted arguments as separate arguments but $* will consider the entire set of positional parameters as a single string.
if cat file1
Then O/p should be
sed ‘1! G; h;$!d’ file1
Here G command appends to the pattern space,
h command copies pattern buffer to hold buffer
and d command deletes the current pattern space.
tr –s “(backslash)040” <file1|tr –s “(backslash)011”|tr “(backslash)040 (backslash)011” “(backslash)012” |uniq –c
where “(backslash)040” is octal equivalent of “space”
”(backslash)011” is octal equivalent of “tab character” and
“(backslash)012” is octal equivalent of newline character.