Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Friday 1 November 2013

Linux admin Interview Questions ( 100 linux administration interview questions )


  1. You attempt to use shadow passwords but are unsuccessful. What characteristic of the /etc/passwd file may cause this? Choose one: a. The login command is missing. b. The username is too long. c. The password field is blank. d. The password field is prefaced by an asterick.
  2. You create a new user account by adding the following line to your /etc/passwd file. bobm:baddog:501:501:Bob Morris:/home/bobm:/bin/bash Bob calls you and tells you that he cannot logon. You verify that he is using the correct username and password. What is the problem? Choose one: a. The UID and GID cannot be identical. b. You cannot have spaces in the line unless they are surrounded with double quotes. c. You cannot directly enter the password; rather you have to use the passwd command to assign a password to the user. d. The username is too short, it must be at least six characters long.
  3. Which of the following tasks is not necessary when creating a new user by editing the /etc/passwd file? Choose one: a. Create a link from the user’s home directory to the shell the user will use. b. Create the user’s home directory c. Use the passwd command to assign a password to the account. d. Add the user to the specified group.
  4. You create a new user by adding the following line to the /etc/passwd file bobm::501:501:Bob Morris:/home/bobm:/bin/bash You then create the user’s home directory and use the passwd command to set his password. However, the user calls you and says that he cannot log on. What is the problem? Choose one: a. The user did not change his password. b. bobm does not have permission to /home/bobm. c. The user did not type his username in all caps. d. You cannot leave the password field blank when creating a new user.
  5. When using useradd to create a new user account, which of the following tasks is not done automatically. Choose one: a. Assign a UID. b. Assign a default shell. c. Create the user’s home directory. d. Define the user’s home directory.
  6. You issue the following command useradd -m bobm But the user cannot logon. What is the problem? Choose one: a. You need to assign a password to bobm’s account using the passwd command. b. You need to create bobm’s home directory and set the appropriate permissions. c. You need to edit the /etc/passwd file and assign a shell for bobm’s account. d. The username must be at least five characters long.
  7. You have created special configuration files that you want copied to each user’s home directories when creating new user accounts. You copy the files to /etc/skel. Which of the following commands will make this happen? Choose one: a. useradd -m username b. useradd -mk username c. useradd -k username d. useradd -Dk username
  8. Mary has recently gotten married and wants to change her username from mstone to mknight. Which of the following commands should you run to accomplish this? Choose one: a. usermod -l mknight mstone b. usermod -l mstone mknight c. usermod -u mknight mstone d. usermod -u mstone mknight
  9. After bob leaves the company you issue the command userdel bob. Although his entry in the /etc/passwd file has been deleted, his home directory is still there. What command could you have used to make sure that his home directory was also deleted? Choose one: a. userdel -m bob b. userdel -u bob c. userdel -l bob d. userdel -r bob
  10. All groups are defined in the /etc/group file. Each entry contains four fields in the following order. Choose one: a. groupname, password, GID, member list b. GID, groupname, password, member list c. groupname, GID, password, member list d. GID, member list, groupname, password
  11. You need to create a new group called sales with Bob, Mary and Joe as members. Which of the following would accomplish this? Choose one: a. Add the following line to the /etc/group file: sales:44:bob,mary,joe b. Issue the command groupadd sales. c. Issue the command groupadd -a sales bob,mary,joe d. Add the following line to the /etc/group file: sales::44:bob,mary,joe
  12. What command is used to remove the password assigned to a group?
  13. You changed the GID of the sales group by editing the /etc/group file. All of the members can change to the group without any problem except for Joe. He cannot even login to the system. What is the problem? Choose one: a. Joe forgot the password for the group. b. You need to add Joe to the group again. c. Joe had the original GID specified as his default group in the /etc/passwd file. d. You need to delete Joe’s account and recreate it.
  14. You need to delete the group dataproject. Which two of the following tasks should you do first before deleting the group? A. Check the /etc/passwd file to make sure no one has this group as his default group. B. Change the members of the dataproject group to another group besides users. C. Make sure that the members listed in the /etc/group file are given new login names. D. Verify that no file or directory has this group listed as its owner. Choose one: a. A and C b. A and D c. B and C d. B and D
  15. When you look at the /etc/group file you see the group kmem listed. Since it does not own any files and no one is using it as a default group, can you delete this group?
  16. When looking at the /etc/passwd file, you notice that all the password fields contain ‘x’. What does this mean? Choose one: a. That the password is encrypted. b. That you are using shadow passwords. c. That all passwords are blank. d. That all passwords have expired.
  17. In order to improve your system’s security you decide to implement shadow passwords. What command should you use?
  18. What file contains the default environment variables when using the bash shell? Choose one: a. ~/.profile b. /bash c. /etc/profile d. ~/bash
  19. You have created a subdirectory of your home directory containing your scripts. Since you use the bash shell, what file would you edit to put this directory on your path? Choose one: a. ~/.profile b. /etc/profile c. /etc/bash d. ~/.bash
  20. Which of the following interprets your actions when typing at the command line for the operating system? Choose One a. Utility b. Application c. Shell d. Command
  21. What can you type at a command line to determine which shell you are using?
  22. You want to enter a series of commands from the command-line. What would be the quickest way to do this? Choose One a. Press enter after entering each command and its arguments b. Put them in a script and execute the script c. Separate each command with a semi-colon (;) and press enter after the last command d. Separate each command with a / and press enter after the last command
  23. You are entering a long, complex command line and you reach the right side of your screen before you have finished typing. You want to finish typing the necessary commands but have the display wrap around to the left. Which of the following key combinations would achieve this? Choose One a. Esc, /, Enter b. /, Enter c. ctrl-d, enter d. esc, /, ctrl-d
  24. After typing in a new command and pressing enter, you receive an error message indicating incorrect syntax. This error message originated from.. Choose one a. The shell b. The operating system c. The command d. The kernel
  25. When typing at the command line, the default editor is the _____________ library.
  26. You typed the following at the command line ls -al /home/ hadden. What key strokes would you enter to remove the space between the ‘/’ and ‘hadden’ without having to retype the entire line? Choose one a. Ctrl-B, Del b. Esc-b, Del c. Esc-Del, Del d. Ctrl-b, Del
  27. You would like to temporarily change your command line editor to be vi. What command should you type to change it?
  28. After experimenting with vi as your command line editor, you decide that you want to have vi your default editor every time you log in. What would be the appropriate way to do this? Choose one a. Change the /etc/inputrc file b. Change the /etc/profile file c. Change the ~/.inputrc file d. Change the ~/.profile file
  29. You have to type your name and title frequently throughout the day and would like to decrease the number of key strokes you use to type this. Which one of your configuration files would you edit to bind this information to one of the function keys?
  30. In your present working directory, you have the files maryletter memo1 MyTelephoneandAddressBook What is the fewest number of keys you can type to open the file MyTelephoneandAddressBook with vi? Choose one a. 6 b. 28 c. 25 d. 4
  31. A variable that you can name and assign a value to is called a _____________ variable.
  32. You have installed a new application but when you type in the command to start it you get the error message Command not found. What do you need to do to fix this problem? Choose one a. Add the directory containing the application to your path b. Specify the directory’s name whenever you run the application c. Verify that the execute permission has been applied to the command. d. Give everyone read, write and execute permission to the application’s directory.
  33. You telnet into several of your servers simultaneously. During the day, you sometimes get confused as to which telnet session is connected to which server. Which of the following commands in your .profile file would make it obvious to which server you are attached? Choose one a. PS1=’\h: \w>’ b. PS1=’\s: \W>’ c. PS1=’\!: \t>’ d. PS1=’\a: \n>’
  34. Which of the following environment variables determines your working directory at the completion of a successful login? Choose one a. HOME b. BASH_ENV c. PWD d. BLENDERDIR
  35. Every time you attempt to delete a file using the rm utility, the operating system prompts you for confirmation. You know that this is not the customary behavior for the rm command. What is wrong? Choose one a. rm has been aliased as rm -i b. The version of rm installed on your system is incorrect. c. This is the normal behavior of the newest version of rm. d. There is an incorrect link on your system.
  36. You are running out of space in your home directory. While looking for files to delete or compress you find a large file called .bash_history and delete it. A few days later, it is back and as large as before. What do you need to do to ensure that its size is smaller? Choose one a. Set the HISTFILESIZE variable to a smaller number. b. Set the HISTSIZE to a smaller number. c. Set the NOHISTFILE variable to true. d. Set the HISTAPPEND variable to true.
  37. In order to display the last five commands you have entered using the history command, you would type ___________.
  38. In order to display the last five commands you have entered using the fc command, you would type ___________.
  39. You previously ran the find command to locate a particular file. You want to run that command again. What would be the quickest way to do this? Choose one a. fc -l find fc n b. history -l find history n c. Retype the command d. fc -n find
  40. Using command substitution, how would you display the value of the present working directory? Choose one a. echo $(pwd) b. echo pwd c. $pwd d. pwd | echo
  41. You need to search the entire directory structure to locate a specific file. How could you do this and still be able to run other commands while the find command is still searching for your file? Choose one a. find / -name filename & b. find / -name filename c. bg find / -name filename d. &find / -name filename &
  42. In order to create a file called DirContents containing the contents of the /etc directory you would type ____________.
  43. What would be displayed as the result of issuing the command ps ef? Choose one a. A listing of the user’s running processes formatted as a tree. b. A listing of the stopped processes c. A listing of all the running processes formatted as a tree. d. A listing of all system processes formatted as a tree.
  44. What utility can you use to show a dynamic listing of running processes? __________
  45. The top utility can be used to change the priority of a running process? Another utility that can also be used to change priority is ___________?
  46. What key combination can you press to suspend a running job and place it in the background?
  47. You issue the command jobs and receive the following output: [1]- Stopped (tty output) pine [2]+ Stopped (tty output) MyScript How would you bring the MyScript process to the foreground? Choose one: a. fg %2 b. ctrl-c c. fg MyScript d. ctrl-z
  48. You enter the command cat MyFile | sort > DirList & and the operating system displays [4] 3499 What does this mean? Choose one a. This is job number 4 and the PID of the sort command is 3499. b. This is job number 4 and the PID of the job is 3499. c. This is job number 3499 and the PID of the cat command is 4. d. This is job number 4 and the PID of the cat command is 3499.
  49. You attempt to log out but receive an error message that you cannot. When you issue the jobs command, you see a process that is running in the background. How can you fix this so that you can logout? Choose one a. Issue the kill command with the PID of each running command of the pipeline as an argument. b. Issue the kill command with the job number as an argument. c. Issue the kill command with the PID of the last command as an argument. d. Issue the kill command without any arguments.
  50. You have been given the job of administering a new server. It houses a database used by the sales people. This information is changed frequently and is not duplicated anywhere else. What should you do to ensure that this information is not lost? Choose one a. Create a backup strategy that includes backing up this information at least daily. b. Prepare a proposal to purchase a backup server c. Recommend that the server be made part of a cluster. d. Install an additional hard drive in the server.
  51. When planning your backup strategy you need to consider how often you will perform a backup, how much time the backup takes and what media you will use. What other factor must you consider when planning your backup strategy? _________
  52. Many factors are taken into account when planning a backup strategy. The one most important one is how often does the file ____________.
  53. Which one of the following factors does not play a role in choosing the type of backup media to use? Choose one: a. How frequently a file changes b. How long you need to retain the backup c. How much data needs to be backed up d. How frequently the backed up data needs to be accessed
  54. When you only back up one partition, this is called a ______ backup. Choose one a. Differential b. Full c. Partial d. Copy
  55. When you back up only the files that have changed since the last backup, this is called a ______ backup. Choose one a. Partial b. Differential c. Full d. Copy
  56. The easiest, most basic form of backing up a file is to _____ it to another location.
  57. When is the most important time to restore a file from your backup? Choose one a. On a regular scheduled basis to verify that the data is available. b. When the system crashes. c. When a user inadvertently loses a file. d. When your boss asks to see how restoring a file works.
  58. As a system administrator, you are instructed to backup all the users’ home directories. Which of the following commands would accomplish this? Choose one a. tar rf usersbkup home/* b. tar cf usersbkup home/* c. tar cbf usersbkup home/* d. tar rvf usersbkup home/*
  59. What is wrong with the following command? tar cvfb / /dev/tape 20 Choose one a. You cannot use the c option with the b option. b. The correct line should be tar -cvfb / /dev/tape20. c. The arguments are not in the same order as the corresponding modifiers. d. The files to be backed up have not been specified.
  60. You need to view the contents of the tarfile called MyBackup.tar. What command would you use? __________
  61. After creating a backup of the users’ home directories called backup.cpio you are asked to restore a file called memo.ben. What command should you type?
  62. You want to create a compressed backup of the users’ home directories so you issue the command gzip /home/* backup.gz but it fails. The reason that it failed is that gzip will only compress one _______ at a time.
  63. You want to create a compressed backup of the users’ home directories. What utility should you use?
  64. You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it, use the _________ utility.
  65. Which two utilities can you use to set up a job to run at a specified time? Choose one: a. at and crond b. atrun and crontab c. at and crontab d. atd and crond
  66. You have written a script called usrs to parse the passwd file and create a list of usernames. You want to have this run at 5 am tomorrow so you can see the results when you get to work. Which of the following commands will work? Choose one: a. at 5:00 wed usrs b. at 5:00 wed -b usrs c. at 5:00 wed -l usrs d. at 5:00 wed -d usrs
  67. Several of your users have been scheduling large at jobs to run during peak load times. How can you prevent anyone from scheduling an at job? Choose one: a. delete the file /etc/at.deny b. create an empty file called /etc/at.deny c. create two empty files: /etc/at.deny and /etc/at.allow file d. create an empty file called /etc/at.allow
  68. How can you determine who has scheduled at jobs? Choose one: a. at -l b. at -q c. at -d d. atwho
  69. When defining a cronjob, there are five fields used to specify when the job will run. What are these fields and what is the correct order? Choose one: a. minute, hour, day of week, day of month, month b. minute, hour, month, day of month, day of week c. minute, hour, day of month, month, day of week d. hour, minute, day of month, month, day of week
  70. You have entered the following cronjob. When will it run? 15 * * * 1,3,5 myscript Choose one: a. at 15 minutes after every hour on the 1st, 3rd and 5th of each month. b. at 1:15 am, 3:15 am, and 5:15 am every day c. at 3:00 pm on the 1st, 3rd, and 5th of each month d. at 15 minutes after every hour every Monday, Wednesday, and Friday
  71. As the system administrator you need to review Bob’s cronjobs. What command would you use? Choose one: a. crontab -lu bob b. crontab -u bob c. crontab -l d. cronq -lu bob
  72. In order to schedule a cronjob, the first task is to create a text file containing the jobs to be run along with the time they are to run. Which of the following commands will run the script MyScript every day at 11:45 pm? Choose one: a. * 23 45 * * MyScript b. 23 45 * * * MyScript c. 45 23 * * * MyScript d. * * * 23 45 MyScript
  73. Which daemon must be running in order to have any scheduled jobs run as scheduled? Choose one: a. crond b. atd c. atrun d. crontab
  74. You want to ensure that your system is not overloaded with users running multiple scheduled jobs. A policy has been established that only the system administrators can create any scheduled jobs. It is your job to implement this policy. How are you going to do this? Choose one: a. create an empty file called /etc/cron.deny b. create a file called /etc/cron.allow which contains the names of those allowed to schedule jobs. c. create a file called /etc/cron.deny containing all regular usernames. d. create two empty files called /etc/cron.allow and /etc/cron.deny
  75. You notice that your server load is exceptionally high during the hours of 10 am to 2 noon. When investigating the cause, you suspect that it may be a cron job scheduled by one of your users. What command can you use to determine if your suspicions are correct? Choose one: a. crontab -u b. crond -u c. crontab -l d. crond -l
  76. One of your users, Bob, has created a script to reindex his database. Now he has it scheduled to run every day at 10:30 am. What command should you use to delete this job. Choose one: a. crontab -ru bob b. crontab -u bob c. crontab -du bob d. crontab -lu bob
  77. What daemon is responsible for tracking events on your system?
  78. What is the name and path of the default configuration file used by the syslogd daemon?
  79. You have made changes to the /etc/syslog.conf file. Which of the following commands will cause these changes to be implemented without having to reboot your computer? Choose one: a. kill SIGHINT `cat /var/run/syslogd.pid` b. kill SIGHUP `cat /var/run/syslogd.pid` c. kill SIGHUP syslogd d. kill SIGHINT syslogd
  80. Which of the following lines in your /etc/syslog.conf file will cause all critical messages to be logged to the file /var/log/critmessages? Choose one: a. *.=crit /var/log/critmessages b. *crit /var/log/critmessages c. *=crit /var/log/critmessages d. *.crit /var/log/critmessages
  81. You wish to have all mail messages except those of type info to the /var/log/mailmessages file. Which of the following lines in your /etc/syslogd.conf file would accomplish this? Choose one: a. mail.*;mail!=info /var/log/mailmessages b. mail.*;mail.=info /var/log/mailmessages c. mail.*;mail.info /var/log/mailmessages d. mail.*;mail.!=info /var/log/mailmessages
  82. What is the name and path of the main system log?
  83. Which log contains information on currently logged in users? Choose one: a. /var/log/utmp b. /var/log/wtmp c. /var/log/lastlog d. /var/log/messages
  84. You have been assigned the task of determining if there are any user accounts defined on your system that have not been used during the last three months. Which log file should you examine to determine this information? Choose one: a. /var/log/wtmp b. /var/log/lastlog c. /var/log/utmp d. /var/log/messages
  85. You have been told to configure a method of rotating log files on your system. Which of the following factors do you not need to consider? Choose one: a. date and time of messages b. log size c. frequency of rotation d. amount of available disk space
  86. What utility can you use to automate rotation of logs?
  87. You wish to rotate all your logs weekly except for the /var/log/wtmp log which you wish to rotate monthly. How could you accomplish this. Choose one: a. Assign a global option to rotate all logs weekly and a local option to rotate the /var/log/wtmp log monthly. b. Assign a local option to rotate all logs weekly and a global option to rotate the /var/log/wtmp log monthly. c. Move the /var/log/wtmp log to a different directory. Run logrotate against the new location. d. Configure logrotate to not rotate the /var/log/wtmp log. Rotate it manually every month.
  88. You have configured logrotate to rotate your logs weekly and keep them for eight weeks. You are running our of disk space. What should you do? Choose one: a. Quit using logrotate and manually save old logs to another location. b. Reconfigure logrotate to only save logs for four weeks. c. Configure logrotate to save old files to another location. d. Use the prerotate command to run a script to move the older logs to another location.
  89. What command can you use to review boot messages?
  90. What file defines the levels of messages written to system log files?
  91. What account is created when you install Linux?
  92. While logged on as a regular user, your boss calls up and wants you to create a new user account immediately. How can you do this without first having to close your work, log off and logon as root? Choose one: a. Issue the command rootlog. b. Issue the command su and type exit when finished. c. Issue the command su and type logoff when finished. d. Issue the command logon root and type exit when finished.
  93. Which file defines all users on your system? Choose one: a. /etc/passwd b. /etc/users c. /etc/password d. /etc/user.conf
  94. There are seven fields in the /etc/passwd file. Which of the following lists all the fields in the correct order? Choose one: a. username, UID, GID, home directory, command, comment b. username, UID, GID, comment, home directory, command c. UID, username, GID, home directory, comment, command d. username, UID, group name, GID, home directory, comment
  95. Which of the following user names is invalid? Choose one: a. Theresa Hadden b. thadden c. TheresaH d. T.H.
  96. In order to prevent a user from logging in, you can add a(n) ________at the beginning of the password field.
  97. The beginning user identifier is defined in the _________ file.
  98. Which field is used to define the user’s default shell?
  99. Bob Armstrong, who has a username of boba, calls to tell you he forgot his password. What command should you use to reset his command?
  100. Your company has implemented a policy that users’ passwords must be reset every ninety days. Since you have over 100 users you created a file with each username and the new password. How are you going to change the old passwords to the new ones? Choose one: a. Use the chpasswd command along with the name of the file containing the new passwords. b. Use the passwd command with the -f option and the name of the file containing the new passwords. c. Open the /etc/passwd file in a text editor and manually change each password. d. Use the passwd command with the -u option.

Imp Port NumberS in linux



Question: What Is a Port Number?
Answer: In computer networking, a port number is part of the addressing information used to identify the senders and receivers of messages. Port numbers are most commonly used with TCP/IP connections. Home network routers and computer software work with ports and sometimes allow you to configure port number settings. These port numbers allow different applications on the same computer to share network resources simultaneously.
 
How Port Numbers Work:
Port numbers are associated with network addresses. For example, in TCP/IP networking, both TCP and UDP utilize their own set of ports that work together with IP addresses.
Port numbers work like telephone extensions. Just as a business telephone switchboard can use a main phone number and assign each employee an extension number (like x100, x101, etc.), so a computer has a main address and a set of port numbers to handle incoming and outgoing connections.
In both TCP and UDP, port numbers start at 0 and go up to 65535. Numbers in the lower ranges are dedicated to common Internet protocols (like 21 for FTP, 80 for HTTP, etc.).

?: why we r useing port numbers pls reply me
A: Ports are used to identify the type of service out of junk traffic

==================================
Some important port numbers

There are huge number of ports which are reserved. But the ports mentioned below are more important.
IMPORTANT PORTS:
=============================
Important Linux Port Numbers
15 – Netstat
20 --FTP Data
21 => FTP
22 => SSH
23 => Telnet
25 => SMTP Mail Transfer
37 – Time
42 – WINS
43 => WHOIS service
53 => name server (DNS)
67 – DHCP SERVER
68 – DHCP CLIENT
69 --TFTP
80 => HTTP (Web server)
443 -- HTTPS(SSL (https) (http protocol over TLS/SSL)
88 – Kerberos
101 – HOSTNAME
109 -- POP2
110 => POP protocol (for email)
123 – NTP (Network time protocol)
137-NetBIOS
161 – SNMP
143 -- IMAP
220 – IMAP3
995 => POP over SSL/TLS
9999 => Urchin
111 => rpcbind
953 => rndc
143 => IMAP Protocol (for email)
993 => IMAP Secure
443 => HTTP Secure (SSL for https:// )
500 – Internet Key Exchange, IKE (IPSec) (UDP 500
546-DHCPv6 client
547-DHCPv6 serveR
3306 = > MysQL Server
4643 => Virtuosso Power Panel
2082 => CPANEL
2083 => CPANEL - Secure/SSL
2086 => CPANEL WHM
2087 => CPANEL WHM - Secure/SSL
2095 => cpanel webmail
2096 => cpanel webmail - secure/SSL
3306 => SQL
Plesk Control Panel => 8443
DirectAdmin Control Panel => 2222
Webmin Control Panel => 10000

FAQs
1. How to find which ports are open?
You can find the ports in your linux server with the nmap command
netstat -nap --tcp

2. How to investigate a port and kill suspicious process?
A good tutorial is here

3. Where do i find a complete list of linux ports for reference?
You can find the ports list: here

4. Which firewall is best for linux servers?
I would recommend to install APF firewall. You can find a good tutorial here: http://www.mysql-apache-php.com/apf-firewall.htm
Warning: Make sure that you dont block the important ports with the firewall.

A port is a communication point where one or more computers in a network communicate with each other through a program or software

Difference TCP vs UDP Protocol 

 
TCP/IP Protocol:
It is a connection oriented protocol
It has flow control and error correction
It is not fast and primarily used for data transmission like (http,ssh,smtp,ftp, mail etc.) 
Most common services requiring confirmation of delivery like http,ssh,smtp,ftp, mail etc. use TCP ports
Asked for authentication like user name and password

UDP Protocol:
It is connectionless protocol which means it can send packets without establishing connection with the receiver at first.  
It is error prone during transmission.
It is fast and used mostly for audio and video streaming.
UDP ports are commonly used by services or programs that dont require the confirmation of delivery of packets. Most commonly used is DNS queries using UDP port 53.
no

Sys Admin L1, L2, and L3 ?

What is the definition of L1, L2 and L3 UNIX / Linux / IT support?
Generally L1, L2, and L3 support apply to any form of technical support such as mobile phones, electronics devices, computers, servers, and networking devices. All levels have different meanings and differ slightly from company to company and IT support groups. Basically, each person working at each level must have more experience and education in the field of support than its previous level. 
L1 is nothing but Level 1 support which is provided by a call center support person or engineer. L1 tech usually follows certain steps to solve the problem. In other words L1 will ask you various questions and some sort of software will be used to map your answers to further questions. L1 support takes your requests using the telephone, email or chat sessions. This kind of support engineers are are trained on the product with limited experience. They should able to resolve 50%-60% of all problems. For example, restart failed httpd service can be handled by L1.
If L1 support failed to solve your problem than it is escalated to L2 (Level 2) support engineer. L2 support will try to find out exact causes of the problems. Almost all L2 engineers are a subject matter expert with 3-5 years rocks solid experience. For example, if httpd can not be started after server reboot than L2 tech who is httpd and UNIX subject matter expert can try to resolve the problem using various debugging methods. 
If L2 support failed to resolve your problem than it is escalated to L3 (Level 3) support professional. Usually, L3 support works closely with product engineering team or with source code itself with various debugging tools. L3 support only handles very difficult support cases. 
Please note that some companies offer certain levels of support such as L3 only on a fee basis.

LINUX INTERVIEW QUESTIONS

xxxxxxxxxxxxxxxxxxxxx  Linux Interview Questions xxxxxxxxxxxxxxxxxxxxxx

I know for a beginner how tough to find which types of question an interviewer will ask to ?? ...

Ohhh!!! I can't forget myne 1st interview with Directi for Linux profile ...I was aware of all the questions answers that they asked me, but because lack of confidence and theoretical knowledge about topics  have missed that opportunity...

==>> Below are some interview questions from my interview journey hope it will help you bit.....

00.00 >> Off course!!! "Tell me something about yourself"? an annoying question?  Any way any how you have to face this question ...

Don't loose your confidence here say frankly all about your technical background present and past except about your family..also give only that answer that related to your education knowledge and achievements ..... don't say to much aggressively which create negative impression towards like "apne hank rha hai.. isse to dekh lunga tech que me!!!  '(';')'   '(';')

1>  Diff between RHEL 4 & 5 ?
2>  About boot process in sort?
3>  Types of DNS?
4>  how dns works?
5>  what is squid?
6>  port number of data ftp, ftp, telnet, smtp, sql
7>  what is sendmail hows it's works
9>  How to block downloading in squid
10> How you handle Load on server?
11> Fields in crontab?
12> Any backup tools you know?
13> what is amanda why to use?
14> How to update your server?
15> rpm commands to update, erase, install etc...
16> Use squid to do authentication of users on browser?
17> Use of NFS and samba?
18> Diff NfS & Samba?
19> What is SeLinux?
20> Default cache size in Squid?
21> I want to assign NISdomainname via DHCP is it possible how?
22> How to setup networking IP doaminname etc...
23> What is & Difference between find and grep
24> About Raid tool used & level diff
25> I want to do remote login how?
26> Use of NIS?
27> Use of Log files?
28> I sent a mail but lost how to find it where is ..?
Some other
- How to find which user surfed which site? squid not log file
- which command you use for maintaining system info to submit to your manager?
- How you reduce load on your server
- tools used to check system load and performance
- Do you know anything about DHCP on windows server
- Application that you much like can confident about that
- In sort what you know in Linux
- Can you compile C program in linux how?
- about Linux shell scripting any other scripting language you know

-
Another that some asked to me?
1> why i hire you?
2> what is mean and responsibilities of a sys admin
3> why you chose Linux as career?
4> About your current job and responsibilities
5> After doing job in diff field near about 2 years why you want to move your path
6> Why Linux not Windows?  :)
7> What is your strength?
8> Do you have any question?
9> Anything that you want to ask?
10> What is your exception?
11> expected salary?
12> notice period how soon you can join?

Our HR department will inform you -- Why this?? :(

Some exact questions i don't remember so i just written in sort!!!

================== Some more1s>

1> Size of MBR, fields in MBR, PT size in MBR
2>  Dir /abcd have 744 perm to user but file /abcd/file1 has 777 permission can a normal
 user edit file1, if no why?
3>  What happen if a deleted /boot/lilo.conf and restarted the system and
       What if deleted /boot/grub.conf and restart the system ???
4>  what called #! /bin/bash
5>  There a parameter in vsftpd conf file without which vsftpd server will not work
6>  Diff GRUP & LILO techinical DIFF ...
7>  Can we authenticate only users login on vsftpd by LDAP how
8>  Port number SAMBA, DHCPD, SQUID, DNS, POP, POP, NTP on secure level, IMAP on secure level,  sendmail on secure level, Postfix..
9>  Diff TCP/UDP
10> What are 7 Layers TCP/IP eg of each
11> Fields in DNS
12> USe of ip_farwording
13> where is config file of sshd service.
14> what is tunnel
15> What is mutt
16> fields in top command meanings
    1>load average 2> %id     3> Mem: 4> SWAP
17> What is the use of swap partition
18> can we encrease swap partition size how
19> syntax of for loop in bash
20> awk stand for
21> can we change vsftpd default directory location
22> Can we change Default Directory in apache
23> Can we use index.php insted of index.html as default page in apache how .
24> visudo command will open file?
25> Diff RHEL & CentOS
26> Diff LILO GRUB
27> Advantages of GRUB
28> What is iptables, Firewall, netfilter ..?
29> write iptable to block use of sshd service via port 22 from outside of range 192.168.8.10-192.168.8.50
30> Tables in iptables
31> what is cluster & virtualizaton just basic, what you understand by term..
32> what is domain and hostname concept.
33> can a system have multiple hostname/domainname how?
34> How many virtual ips you can assign to a single interface.
35> What is netmask/ broadcast IP ?
36> What is inode in Linux
37> What is Raid5, advantage of Raid5 over Raid4 over Raid1 over Raid0
39> Can we safely delete /usr/shares  Impacts ?
40> Use of loge levels ?
41> What is suid, guid and sticky bit
42> Can you open multiple vi on same terminal at a time
43> What is sed command, any advantage
44> Use of KILL and KILL command
45> Use KILL command to reload a service eg: HTTPD
46> What s vlan
47> How to find number of users on your system
48> Find port use by a process
49> Find file's opened by a process
50> what is fork and prefork
51> What is sticky bit, suid, guid, when to use which
52> Ramdisk when and how to use?
53> Diff Samba and NFS
54> What is tcpdump, when and how to use.
55> print whole file other than cat
56> 2 adv. dis. of ext2 ext3 ext4
57> Can we mount ext-ext3, ext3-ext2, ext2-ext4 ,, ext4-ext3, ext3-ext4, ext4-ext2
58> What is hub, switch and router
59> What is datadump and coredump
60> What is segmentation fault
61> What is diff between Single user mode and Emergency mode
62> How to downgrade an rpm .
63> How to rebuild rpm db
64> List files in rpm
65> reinitialize file permission of an installed rpm
66> Active and Passive FTP
67> What is getopts how it's work
68> Diff Shell Login and Intractive Login


DNS,
1> What is SOA record
2> What is MX record
3> nslookup, check which entry first
4> use of nsswitch.conf

User and Group Management in Redhat Linux


Here are some configuration files which you should be familiar.

/etc/passwd :
Contains the database of information of all the users.
The format of the file is

username:password:uid:gid:gecos:directory:shell

/etc/shadow :
The actual password of every user is stored in /etc/shadow, indicated by an x in the password field.
As /etc/passwd is readable by all users, storing even encrypted passwords in it makes password guessing easier.
However, /etc/shadow is more secure because it is readable only by programs that run with root privileges, such as login and passwd.

Here is a sample line from /etc/shadow
johny:$1$EmRh1cmZ$gkXY30H43D7NtpQXjm9F01:11589:0:99999:7:::

It contains the following fields,
- The account name
- The account’s encrypted password
- The number of days since 1 January 1970 that the password was last changed
- The number of days permitted before the password can be changed
- The number of days after which the password must be changed
- The number of days before the password expires that the user is warned
- The number of days after the password expires before the account is disabled
- The number of days since 1 January 1970 after which the account is disabled
- Reserved for future use


/etc/group :
Contains the database of information of all the groups.
The format of the file is
groupname:password:gid:userlist

where
groupname is the name of the group
- password is an optional field containing the encrypted group password
- gid is the numeric group ID number
- userlist is a comma-separated list of the user account names that comprise the group

For ex,
finance:x:507:jacob,maylyn,nancy


Now lets see some commands,

Q. To create a user account with default settings,

# useradd jacob

In this case,
the home directory will be /home/jacob,
shell will be bash
uid will be the next unused UID

Q. To show the default values taken while creating a user account,

# useradd -D

Q. To set a password for the newly created user account,

# passwd jacob

Q. To change the gecos(description) of a user account,

# usermod -c "Jacob Oyden" jacob

Q. To delete a user account

# userdel jacob

Q. To delete a user account along with its home directory,

# userdel -r jacob

Q. To create a group for finance department,

# groupadd finance

Q. To create a group in a specific guid,

# groupadd -g 1000 finance

Q. To delete a group,

# groupdel finance

Q. To lock a user account,

# passwd -l jacob

Q. To unlock a user account,

# passwd -u jacob

Q. To change the user name of an existing user account,

# usermod -l joyden jacob

above command change the username from jacob to joyden.

Q. To change the 'uid' of a user account,

# usermod -u 1023 jacob

Above command will also update all files and directories rooted in the user’s home directory automatically to the new UID, but any files outside of the user’s home directory must be altered manually.

Q. To show the user account expiry information,

# chage -l jacob

Q. To change user account expiry information,

# chage jacob

Q. To list all the shells (or you can refer the file /etc/shells for the available shells),

# chsh -l

Q. To change the shell of a user,

# chsh jacob

Access Control List in linux


Access Control List (ACL) is a list of permissions attached to a file or directory.

Pre-Requisite:

To set ACL for any file or directory, the underlying filesystem should be ACL enabled which you have to mention while mounting the filesystem.

To make it permanent, you need to edit /etc/fstab and add "acl" under options field for the specific filesystem.

Ex:
LABEL=/data             /data                   ext3    defaults,acl        1 2

After modifying the /etc/fstab file, you have to remount the filesystem.

# mount -o remount /data


Now we can start setting the ACL on any file or directory located under /data filesystem.

To set full permission for a user on /data,
# setfacl -m u:user1:rwx /data

To set only read/execute permission for a user on /data/file1,
# setfacl -m u:user1:r-x /data/file1

To set full permission for dba group on /data/oracle directory,
# setfacl -m g:dba:rwx /data/oracle

To set full permission to user1 and group1 on /data directory,
# setfacl -m u:user1:rwx,g:group1:rwx /data

To revoke the ACL for a user on /data,
# setfacl -x u:user1 /data

To view the current ACL values on /data,
# getfacl /data

To revoke write access for all users and groups on a file,
# setfacl -m m::rx /data/file1

Above command will set the mask value as "r-x".

To copy the acl of one file to another,
# getfacl file1 | setfacl --set-file=- file2

You can also use the below method to copy the acl rights between files.

$ getfacl /data/file1 > acls.txt
$ setfacl -f acls.txt /data/file2

YUM Repository in linux


How to create YUM repository on a RHEL Server :

1. Insert and then mount the cdrom as /media

# mount /dev/cdrom /media

2. Create a directory called /myrepo

# mkdir /myrepo

3. Copy all the RPMs from the cd to the local directory

# cp /media/Packages/*.rpm /myrepo

4. Copy the xml file from the CD to the local directory

# cp /media/Server/repodata/6b21fc619d1eccd6fb49237c666f0ce4c68f-comps-rhel-Server.xml /myrepo

5. Create a YUM repository based on the cdrom. This can be done by creating the below file.

# cat > /etc/yum.repos.d/myrepo

[myrepo]
name=rhel6
baseurl=file:///media
enabled=1
gpgcheck=0

^d

Now you can install any rpm using yum command which will install the software from /media ie., your cdrom

6. Install createrepo rpm ( including its dependents)

# yum install createrepo

7. Create a local repository

# cd /myrepo
# createrepo -g 96b21fc619d1eccd6fb49237c666f0ce4c68f-comps-rhel-Server.xml -x /myrepo

8. Finally you have to change the below file

/etc/yum.repos.d/myrepo :

[myrepo]
name=rhel6
baseurl=file:///media
enabled=1
gpgcheck=0

9. Now you have finished creating a local repository on your server.
You can install any individual rpm or groups by just invoking yum command.

Here are few commands to show different ways to use yum command:

1. To install an individual rpm and also install its dependents

# yum install package-name

2. To install a group of rpms

# yum groupinstall group-name

3. To list all the packages available in the repository

# yum list

4. To list only the packages that are installed
# yum list installed

5. To list all the groups available in the repository

# yum grouplist

6. To display information of a group of packages

# yum groupinfo group-name

7. To display information of a package
# yum info package-name

8. To uninstall a package
# yum remove package-name

9. To uninstall a group of packages
# yum groupremove group-name

10. To update a package
# yum update package-name

11. To update a group of packages
# yum update group-name


12. To search for a package using a keyword
# yum search keyword

13. To know which package a file belongs to
# yum provides /usr/bin/screen

14. To list your current (enabled) yum repositories
# yum repolist

15. To list all yum repositories
# yum repolist all

Few other info,

yum conf file:   /etc/yum.conf
yum repo file: /etc/yum.repos.d/


You still have a lot to learn about YUM. So keep reading.

Managing HBAs and SAN disks in Redhat Linux 4 & 5


Redhat 5 :

To list the LUNs and their paths :
# multipath -ll

To display pv information on a multipath :
# pvdisplay /dev/mapper/mpath0

To find the server hardware details :
# dmidecode <- -l="" 2="" class="" fc_host="" fdisk="" for="" hardware="" host0="" host1="" info="" ls="" luns:="" new="" scan="" sys="" to="">/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

# echo "1" > /sys/class/fc_host/host0/issue_lip

# echo "- - -" > /sys/class/scsi_host/host0/scan

# echo "1" > /sys/class/fc_host/host1/issue_lip

# echo "- - -" > /sys/class/scsi_host/host1/scan

# cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l

# fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l



RHEL 4.6 :

To see HBA details like firmware, wwn,etc.. :
# cat /proc/scsi/qla2xxx/0

To list the HBAs along with their HBA :
# adapter_info

To scan for new LUNs:
# hp_rescan -a

To show the WWN of a LUN :
# scsi_info /dev/sdb


To list the configured Qlogic adapters:
# lspci | grep -i qlo


To list the LUNs:
# /opt/hp/hp_fibreutils/lssd

Output will be like

sda H,B,T,L 

where
H is the host number of the HBA
B is the bus number (normally 0)
T is the target number
L is the LUN number
is a string which uniquely identifies the storage array.

To remove a lun from OS:
# echo "1" > /sys/block/sd/device/delete
# echo "scsi remove-single-device H B T L" > /proc/scsi/scsi
# echo "1" > /sys/class/scsi_host/host/device/targetH:B:T:L/H:B:T:L/delete

Hardware Information in linux

1. To show the SCSI HDD/CD/VD drive information

# sdparm -i /dev/sda

2. To show the IDE HDD/CD/VD drive information

# hdparm -i /dev/hda

Hardware Information in linux


1. To show the SCSI HDD/CD/VD drive information

# sdparm -i /dev/sda

2. To show the IDE HDD/CD/VD drive information

# hdparm -i /dev/hda

Hardware Information in linux


1. To show the SCSI HDD/CD/VD drive information

# sdparm -i /dev/sda

2. To show the IDE HDD/CD/VD drive information

# hdparm -i /dev/hda

Software Management in linux


1. To install a RPM package :
# rpm -ivh foo-1.0-2.i386.rpm

2. To uninstall a RPM package :
# rpm -e foo

3. To upgrade a RMP package :
# rpm -Uvh foo-1.0-2.i386.rpm

4. To query a RPM package :
# rpm -q foo
# rpm -qa | grep foo

5. To display a RPM package information : 
# rpm -qi foo

6. To check the signatue of a RPM package :
# rpm --checksig foo

7. To list files in a RPM package :
# rpm -ql foo

8. To list all the installed RPMs :
# rpm -qa

Starting and Stopping Services in linux


1. To start http service :
# /etc/rc.d/init.d/httpd start
# service sshd start

2. To stop http service :
# /etc/rc.d/init.d/httpd stop
# service sshd stop

3. To restartp http service :
# /etc/rc.d/init.d/httpd restart
# service sshd restart

4. To show the status of http service :
# /etc/rc.d/init.d/httpd status
# service sshd status

5. To show the status of all the services :
# service --status-all

6. To list the state of a service in different run levels :
# chkconfig --list ypxfrd

7. To list the state of all the services in different run levels :
# chkconfig --list

8. To enable SSH service in run levels 2,3 and 4 :
# chkconfig --level 234 sshd on

9. To disable SSH service in run levels 2,3 and 4 :
# chkconfig --level 234 sshd off

Identifying a system using /proc Filesystem


1. To show the OS (Kernel) version:
# cat /proc/version

2. To identify the processor details :
# cat /proc/cpuinfo

3. To identify the memory information :
# cat /etc/meminfo

4. To show the raid devices :
# cat /proc/mdstat

5. File containing the disk partition details :
/proc/partitions

6. File containing the swap details :
/proc/swaps

7. File containing the uptime details :
/proc/uptime

Kernel Module in linux


1. To list the currently loaded kernel modules :
# lsmod

2. To load a module :
# modprobe hid
For detailed output:
# modprobe -v hid

3. To unload a module (only the unused and undependent modules) :
# rmmod hid

4. Module files are kept under /lib/modules//kernel/drivers/

5. To display information about a specific module :
# modinfo -d hid

Swap Space in linux


1. To setup swap space on a newly created partition :
# mkswap /dev/sdb3

2. To enable the swap partition :
# swapon /dev/sdb3

3. To enable the above swap device at boot time, add the below line to /etc/fstab

/dev/sdb3 swap swap defaults 0 0

4 To create a swap file:

a. Create an empty file
# dd if=/dev/zero of=/swapfile bs=1024 count=65536

b. Create swap space on the file
# mkswap /swap-file

c. Enable the swap file
# swapon /swap-file

d. Add the below line to /etc/fstab
/swap-file swap swap defaults 0 0

5. To remove a swap file

a. Disable swap on the file
# rmswap /swap-file
b. Remove the corresponding entry in /etc/fstab
c. Delete the file
# rm /swap-file

X Window for Linux


X Window for Linux

- Graphical User Interface of Unix
- Runs in a sperate user space in linux
- Users client-server architecture

Few X-window based applications,
1. xterm
2. xeyes
3. xbanner
4. xcalc
5. xedit

Default X Window Server in Linux:
XFree86

Configuration:
- Only root can do the configuration
- Config File: /etc/X11/XF86Config or XF86Config-4
- Command used to configure:
1. XFree86 -configure
2. For Redhat Linux: redfat-config-xfree86
3. For SUSE Linux: SAX2, YAST

Command to start X session:
# startx

To start second session:
# startx --:1

Window Manager:
- Available Window Managers:
Fvwm95, Afterstep, KDE, GNOME
- $HOME/.xsession contains your default window manager
- Use 'swtichdesk' command to change your window manager

Session MAnager:

- Is a program that manages X sessions

- Starts XFree86m displays a graphical login prompt

- Authenticates the user logins, then starts the users favourite window manager

- When a user logouts, it restarts XFree86 and displays a login prompt for the next user

- Available Session Managers:
a. xdm - /etc/X11/xdm/Xaccess, /etc/X11/xdm/xdm-config
b. kdm - /etc/kde/kdm/kdmrc, /etc/kde/kdm/Xaccess
c. gdm - /etc/X11/gdm/gdm.conf

- Started by init process in runlevel 5

Devices in linux


Charcter / Raw Devices:
- A Raw device is a device that allows only "serial" access

Block Devices:

- A Block device is any device that allows "random" access
- Ex: Hard disk, disk partitions, RAM, Logical Volumes, RAID volumes
- It can be used for file systems, swaps, RAID, LVM
- Have a special file in /dev

Floppy Disks:
- Floppy disks have special files from /dev/fd0, /dev/fd1 .. upto 8 files/devices

Hard Disks:
- Mostly used types are IDE and SCSI

IDE:
- IDE Disks have special files from /dev/hda, /dev/hdb .. upto 8 files/devices
- Maximum 2 disks on 1 bus, 2 buses on 1 adapter, 2 adapters in a system.


SCSI:
- Depending on the scsi type, you can have maximum 7 or 15 disks on 1 bus
- SCSI Disks have special files from /dev/sda, /dev/sdb .sdz, then sdaa thru sddx. upt0 128 files/devices
- Also includes SD, DVD-ROM, tapes, ..
- Linux kernel supports a total of 128 SCSI disks by default

Partitions:
- Maximum of 4 primary partitions
- you can have 1 extended partition as a primary partition
- An extended partition can have multiple logcal partitions
- By deafult, linux supports 59 logical partitions on IDE and 11 logical on SCSI disks
- Partitions can be created using "fdisk /dev/sdx" command
- To view current partitions, use "fdisk -l" command
- Each partition can be of types Linux, Linux Swap, Linux LVM depending upon the usage

RAM Disk:
- Is a block device created in memory

- Is temporary, gets deleted after reboot

- By default Linux supports upto 16 RAM disks and maximum 255 RAM disks

- Use 'dd' command to create a RAM disk
# dd if=/dev/zero of=/dev/ram1 bs=1k count=4096

- To delete a RAM disk,
# freeramdisk /dev/ram1
- initrd (Initial RAM disk) is a compressed ramdisk image which is mounted as initial root filesystem
- Use 'mkinitrd' command to create initial ram disk

Startup and Shutdown in linux


1. Run Levels:

0 - To halt a system
1,s,S - Single user mod
2 - Multiuser, no network
3 - Multiuser with network, but no XWindows
4 - Unused
5 - Multiuser with XWindows and network
6 - Reboot

2. To switch to single user run level:
# telinit 5

3. Directory containing Runlevel Scripts:

0 - /etc/init.d/rc0.d
1 - /etc/init.d/rc1.d
2 - /etc/init.d/rc2.d
3 - /etc/init.d/rc3.d
4 - /etc/init.d/rc4.d
5 - /etc/init.d/rc5.d
6 - /etc/init.d/rc6.d

4. Boot Loaders: 
a. LILO
b. GRUB

5. Config Files for Boot Loaders :
LILO: /etc/lilo.conf

GRUB: /boot/grub/menu.lst

6. To set password for grub:

a.
# grub
grub> md5crypt
Password: ibmlnx
Encrypted: $1$JGuR//$kjOu7Q9kTZk01wFKWQqMb/
grub> quit

b.
# vi /boot/grub/menu.lst
Add the following line below the “splashimage” line (Red Hat)
After you see title SUSE Linux 10.0 on the next line type lock.
On the following line type password md5 [the encrypted password you copied from previous shell]:

###Don't change this comment YaST2 identifier: Original name: linux###
title SUSE Linux 10.0
lock
password md5 $1$Rdv455345ga345GvIRgXWxcF1Vjb7tZ//
root (hd0,1)
kernel /boot/vmlinuz root=/dev/hda2 vga=0x31a selinux=0
resume=/dev/hda1 splash=silent showopts
initrd /boot/initrd

7. To shutdown a system :
# shutdown now
# halt

8. To reboot a system :
# shutdown -r now
# reboot

9. To install GRB :
# /sbin/grub-install /dev/sda

LVM Limits in linux


Max # of VG - 99
Max # of LV - 256
Max size of a LV - 512MB - 2TB (32bit)
Max size of a LV - 512MB - 1PB (64bit)
Max # of LE - 65534
Max # of PE - 65534

Physical Volume in linux


Physical Volume:

You can create PV on a hard disk or partiiosn (of type '8e' / Linux LVM)

To initialize a PV on a partition:
# pvcreate /dev/sdb1

To initialize multiple PVs:
# pvcreate /dev/sdb1 /dev/sdb2 /dev/sdb3

To forcibly initialize a PV on a disk :
# pvcreate -f /dev/sdb

Above command initializes a PV by putting a volume group descriptor area a.k.a VGDA at the start of the PV

To show the information about a PV:
# pvdisplay /dev/sdb1

To report information about PVs:
# pvs

To scan all disks for Physical volumes:
# pvscan

To scan/show PVs only for exported VGs:
# pvscan -e

To scan/show PVs not belonging to any VG:
# pvscan -n

To expand a PV after enlarging the partition with fdisk:
# pvresize /dev/sdb1

To shrink a PV on a partition prior to shrinking the partition with fdisk:
# pvresize --setphysicalvolumesize 40G /dev/sdb1

To view PEs:
# pvdata -E /dev/vg1/lv1

To move PEs between PVs :
# pvmove -n lv1 /dev/sdd1 /dev/sdd2

Logical volume in linux


To report information about logical volumes:
# lvs

To create a logical volume in an existing volume group:

Method 1 - By mentioning the size:
# lvcreate -L 1G -n lv01 vg01 /dev/sdb1

Method 2 - By mentioning the # of LEs:
# lvcreate -l 32 -n lv01 vg01

You can now use /dev/vg01/lv01 as a block device111111

To scan all disks for Logical volumes:
# lvscan

To change the minor number of a LV:
# lvchange --minor 98 lv_name

To change the permission:

Read-Only:
# lvchange -p r lv_name

Read/Write:
# lvchange --permission r/w lv_name

To expand a LV:
# lvresize -L +1G lv_name

To reduce the size of a LV:
# lvresize -L -512M lv_name

To display the attributes of a LV:
# lvdisplay -v /dev/datavg/loglv

To remove a LV:
# lvremove /dev/vg01/lv01

Volume Group in linux


Create a VG:
# vgcreate vg00 /dev/hda1 /dev/hdb1

Create a VG by mentioning the PE size:
# vgcreate -s 10M vg01 /dev/hda1 /dev/hdb1

To display all the VGs:
# vgdisplay

To display more info on a particular VG:
# vgdisplay -v vgname

To display only active VGs:
# vgdisplay -A

Activate a VG :
# vgchange -a y vgname

De-activate a VG:
# vgchange -a n vgname

Extend a VG:
# vgextend vgname /dev/hdb1 /dev/hdc2

Reduce a VG:
# vgreduce vgname /dev/hdc2

Remove a VG:
# vgremove vgname

Import a VG into a system:
# vgimport vgname

Export a VG from a system:
# vgexport vgname

To learn new VGs:
# vgscan

To backup VGDA to /etc/lvm/backup/vg_name:
# vgcfgbackup vgname

To restore VG meta data from /etc/lvm/backup/vg_name or a file to the disk
# vgcfgrestore -f filename -n vgname vgname

To recreate VG directory and logical volume special files:
# vgmknodes vgname

Package(RPM) Management in linux

RPM:
- Is a tool for the management of source files, packages, build process
- Includes a distribution method and formart for binery files, including pre and postinstall scrpits

Database of the installed packages - /var/lib/rpm
To access the database, use the rpm command

To install a package:
# rpm -ivh package-name.rpm

To upgrade a package:
# rpm -Uvh package-name.rpm

To erase/uninstall a package:
# rpm -evh package-name.rpm

To freshen a package: [ Only installs if the old version was installed ]
# rpm -F package-name.rpm

Query a package:
# rpm -q package-name

To list all the installed packages:
# rpm -qa

To show the package owning a specific file:
# rpm -qf /usr/bin/ls


To list the files owned by a package:
# rpm -ql package-name.rpm

To display package information:
# rpm -qi package-name.rpm

To verifiy a package:
# rpm -V package-name

To verify the package signature:
# rpm --checksig package-name.rpm

To import a public key for a package:
# rpm --import path-to-public-key-file

Integrated package Management:
RdHat: redhat-config-packages
SuSE: yast

Red Hat Online Update:
- Create and manage account and systems thru http://rhn.redhat.com
- Register individual systems with
# up2date --register
- User 'up2date' command to update the systems

SuSE Online Update:
- Command:
'you' or
'yast' -> Online Update
- It downloads and installs the patches freom any SuSE mirror server
- You can create internal mirrors in your network