Some Useful Ubuntu Commands

Here’s a useful guide for some IT people that are getting into Linux, and more specifically Ubuntu.

Basically, it’s a reference for Windows users to do Linux-type commands. I’ll be adding to this post as time goes on.

Shell Commands

sudo -i set the command shell to have root privileges

Networking Commands

ifconfig shows network information (ipconfig in Windows)

ifdown eth0 && ifup eth0 restart your network adapter and get new IP address

ifconfig eth0 192.168.99.14 netmask 255.255.255.0 up change your IP address

route add default gw 192.168.99.254 set the default gateway

System Commands

init 0 shutdown

init 6 reboot

dmesg print diagnostic messages from the kernel

Disk tools

df Show a summary of disk usage

du Show a directory tree space usage (some nice modifiers in this :) )

tune2fs Allows you to modify disk and filesystem settings. Useful for removing reserved disk space on ext filesystems.

Services

invoke-rc.d service restart Start / Stop a service

update-rc.d service defaults 99 Add service to startup scripts

Flash

sudo dpkg-reconfigure flashplugin-installer Reinstall Adobe Flash

Other

uname -a and cat /etc/issue to know what version and distro of Linux you are running

BT Test User Account

Test your ADSL line using the BT test user account Broadband test

If you are unable to connect to ADSL using the login details provided by your ISP, then try the alternatives below to test your connection.

Here are the login settings to use for your router or modem to connect to the BT test domain.

User: bt_test@startup_domain

BT will ignore any password present in the password box, and therefore is not necessary to delete or modify these settings.

If you are unsuccessful connecting to BT test account and are sure your ADSL line has been activated and all hardware wiring is correct then contact your ISP to let them know.

If you connect successfully you can determine whether your computer software (e.g. Internet Explorer settings & firewall)and DNS are configured correctly by going to this URL: http://www.bt.net/digitaldemo/ If you can view this website then congratulations your software and hardware is configured correctly.

If the above is successful, then you have confirmed that your line is ADSL enabled and that the ADSL is working. The next test is to confirm that you can connect to your ISP. To do this, change the login settings again to use:

User: bt_test_user@your_connnection_pipe where your_connection_pipe is the bit after the @ symbol in your ADSL login.

This will test that you can login to your ISP using a default login. If this works, then it generally means one of two things: your ISP has not yet set up your account, or you have entered your details incorrectly.

Note that if you are successful with the above, you may now find that your login details work correctly even if they did not before. This can happen if the “session” you have with BT had failed to expire properly; reconnecting with a different login will usually clear this.
Test your ADSL line Speed Broadband speed test

This tutorial will explain how to use the BT ADSL speed test facility. This is a test often used by BT engineers when testing the speed on customer’s ADSL connections. It basically tests the time it takes your system to download a file from a BT server and thus determines the effective transfer speed of your connection. This test differs from the normal Internet speed test that PlusNet and websites like ADSLguide have, as the test only involves the BT network and not your ISP.

Here are the login settings to use for your router or modem to connect to the BT speed test domain.

User: speedtest@startup_domain

BT will ignore any password present in the password box, and therefore is not necessary to delete or modify these settings.

Once connected you will be able to access the bt speedtest URL http://speedtester.bt.com

On that page you will be promopted to enter your telephone number then click the “GO” button.

After a short time your results will be displayed against the different speed internet connections to give you a fair idea of your ADSL line speed compared to your service.

It is recommended that you repeat the test several times to give an average tested transfer speed. To repeat the test just click your browser’s back button, which will take you back to the first page. Then just click the GO button again to repeat the test. Don’t be surprised if the test results vary from test to test, this is not an accurate test but again will give you a fair idea of your ADSL line capacity.

Praise Be for Regular Expressions

I used a regular expression in VB for the first time ever (I think) today!

The reason is that I cached some generated ASP and realised that when I needed to use it on different pages, the id lookup for certain elements would change. So, no problem (except for the fact that I’m coding in ASP):

<code>Dim regExpObj, file_content, newStr
Set regExptObj = new RegExp
With regExpObj
    .Pattern = "idTag[0-9]" 'Matches the id name that I'm using,
        'regardless of what number the generated code makes it
    .Global = True 'Matches all occurrences, not just the first
End With

newStr = objRegExp.Replace (file_content, "idTag3")

response.write newStr
</code>

Easy.