Friday, May 10, 2013

Difference between SAN and NAS                                Netstat Command in Linux

1.       What are the run levels?
There are total seven run levels as follows:
0 – halt
1—single user mode
2—multiuser mode without NFS
3—Multiuser with NFS
4 -- Unused
5 -- Multiuser mode with X11.
6 – Reboot.

2.       How to check all logged in user currently on server?
Ans.  W and who are the commands to check all logged in users on server. There many different commands to check this but mostly used w or who or finger.
root@rhel:~/rhel/shellscript# w
 01:17:45 up 12 days,  6:43,  3 users,  load average: 0.03, 0.04, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
nielsen2 pts/0    Wed20    3days  1.05s  0.69s -bash
nielsenpts/1    01:05    0.00s  0.62s  0.07s sshd: nielsen [priv]
nielsen2 pts/2     Wed20    4days  0.43s  3.39s sshd: nielsen2 [priv]
root@rhel:~/rhel/shellscript# who
nielsen2 pts/0        2013-04-24 20:24 (
nielsenpts/1        2013-04-30 01:05 (
nielsen2 pts/2        2013-04-24 20:26 (
root@rhel:~/rhel/shellscript# finger
Login     Name       Tty      Idle  Login Time   Office     Office Phone
nielsen   Nielsen   *pts/1          Apr 30 01:05 (
nielsen2             pts/0      3d  Apr 24 20:24 (
nielsen2            *pts/2      4d  Apr 24 20:26 (

3.       What is the difference between soft link and hard link?
Ans. Soft link also called as Symbolic link. Soft link means link the new file to original file without copying whole file to new location. And New files size will be the characters in filename of original file. If you want to get detailed difference then click on next link: Difference between Soft Link and Hard Link.

4.       How to change hostname permanently for server?
Ans. Generally, we are changing hostname from `hostname command` but this is not the way to change the hostname permanently. You should have to open the file `/etc/sysconfig/network` and change the hostname parameter of this file and then restart the network service.

5.       What is the command to convert dos file into unix format ?
Ans. `dos2unix` command is generally used for convert dos file into unix format and `unix2dos` command is used to vice versa.
6.       On which port DNS server is running ?
Ans. 53 Port .
7.       How to get the lines which matches pattern and 4 lines after the matched pattern ?
Ans. We can use grep command to get 4 lines after matched pattern.
root@rhel:~/rhel/shellscript# cat /etc/passwd | grep -nA 4 root

To get 4 lines before the matched pattern:
root@rhel:~/rhel/shellscript# cat /etc/passwd | grep -nB 4 snmp

8.       How to create 10 files in single command?
Ans.  You can use 10 different names after touch command.
root@rhel:~/rhel/shellscript/test# touch test{1..10}
root@rhel:~/rhel/shellscript/test# ls
test1  test10  test2  test3  test4  test5  test6  test7  test8  test9

9.       Find commans syntax to find the file by inodenumber ?
Ans. as follows:
root@rhel:~/rhel/shellscript# ls -li
total 32
5644165 -rw-r--r-- 1 root root 4922 2013-04-17 20:02 bid.log
5644164 -rwxr-xr-x 1 root root  479 2013-04-24 22:27
5770666 drwxr-xr-x 2 root root 4096 2013-04-30 01:42 test
5644159 -rw-r--r-- 1 root root 2173 2013-04-17 17:50 test1.log
5644160 -rwxr-xr-x 1 root root  353 2013-04-16 20:04
5644161 -rwxr-xr-x 1 root root  514 2013-04-16 18:30
5644117 -rw-r--r-- 1 root root 1731 2013-04-17 17:55 test.log
root@rhel:~/rhel/shellscript# find . -inum 5644164

10.   Find command syntax to get files accessed within last 30 days:
root@rhel:~/rhel/shellscript# find . -type f -atime -30

Check CPU usage in Linux                                              Usermod command in Linux
Posted by Machindra Dharmadhikari On 5/10/2013 09:27:00 AM 3 comments


Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

    Chitika Ads 2



    Enter your email address:

    Delivered by FeedBurner