Harry Sukumar's Weblog

Archive for the ‘Uncategorized’ Category

Windows Uptime?

Posted by hsukumar on 08/04/2009

Instructions

Option 1:

1. Go to “Start” -> “Run”.

2. Write “CMD” and press on “Enter” key.

3. Write the command “net statistics server” and press on “Enter” key.

4. The line that start with “Statistics since …” provides the time that the server was up from.

* The command “net stats srv” can be use instead.

Option 2:

Uptime.exe Tool Allows You to Estimate Server Availability

Posted in Uncategorized | Tagged: | Leave a Comment »

Redhat flavor Tweak Auto complete service command

Posted by hsukumar on 23/03/2009

I am a lazy bugger!!!
Type:
complete -W “$(ls /etc/init.d/)” service

* complete : the command complete sets up tab completion
* -W : this option creates a word list for completion
* “$(ls /etc/init.d/)” : out word list is made up of the output of the command ls /etc/init.d/
* service : this then sets up the configured completion for the command service

So next time when you type service command it should automatically auto complete,

hope this helps the Lazy like me :-)

Posted in Uncategorized | Tagged: , , | Leave a Comment »

Mac OS X-change hostname

Posted by hsukumar on 19/03/2009

Change the hostname in Mac OS X [osx]

When I log into the network at my job my Mac’s hostname always turns to:

rice.com.au

I have my local hostname set to:

rice.com

So What I would like to do is set my Mac’s hostname to my local hostname. You can do this all from Terminal in a single line.

Run this command in Terminal:

sudo scutil --set HostName rice.com

 

 

This is also helpful if you’re in Terminal and have a really long hostname at your prompt. If you want to view your current hostname, run this command in Terminal:

hostname

 

This is what it looked like for me:

rice.com

Posted in Uncategorized | Leave a Comment »

compizconfig-settings manager

Posted by hsukumar on 14/03/2009

To Configure compiz on redhat machines please install ccsm
# yum install ccsm

This is the fronend tool to manupulate the graphics

Posted in Uncategorized | Tagged: , | Leave a Comment »

Permission & Umask on files

Posted by hsukumar on 12/03/2009

The default permission for files is 666 and directory is 777. umask is used to withhold permission. Default root’s umask is 022. without a umask in effect, only file created will have 666 permission and directory will have 777. this means that anyone on the system will have read and write access to any file. A umask of 002 will result in file created with 664 permission and directory with permission 775.

Default umask on Red hat enterprise linux is 002. to change

#umask 022

umask is typically set by script run at login time. The next time you lig in umask will be set bask to your default unless you add command to one of your startup files such as .bashrc.

User Mask

Default value for root = 0022

Default value for users = 0002

When we create any new file. The default value will be 666. in this case Umask means 666-002 = 664 for normal user and for the root the default value will be 666-022=644

The default value for a directory is 777. in this case umask means that whenever we create new directory, the default valkue for normal user 777-002 = 775 and for root, the default value 777-022 = 755

Posted in Uncategorized | Leave a Comment »

Network Troubleshooting Linux

Posted by hsukumar on 12/03/2009

Sources of Network Slowness

  • NIC duplex and speed incompatibilities
  • Network congestion
  • Poor routing
  • Bad cabling
  • Electrical interference
  • An overloaded server at the remote end of the connection
  • Misconfigured DNS

TEST YOUR NIC

It is always a good practice in troubleshooting to be versed in monitoring the status of your NIC card from the command line. The following sections introduce a few commands that will be useful.

The ifconfig command without any arguments gives you all the active interfaces on your system. Interfaces will not appear if they are shut down:

[root@bigboy tmp]# ifconfig

Note: Interfaces will appear if they are activated, but have no link.

DHCP Considerations

DHCP clients automatically give their NICs and IP address starting with 169.254.x.x until they can make contact with their DHCP server. When contact is made they reconfigure their IP addresses to the values provided by the DHC server. An interface with a 169.254.x.x address signifies a failure to communicate with the DHCP server. Check your cabling, routing and DHCP server configuration to rectify such a problem.

Testing Link Status from the Command Line

Link Status Output from ethtool

[root@test.com tmp]# ethtool eth0

Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: No
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x00000007 (7)
        Link detected: yes
[root@test.com tmp]#

Testing Web sites with the curl

Using curl

The curl utility acts like a text based Web browser in which you can select to see either the header or complete body of a Web page’s HTML code displayed on your screen.

A good start is to use the curl command with the -I flag to view just the Web page’s header and HTTP status code. By not using the -I command you will see all the Web page’s HTML code displayed on the screen. Either method can provide a good idea of your server’s performance.

[root@ bigboy tmp]# curl -I www.testing.com
HTTP/1.1 200 OK
Date: Tue, 19 Oct 2004 05:11:22 GMT
Server: Apache/2.0.51 (Fedora)
Accept-Ranges: bytes
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html; charset=UTF-8
[root@test.com tmp]#

Using netcat to Test Network Bandwidth

Most Linux distributions contain the netcat or nc packages which can be used to create a TCP socket over which you can transfer data. The syntax can also vary between distributions so you should refer to your system’s man pages if you have any questions.

The netcat server can be easily created with the -l switch that signifies the program should listen, and not talk. The desired TCP port then follows. In this case the server is listening on TCP port 7777.

[root@smallfry tmp]# nc -l 7777

The netcat client only needs to specify the server’s IP address followed by server’s the TCP listener port.

[root@bigboy ~]# nc 192.168.2.50 7777

Any text typed to the console screen of the client;

[root@bigboy ~]# nc 192.168.2.50 7777 This is a test of the NetCat program! [root@bigboy ~]#

will also be visible on the server’s console.

[root@smallfry tmp]# nc -l 7777 This is a test of the NetCat program! [root@smallfry tmp]#

If you want to transfer a file, you only need to use some simple command line redirection. In this case, the server will output all data it receives on port 7777 to a file called FC-6-i386-disc1.iso, and the client pipes the output of the cat command to the netcat client that points to our server.

[root@smallfry tmp]# nc -l 7777 > FC-6-i386-disc1.iso [root@bigboy ~]# cat /tmp/FC-6-i386-disc1.iso | nc 192.168.2.50 7777

All Linux systems have a black hole file named /dev/null which automatically discards any data written to it. If you want to test file transfers without filling your disk storage, or having the server’s disk I/O be a bottleneck, then use this as your output file instead.

[root@smallfry tmp]# nc -l 7777 > /dev/null

All Linux systems also have a have a continuous random data source located at /dev/random. Instead of using a file in your tests, you can use this instead for a data stream or infinite duration.

[root@bigboy ~]# cat /dev/random | nc 192.168.2.50 7777


Posted in Uncategorized | Leave a Comment »

How to Xen on Redhat based Machines

Posted by hsukumar on 05/03/2009

Need root shell access

Doing the work

  1. Check if the required Xen packages are already installed:
    # rpm -q xen kernel-xen virt-manager
  2. If it tells you if the packages are installed including the version number, proceed to the next step. Otherwise, install them by:
    # yum install xen kernel-xen virt-manager
  3. After installation, the service should be configured to start automatically.
    # chkconfig xend on or chkconfig --levles 345  xend on
  4. Restart the computer (it should boot to the new Xen™ kernel). To check:
    # uname -a
  5. To start the Xen™ daemon.
    # /sbin/service xend start
  6. Test the set-up by using virt-manager.
    # virt-manager

You should see the virtual machines currently on your host.

Posted in Uncategorized | Leave a Comment »

Setup Network firewall setting on Redhat Machines

Posted by hsukumar on 24/02/2009

Simple answer use command setup as root :-)

Posted in Uncategorized | 1 Comment »

Important intellections for System Administrators

Posted by hsukumar on 27/01/2009

  1. Never do something you can’t undo.
  2. Always check the backups, never assume they are working. Make sure you can restore from them, too.
  3. Write down what you did, even if you know you will never forget it, you will.
  4. If you do it more than once, write a script.
  5. Get to know your users before there is a problem, then when there is, they will know who you are and maybe have a little understanding.
  6. Remember you are performing a service for your users, you don’t own the system, you just get to play with it.
  7. Check your backups.
  8. Never stop learning, there is always something you should know to make your job easier and your system more stable and secure.
  9. Check your backups, again

Posted in Uncategorized | 1 Comment »

How to extract RAR files

Posted by hsukumar on 06/08/2008

Rar files are starting to be used extensively on the internet. You can install the package in Fedora.

you need to have Livna repository enabled

# yum install unrar

Posted in CentOS, General Linux, Redhat MIX, Uncategorized | Leave a Comment »