You Want To Know How Many Lines In The Kickoff File Contains 'prize'. Which Of The Following Commands Will Produce The Desired Results?
Using the -c option with the grep command will show the total number of lines containing the specified pattern rather than displaying the lines containing the pattern.
You Want To Verify Which Lines In The File Kickoff Contain 'bob'. Which Of The Following Commands Will Accomplish This?
The -n option when used with sed prints only the lines containing the pattern. In this case, the pattern is ‘Bob’ and the file to be searched is kickoff.
You Have A File Called Docs.z But Do Not Know What It Is. What Is The Easiest Way To Look At The Contents Of The File?
The .Z extension indicates that this is a file that has been compressed using the compress utility. The zcat utility provides the ability to display the contents of a compressed file.
After Copying A File To A Floppy Disk, What Should You Do Before Removing The Disk?
If you do not unmount the floppy before removing it, the files on the floppy may become corrupted.
You Have Set Quotas For All Your Users But Half Of Your Users Are Using More Space Than They Have Been Allotted. Which Of The Following Could Be The Problem?
Quotas are set on a partition by partition basis. If your users have home directories on different partitions, you will need to configure quotas for each partition.
What Is The Real Mean Of Dhcp?
Dynamic addressing simplifies network administration because the s/w keeps track of IP addresses rather than requiring an administrator to manage the task. That means new computer can be added to the network without any risk of manually assigning unique IP address.
What Is Nfs? What Is Its Job?
NFS stands for Network File System. NFS enables filesystems physically residing on one computer system to be used by other computers in the network, appearing to users on the remote host as just another local disk.
In Linux Os, What Is The File Server?
The file server is a machine that shares its disk storage and files with other machines on the network.
What Are The Techniques That You Use To Handle The Collisions In Hash Tables?
We can use two major techniques to handle the collisions. They are open addressing and separate chaining. In open addressing, data items that hash to a full array cell are placed in another cell in the array. In separate chaining, each array element consists of a linked list. All data items hashing to a given array index are inserted in that list.
What Is The Major Advantage Of A Hash Table?
The major advantage of a hash table is its speed. Because the hash function is to take a range of key values and transform them into index values in such a way that the key values are distributed randomly across all the indices of a hash table.
What Is Write Command?
The write command enables you to write an actual message on the other terminal online. You have to issue the write command with the login ID of the user with whom you want to communicate. The write command informs the user at the other end that there is a message from another user. write pastes that message onto the other user’s terminal if their terminal’s write permissions are set. Even if they are in the middle of an edit session, write overwrites whatever is on the screen. The edit session contents are not corrupted; you can restore the original screen on most editors with Ctrl-L. write is mostly used for one-way communication, but you can have an actual conversation as well.
Why You Shouldn't Use The Root Login?
The root login does not restrict you in any way. When you log in as root, you become the system. The root login is also sometimes called the super user login. With one simple command, issued either on purpose or by accident, you can destroy your entire Linux installation. For this reason, use the root login only when necessary. Avoid experimenting with commands when you do log in as root.
How Big Should The Swap-space Partition Be?
Swap space is used as an extension of physical RAM, the more RAM you have, the less swap space is required. You can add the amount of swap space and the amount of RAM together to get the amount of RAM Linux will use. For example, if you have 8MB of RAM on your machine’s motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM.
What Command Should You Use To Check The Number Of Files And Disk Space Used And Each User's Defined Quotas?
The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.
You Have A Large Spreadsheet Located In The /data Directory That Five Different People Need To Be Able To Change. How Can You Enable Each User To Edit The Spreadsheet From Their Individual Home Directories?
By creating a link to the file in each user’s home directory, each user is able to easily open and edit the spreadsheet. Also, any changes that are made are seen by all the users with access.
You Have A File Called Sales Data And Create Symbolic Links To It In Bob's Home Directory. Bob Calls You And Says That His Link No Longer Works. How Can You Fix The Link?
Because the link in bob’s directory is a symbolic link, if the file sales data in the /data directory is deleted, the symbolic link will no longer work.
What Is Meant By Sticky Bit?
When the sticky bit is set on a world writable directory, only the owner can delete any file contained in that directory.
Your Default Umask Is 002. What Does This Mean?
The digits of your umask represent owner, group and others in that order.
The 0 gives read and write for files and the 2 gives read only for files.
Which Of The Following Commands Will Replace All Occurrences Of The Word Rate With The Word Speed In The File Racing?
When using sed to do a search and replace, its default action is to only replace the first occurrence in each line. Adding the ‘g’ makes sed replace all occurrences of the search term even when it occurs multiple times on the same line.
You Have A Tab Delimited File Called Phonenos And Want To Change Each Tab To Four Spaces. What Command Can You Use To Accomplish This?
By default, expand converts tabs to eight spaces. Use the -t option to change this behavior.
You Issue The Command Head * What Would The Resulting Output Be?
If the number of lines to display is not specified, the first ten lines of the specified file are displayed. The asterick tells head to display the content of each file in the present working directory.
What Text Filter Can You Use To Display A Binary File In Octal Numbers?
The od text filter will dumpt the contents of a file and display it in 2-byte octal numbers.
What Would Be The Result Of The Command Paste -s Dog Cat?
The paste text filter usually joins two files separating the corresponding lines with a tab. The -s option, however, will cause paste to display the first file, dog, then a new line character, and then the file cat.
You Wish To Print The File Vacations With 60 Lines To A Page. Which Of The Following Commands Will Accomplish This?
The default page length when using pr is 66 lines. The -l option is used to specify a different length.
What Would Be The Result Of Issuing The Command Cat Phonenos?
The tac text filter is a reverse cat. It displays a file starting with the last line and ending with the first line.
You Need To See The Last Fifteen Lines Of The Files Dog, Cat And Horse. What Command Should You Use?
The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.
Which Field Is Used To Define The User's Default Shell?
command-The last field, called either command or login command, is used to specify what shell the user will use when he logs in.
When You Create A New Partition, You Need To Designate Its Size By Defining The Starting And Ending?
cylinders-When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder.
What Can You Type At A Command Line To Determine Which Shell You Are Using?
echo $SHELL-The name and path to the shell you are using is saved to the SHELL environment variable. You can then use the echo command to print out the value of any variable by preceding the variable’s name with $. Therefore, typing echo $SHELL will display the name of your shell.
In Order To Display The Last Five Commands You Have Entered Using The Fc Command, You Would Type?
fc -5-The fc command can be used to edit or rerun commands you have previously entered. To specify the number of commands to list, use -n.
What Command Should You Use To Check Your File System?
fsck-The fsck command is used to check the integrity of the file system on your disk.
What File Defines The Levels Of Messages Written To System Log Files?
kernel.h-To determine the various levels of messages that are defined on your system, examine the kernel.h file.
What Account Is Created When You Install Linux?
root-Whenever you install Linux, only one user account is created. This is the super user account also known as root.
What Daemon Is Responsible For Tracking Events On Your System?
Syslogd-The syslogd daemon is responsible for tracking system information and saving it to specified log flies.
Where Standard Output Is Usually Directed?
To the screen or display-By default, your shell directs standard output to your screen or display.
What Utility Can You Use To Show A Dynamic Listing Of Running Processes?
Top-The top utility shows a listing of all running processes that is dynamically updated.
Who Owns The Data Dictionary?
The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.
What Command Can You Use To Review Boot Messages?
dmesg
The dmesg command displays the system messages contained in the kernel ring buffer.
By using this command immediately after booting your computer, you will see the boot messages.
Nscd Sometimes Die Itself And Dns Resolving Doesn't Happen Properly. How Can We Avoid Nscd For Dns And There Is A Disadvantage To Bypass It?
nscd is a daemon that provides a cache for the most common name service requests. When resolving a user, group, host, service..., the process will first try to connect to the nscd socket (something like /var/run/nscd/socket).
If nscd has died, the connect will fail, and so nscd won't be used and that should not be a problem.
If it's in a hung state, then the connect may hang or succeed. If it succeeds the client will send its request (give IP address for www.google.com, passwd entries...). Now, you can configure nscd to disable caching for any type of database (for instance by having enable-cache hosts no in /etc/nscd.conf for the hosts database).
However, if nscd is in a hung state, it may not be able to even give that simple won't do , so that won't necessarily help. nscd is a caching daemon, it's meant to improve performance. Disabling it would potentially make those lookups slower. However, that's only true for some kind of databases. For instance, if user/service/group databases are only in small files (/etc/passwd, /etc/group, /etc/services), then using nscd for those will probably bring little benefit if any. nscd will be useful for the hosts database.
How Can I Redirect Both Stderr And Stdin At Once?
command > file.log 2>&1 : Redirect stderr to "where stdout is currently going". In this case, that is a file opened in append mode. In other words, the &1 reuses the file descriptor which stdout currently uses.
command 2>&1 | tee -a file.txt
What Is The Difference Between /dev/random And /dev/urandom To Generate Random Data?
The Random Number Generator gathers environmental noise from device drivers and other sources into entropy pool. It also keeps an estimate of Number of bits of noise in entropy pool. It is from this entropy pool, random numbers are generated.
/dev/random will only return Random bytes from entropy pool. If entropy pool is empty, reads to /dev/random will be blocked until additional environmental noise is gathered. This is suited to high-quality randomnesses, such as one-time pad or key generation.
/dev/urandom will return as many random bytes as requested. But if the entropy pool is empty, it will generate data using SHA, MD5 or any other algorithm. It never blocks the operation. Due to this, the values are vulnerable to theoretical cryptographic attack, though no known methods exist.
For cryptographic purposes, you should really use /dev/random because of nature of data it returns. Possible waiting should be considered as an acceptable tradeoff for the sake of security, IMO. When you need random data fast, you should use /dev/urandom of course.
Both /dev/urandom and /dev/random are using the exact same CSPRNG (a cryptographically secure pseudorandom number generator). They only differ in very few ways that have nothing to do with “true” randomness and /dev/urandom is the preferred source of cryptographic randomness on UNIX-like systems.
What Is The Difference Between Tar And Zip ?
Sometimes sysadmins Linux need to save data safety and to this, it is recommended to compress the data. We have some methods or commands for compression on Linux. So frequently asked s could be why should I use this command instead of another one example, why should I use tar instead of zip. To this, you should know the difference between the two.
tar is only an archiver whereas zip is an archiver and compressor. Tar uses gzip and bzip2 to achieve compression. With using tar command, we preserve metadata information of file and directories like seiuid, setgid and sticky bit information which are very important while zip doesn't preserve theses information. It is very important for criticals information. Other advantages of using tar is the fact that it assembles all the files into a single file to compress directly while zip compress file by file.
Using the -c option with the grep command will show the total number of lines containing the specified pattern rather than displaying the lines containing the pattern.
You Want To Verify Which Lines In The File Kickoff Contain 'bob'. Which Of The Following Commands Will Accomplish This?
The -n option when used with sed prints only the lines containing the pattern. In this case, the pattern is ‘Bob’ and the file to be searched is kickoff.
You Have A File Called Docs.z But Do Not Know What It Is. What Is The Easiest Way To Look At The Contents Of The File?
The .Z extension indicates that this is a file that has been compressed using the compress utility. The zcat utility provides the ability to display the contents of a compressed file.
After Copying A File To A Floppy Disk, What Should You Do Before Removing The Disk?
If you do not unmount the floppy before removing it, the files on the floppy may become corrupted.
You Have Set Quotas For All Your Users But Half Of Your Users Are Using More Space Than They Have Been Allotted. Which Of The Following Could Be The Problem?
Quotas are set on a partition by partition basis. If your users have home directories on different partitions, you will need to configure quotas for each partition.
What Is The Real Mean Of Dhcp?
Dynamic addressing simplifies network administration because the s/w keeps track of IP addresses rather than requiring an administrator to manage the task. That means new computer can be added to the network without any risk of manually assigning unique IP address.
Infosys Frequently Asked Linux Interview Questions Answers |
What Is Nfs? What Is Its Job?
NFS stands for Network File System. NFS enables filesystems physically residing on one computer system to be used by other computers in the network, appearing to users on the remote host as just another local disk.
In Linux Os, What Is The File Server?
The file server is a machine that shares its disk storage and files with other machines on the network.
What Are The Techniques That You Use To Handle The Collisions In Hash Tables?
We can use two major techniques to handle the collisions. They are open addressing and separate chaining. In open addressing, data items that hash to a full array cell are placed in another cell in the array. In separate chaining, each array element consists of a linked list. All data items hashing to a given array index are inserted in that list.
What Is The Major Advantage Of A Hash Table?
The major advantage of a hash table is its speed. Because the hash function is to take a range of key values and transform them into index values in such a way that the key values are distributed randomly across all the indices of a hash table.
What Is Write Command?
The write command enables you to write an actual message on the other terminal online. You have to issue the write command with the login ID of the user with whom you want to communicate. The write command informs the user at the other end that there is a message from another user. write pastes that message onto the other user’s terminal if their terminal’s write permissions are set. Even if they are in the middle of an edit session, write overwrites whatever is on the screen. The edit session contents are not corrupted; you can restore the original screen on most editors with Ctrl-L. write is mostly used for one-way communication, but you can have an actual conversation as well.
Why You Shouldn't Use The Root Login?
The root login does not restrict you in any way. When you log in as root, you become the system. The root login is also sometimes called the super user login. With one simple command, issued either on purpose or by accident, you can destroy your entire Linux installation. For this reason, use the root login only when necessary. Avoid experimenting with commands when you do log in as root.
How Big Should The Swap-space Partition Be?
Swap space is used as an extension of physical RAM, the more RAM you have, the less swap space is required. You can add the amount of swap space and the amount of RAM together to get the amount of RAM Linux will use. For example, if you have 8MB of RAM on your machine’s motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM.
What Command Should You Use To Check The Number Of Files And Disk Space Used And Each User's Defined Quotas?
The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.
You Have A Large Spreadsheet Located In The /data Directory That Five Different People Need To Be Able To Change. How Can You Enable Each User To Edit The Spreadsheet From Their Individual Home Directories?
By creating a link to the file in each user’s home directory, each user is able to easily open and edit the spreadsheet. Also, any changes that are made are seen by all the users with access.
You Have A File Called Sales Data And Create Symbolic Links To It In Bob's Home Directory. Bob Calls You And Says That His Link No Longer Works. How Can You Fix The Link?
Because the link in bob’s directory is a symbolic link, if the file sales data in the /data directory is deleted, the symbolic link will no longer work.
What Is Meant By Sticky Bit?
When the sticky bit is set on a world writable directory, only the owner can delete any file contained in that directory.
Your Default Umask Is 002. What Does This Mean?
The digits of your umask represent owner, group and others in that order.
The 0 gives read and write for files and the 2 gives read only for files.
Which Of The Following Commands Will Replace All Occurrences Of The Word Rate With The Word Speed In The File Racing?
When using sed to do a search and replace, its default action is to only replace the first occurrence in each line. Adding the ‘g’ makes sed replace all occurrences of the search term even when it occurs multiple times on the same line.
You Have A Tab Delimited File Called Phonenos And Want To Change Each Tab To Four Spaces. What Command Can You Use To Accomplish This?
By default, expand converts tabs to eight spaces. Use the -t option to change this behavior.
You Issue The Command Head * What Would The Resulting Output Be?
If the number of lines to display is not specified, the first ten lines of the specified file are displayed. The asterick tells head to display the content of each file in the present working directory.
What Text Filter Can You Use To Display A Binary File In Octal Numbers?
The od text filter will dumpt the contents of a file and display it in 2-byte octal numbers.
What Would Be The Result Of The Command Paste -s Dog Cat?
The paste text filter usually joins two files separating the corresponding lines with a tab. The -s option, however, will cause paste to display the first file, dog, then a new line character, and then the file cat.
You Wish To Print The File Vacations With 60 Lines To A Page. Which Of The Following Commands Will Accomplish This?
The default page length when using pr is 66 lines. The -l option is used to specify a different length.
What Would Be The Result Of Issuing The Command Cat Phonenos?
The tac text filter is a reverse cat. It displays a file starting with the last line and ending with the first line.
You Need To See The Last Fifteen Lines Of The Files Dog, Cat And Horse. What Command Should You Use?
The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.
Which Field Is Used To Define The User's Default Shell?
command-The last field, called either command or login command, is used to specify what shell the user will use when he logs in.
When You Create A New Partition, You Need To Designate Its Size By Defining The Starting And Ending?
cylinders-When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder.
What Can You Type At A Command Line To Determine Which Shell You Are Using?
echo $SHELL-The name and path to the shell you are using is saved to the SHELL environment variable. You can then use the echo command to print out the value of any variable by preceding the variable’s name with $. Therefore, typing echo $SHELL will display the name of your shell.
In Order To Display The Last Five Commands You Have Entered Using The Fc Command, You Would Type?
fc -5-The fc command can be used to edit or rerun commands you have previously entered. To specify the number of commands to list, use -n.
What Command Should You Use To Check Your File System?
fsck-The fsck command is used to check the integrity of the file system on your disk.
What File Defines The Levels Of Messages Written To System Log Files?
kernel.h-To determine the various levels of messages that are defined on your system, examine the kernel.h file.
What Account Is Created When You Install Linux?
root-Whenever you install Linux, only one user account is created. This is the super user account also known as root.
What Daemon Is Responsible For Tracking Events On Your System?
Syslogd-The syslogd daemon is responsible for tracking system information and saving it to specified log flies.
Where Standard Output Is Usually Directed?
To the screen or display-By default, your shell directs standard output to your screen or display.
What Utility Can You Use To Show A Dynamic Listing Of Running Processes?
Top-The top utility shows a listing of all running processes that is dynamically updated.
Who Owns The Data Dictionary?
The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.
What Command Can You Use To Review Boot Messages?
dmesg
The dmesg command displays the system messages contained in the kernel ring buffer.
By using this command immediately after booting your computer, you will see the boot messages.
Nscd Sometimes Die Itself And Dns Resolving Doesn't Happen Properly. How Can We Avoid Nscd For Dns And There Is A Disadvantage To Bypass It?
nscd is a daemon that provides a cache for the most common name service requests. When resolving a user, group, host, service..., the process will first try to connect to the nscd socket (something like /var/run/nscd/socket).
If nscd has died, the connect will fail, and so nscd won't be used and that should not be a problem.
If it's in a hung state, then the connect may hang or succeed. If it succeeds the client will send its request (give IP address for www.google.com, passwd entries...). Now, you can configure nscd to disable caching for any type of database (for instance by having enable-cache hosts no in /etc/nscd.conf for the hosts database).
However, if nscd is in a hung state, it may not be able to even give that simple won't do , so that won't necessarily help. nscd is a caching daemon, it's meant to improve performance. Disabling it would potentially make those lookups slower. However, that's only true for some kind of databases. For instance, if user/service/group databases are only in small files (/etc/passwd, /etc/group, /etc/services), then using nscd for those will probably bring little benefit if any. nscd will be useful for the hosts database.
How Can I Redirect Both Stderr And Stdin At Once?
command > file.log 2>&1 : Redirect stderr to "where stdout is currently going". In this case, that is a file opened in append mode. In other words, the &1 reuses the file descriptor which stdout currently uses.
command 2>&1 | tee -a file.txt
What Is The Difference Between /dev/random And /dev/urandom To Generate Random Data?
The Random Number Generator gathers environmental noise from device drivers and other sources into entropy pool. It also keeps an estimate of Number of bits of noise in entropy pool. It is from this entropy pool, random numbers are generated.
/dev/random will only return Random bytes from entropy pool. If entropy pool is empty, reads to /dev/random will be blocked until additional environmental noise is gathered. This is suited to high-quality randomnesses, such as one-time pad or key generation.
/dev/urandom will return as many random bytes as requested. But if the entropy pool is empty, it will generate data using SHA, MD5 or any other algorithm. It never blocks the operation. Due to this, the values are vulnerable to theoretical cryptographic attack, though no known methods exist.
For cryptographic purposes, you should really use /dev/random because of nature of data it returns. Possible waiting should be considered as an acceptable tradeoff for the sake of security, IMO. When you need random data fast, you should use /dev/urandom of course.
Both /dev/urandom and /dev/random are using the exact same CSPRNG (a cryptographically secure pseudorandom number generator). They only differ in very few ways that have nothing to do with “true” randomness and /dev/urandom is the preferred source of cryptographic randomness on UNIX-like systems.
What Is The Difference Between Tar And Zip ?
Sometimes sysadmins Linux need to save data safety and to this, it is recommended to compress the data. We have some methods or commands for compression on Linux. So frequently asked s could be why should I use this command instead of another one example, why should I use tar instead of zip. To this, you should know the difference between the two.
tar is only an archiver whereas zip is an archiver and compressor. Tar uses gzip and bzip2 to achieve compression. With using tar command, we preserve metadata information of file and directories like seiuid, setgid and sticky bit information which are very important while zip doesn't preserve theses information. It is very important for criticals information. Other advantages of using tar is the fact that it assembles all the files into a single file to compress directly while zip compress file by file.
Post a Comment