Categories
Tech

Determine Hard Disk Free Space from Shell

I have always noticed that when people ask the question ‘How do I figure out how much hard drive space I have left’ as it relates to the Linux / *nix shell, people always respond telling people to use the following command:

df

Output:

$ df Filesystem           1K-blocks      Used Available Use% Mounted on /dev/sdb5             56870784  22222576  31759324  42% / ... /dev/sda1               252960    122460    130496  49% /media/sda1 /dev/sda3            1441394492 1372242748  69151740  96% /media/sda3 

In the above example, everything is hard to read since it’s in units of one thousand bytes. On some systems this defaults to multiples of 512 bytes unless you specific the -k option. I’m surprised that they don’t mention that if you add one simple switch (-h for human readable), you can make the output much easier to read on most systems:

df -h

Output:

$ df -h Filesystem            Size  Used Avail Use% Mounted on /dev/sdb5              55G   22G   31G  42% / ... /dev/sda1             248M  120M  128M  49% /media/sda1 /dev/sda3             1.4T  1.3T   66G  96% /media/sda3 

In the above example, you can see that I’ve used 1.3 terabytes of my main system drive, leaving me with 66 gigabytes free.

Side Note: You can also find out what file system type you are using by running the following command:

df- T

And it will produce the following results:

Filesystem    Type   1K-blocks      Used Available Use% Mounted on /dev/hdb1     ext3    19228276  14737848   3513680  81% / tmpfs        tmpfs      383960         4    383956   1% /dev/shm

(The second column is the type)

Categories
Tech

Restart XBMC Live from SSH (Bash Shell)

As an update for XBMCbuntu, you can run the following command to start/stop XBMC:

sudo service lightdm [start|stop|restart]

Original Post:

I always forget the command for restarting XBMC Live from the shell, so I figured I would post it to my blog. It’s a really simple, one-line command:

sudo /etc/init.d/xbmc-live restart

Then enter the password for the root account (typically ‘xbmc’).

Just to be clear, the benefit of running this command instead of a full reboot (sudo reboot) is the above command only restarts the XBMC Live application. This means if you have any other services or apps running (like SABnzbd+), you can keep those apps running.

The only reason I’ve ever really needed the xbmc-live restart command is when something gets locked up on XBMC… and that usually only happens when I’m trying out new skins or plugins.

I should also note that on occasion this command will not restart XBMC live. The alternative is to stop, then start XBMC again using the following commands:

sudo /etc/init.d/xbmc-live stop
sudo /etc/init.d/xbmc-live start 
Categories
Tech

Upgrade from Joomla 1.5RC4 to Stable

Upgrading from Joomla 1.5RC4 to Stable (Production) was a breeze. There was no need to make changes to database structure or anything. Simply download the full stable release, upload to my server, and overwrite the files. Here’s how I did it from the shell.

Navigate to the proper directory:
$ cd /mysite/

Download (wget) the new compressed file:
$ wget http://joomlacode.org/gf/download/frsrelease/5078/21064/Joomla-1.5.0.tar.gz

Uncompress over old files:
$ tar -zxvf Joomla-1.5.0.tar.gz

Remove the installation directory:
$ rm -fR installation

I then visited the site to check to make sure everything was working. Sure enough, it all worked great! I would highly recommed creating a backup of your site files and database. Here are some links from my site on how to do this from the shell:

Create a MySQL Backup from Shell
Create file/website backup from Shell

Categories
Tech

Howto:Change Server Shell Port

I saw this great post on SharkSpace by Amanda about how to change your server’s shell port. It said it was part of the dedicated server guide, but I thought it was good for people with VPSs (Virtual Private Servers) as well. Here’s the post:

1) Login to shell via root.

2) Open the shell configuration file.

nano -w /etc/ssh/sshd_config

 

3) Change port.

Uncomment and change

#Port 22

to look like:

Port 6472 (choose your own 2 to 5 digit port number (49151 is the highest port number)

 

4) Save and exit.

Ctrl + X + Y

 

5) Restart shell. (Make sure if you have a firewall installed that you have the new port unblocked.)

/etc/rc.d/init.d/sshd restart