Random Linux

Linux, video games and web hosting

To display the disk space usage for your drives in Linux, you are able to use the df command.  By default, it will show the usage of all the mounted drives in 1k blocks.  If the POSIXLY_CORRECT environment variable is set though, it will show in 512 byte blocks by default.  Below shows the command run with no options.

[email protected]:~$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sdc1      575758492 126365356 420575064  24% /
udev             1538192        12   1538180   1% /dev
tmpfs             619612      1088    618524   1% /run
none                5120         0      5120   0% /run/lock
none             1549020       144   1548876   1% /run/shm

I personally like to use the -h flag with it, which will show the space in human readable format, in KB and GB.

[email protected]:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1       550G  121G  402G  24% /
udev            1.5G   12K  1.5G   1% /dev
tmpfs           606M  1.1M  605M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.5G  144K  1.5G   1% /run/shm

The -a flag will show all of the file systems, including dummy file systems.

[email protected]:~$ df -a
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sdc1      575758492 126365360 420575060  24% /
proc                   0         0         0    - /proc
sysfs                  0         0         0    - /sys
none                   0         0         0    - /sys/fs/fuse/connections
none                   0         0         0    - /sys/kernel/debug
none                   0         0         0    - /sys/kernel/security
udev             1538192        12   1538180   1% /dev
devpts                 0         0         0    - /dev/pts
tmpfs             619612      1088    618524   1% /run
none                5120         0      5120   0% /run/lock
none             1549020       144   1548876   1% /run/shm
binfmt_misc            0         0         0    - /proc/sys/fs/binfmt_misc
rpc_pipefs             0         0         0    - /run/rpc_pipefs
nfsd                   0         0         0    - /proc/fs/nfsd

Using df with the –total flag will show the drive spaces as well. The total space of all the drives together.

[email protected]:~$ df -h --total
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1       550G  121G  402G  24% /
udev            1.5G   12K  1.5G   1% /dev
tmpfs           606M  1.1M  605M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.5G  144K  1.5G   1% /run/shm
total           553G  121G  405G  23%

Using the -i flag will show the number of inodes on the drives.  Inodes are the number of files and directories the disk contains.

[email protected]:~$ df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/sdc1      36028416 525729 35502687    2% /
udev             210007    628   209379    1% /dev
tmpfs            215421    607   214814    1% /run
none             215421      5   215416    1% /run/lock
none             215421      4   215417    1% /run/shm

The -T flag can also be added to show the filesystem type, such as ext3 or NTFS.

[email protected]:~$ df -T
Filesystem     Type     1K-blocks      Used Available Use% Mounted on
/dev/sdc1      ext4     575758492 126365408 420575012  24% /
udev           devtmpfs   1538192        12   1538180   1% /dev
tmpfs          tmpfs       619612      1088    618524   1% /run
none           tmpfs         5120         0      5120   0% /run/lock
none           tmpfs      1549020       144   1548876   1% /run/shm

The df command also has a couple other options, but I won’t be covering those today since the aren’t usually needed regularly.  The help info for the df command is below for reference.

Usage: df [OPTION]... [FILE]...20         0      5120   0% /run/lockShow information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.

-a, --all             include dummy file systems
-B, --block-size=SIZE  scale sizes by SIZE before printing them.  E.g.,
`-BM' prints sizes in units of 1,048,576 bytes.
See SIZE format below.
--total           produce a grand total
-h, --human-readable  print sizes in human readable format (e.g., 1K 234M
-H, --si              likewise, but use powers of 1000 not 1024
-i, --inodes          list inode information instead of block usage
-k                    like --block-size=1K
-l, --local           limit listing to local file systems
--no-sync         do not invoke sync before getting usage info (defau
-P, --portability     use the POSIX output format
--sync            invoke sync before getting usage info
-t, --type=TYPE       limit listing to file systems of type TYPE
-T, --print-type      print file system type
-x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
-v                    (ignored)
--help     display this help and exit
--version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

Report df bugs to [email protected]

GNU coreutils home page:

General help using GNU software:

For complete documentation, run: info coreutils 'df invocation'

Know some other things you can do with the df command?  Tell us about it in the comments!

March 18th, 2013

Posted In: General

Tags: , , , , , , , ,

Leave a Comment

Whmcs has released a patch for the 4.x and 5.x versions of their software today that fix some security issues.  They are not releasing the details of the security issue as of yet, but it is highly recommended that you apply the patches as soon as possible.  You can find more about it at their blog.


Keep secure!

March 12th, 2013

Posted In: Security

Tags: , ,

Leave a Comment

Below are a list of apache error codes. These can be helpful when checking for issues in the apache logs.


March 5th, 2013

Posted In: General

Tags: , ,

Leave a Comment

It’s safe to say that I spend a lot of time on the command line, and really prefer to do as much as possible from there.  So, it only makes since to be able to control my DVR from the command line too.  So, I created dtv.py, the DirecTV command line remote.  As of now, you can operate almost all of the buttons that would be on the remote, as well as get information about different channels and see a scrolling list of what is on all of the channels



[wpdm_package id=’61561′]


You will need to edit the following line in the script to add the IP address of the DirecTV box to the script.


####### Put the IP of your DVR here! #######

boxip = ‘’

You can also set your favorite channels for the -f flag in the favorites section of the script.

## Put your favorite channels here, seperated by spaces ##

favs = ‘2 13 20 26 39 249’


Here are the different commands that you can run as of now.


usage: dtv.py [-h] [-v] [-i channel] [-c] [-t channel] [-a start,end]
[-b BUTTON] [-f] [--devlist]
optional arguments:

-h, –help show this help message and exit
-v, –version show program’s version number and exit
-i channel, –info channel
Shows info for a channel.
-c, –current Shows info for currently tuned channel
-t channel, –tune channel
Tune to a channel
-a start,end, –all start,end
Show a scrolling list what what’s on a range of
channels. Must specify a comma separated start and end
-b BUTTON, –button BUTTON
Press a button as you would on a physical remote. Can
use a comma to separate button presses
-f, –favs Show what is on your favorite channels
–devlist Show list of options available from the DVR. Only good
for development


There is more to come and feature requests are very welcome!

February 23rd, 2013

Posted In: How To

Tags: , , , , , ,

Leave a Comment

So you have downloaded a .deb file with a program that you would like to install. Most distros that are using a graphical interface will have a package manager that you can use to install these. But if you’re like me, you prefer to do it from the command line. To install it from there, you will need to use the dpkg command, using the -i flag, which does the install. In this example, I have dowloaded Google chrome for Linux from their website and am installing it on Ubuntu.

[email protected]:/home/user/Downloads# dpkg -i google-chrome-stable_current_i386.deb 

Selecting previously unselected package google-chrome-stable.
(Reading database ... 296976 files and directories currently installed.)
Unpacking google-chrome-stable (from google-chrome-stable_current_i386.deb) ...
Setting up google-chrome-stable (21.0.1180.79-r151411) ...
update-alternatives: using /usr/bin/google-chrome to provide /usr/bin/x-www-browser (x-www-browser) in auto mode.
update-alternatives: using /usr/bin/google-chrome to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode.
Processing triggers for man-db ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Processing triggers for menu ...

If that finishes with no errors, then the package should be installed. In this case, I can now open Google Chrome though the Window manager’s menu or through the terminal.

August 17th, 2012

Posted In: How To

Tags: , , , , , ,

One Comment

Download v1 of the RandomLinux.com Android app! Stay up to date on everything that’s Linux right from your phone or tablet!

Download below!

[wpdm_file id=5]


June 10th, 2012

Posted In: How To

Tags: , ,

Leave a Comment

Samba is an open source software suite which provides file and print services. This can be installed using a few commands, or using our installation script at the bottom of this post.


The first thing that you need to do is install the Samba and samba-common packages.

sudo apt-get install samba samba-common

You will then want to make sure that python-glade2 is installed.

sudo apt-get install python-glade2

After that, you will want to install the Samba configuration tool.

sudo apt-get install system-config-samba

You then need to add a user account for the Samba user. You can use any name you would like.

sudo useradd sambauser

You will also want to create a user for you to log into your Samba server when you connect.

sudo smbpasswd -a sambauser

You will also want to run the Samba Configuration tool to set up the folders that you want to share. You can find that in your system’s app tray or you can start it by using the following command.

sudo system-config-samba

You are also able to download the installation script we created to help you automate installing that. This was tested on Ubuntu 12.04, so I cannot guarantee that it will work on anything but that. If you need it to work on your OS, let us know what you’re using and we’ll get a script set up for it.

Download the installation script here:

[wpdm_file id=4]

You need to make the permissions for this executable (something like chmod 755 installsamba.sh), then run:

sh installsamba.sh

Let us know how it works for you! If you like it and it helps you, feel free to share!

If you would like to see the source code for that, you can see it here:

installsamba.sh Source


June 5th, 2012

Posted In: How To

Tags: , , , , , ,

One Comment


If you are running a cPanel server, you are able to use EasyApache to add and remove many PHP extensions. cPanel has the ability to also install and uninstall PHP modules on the fly using the phpextensionmgr, which can be found at /scripts/phpextensionmgr. You are able to see the usage and option by using the –help flag, as shown below.

[email protected] [~]# /scripts/phpextensionmgr --help
    phpextensionmgr [options] [action] [extension]

          --help       Help message
          --prefix     Installation prefix for PHP (normally /usr/local or /usr/local/php4)

          install      Install or update the extension
          uninstall    Uninstall the extension
          status       Display the installation status of the extension
          list         Show available extensions


As you can see, you are able to install, uninstall, display whether or not the extension is installed, or list all of the available modules. Running the list command as below will show all of the modules that are available to be added on your server.

[email protected] [~]# /scripts/phpextensionmgr list 
Available Extensions:

You can also find the status of a single module by using the status flag.

[email protected] [~]# /scripts/phpextensionmgr status Xcache
Updating md5sum list
Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz.yaml (connected:0).......
(request attempt 1/12)...Using dns cache file /root/.HttpRequest/httpupdate.cpanel.net
......searching for mirrors (mirror search attempt 1/3)......
mirror search success......connecting to
@ success......Done
Downloading tarball for Xcache
Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz/Cpanel/Easy/Xcache.pm.tar.gz (connected:0).......
(request attempt 1/12)......connecting to [email protected]
receiving...100%......request success......Done
Determining status of Xcache
Xcache extension is NOT installed


If we wanted to install Xcache, we would use the install flag, which will take care of the entire install process.  Keep in mind that we are only using Xcache as an example and it’s usage will depend on your server configuration as well.

[email protected] [~]# /scripts/phpextensionmgr install Xcache
Installing Xcache
Determining PHP version
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Will now run system( ./configure,--with-php-config=/usr/local/bin/php-config )
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
(More compiling stuff)
/bin/sh /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/libtool --mode=install cp ./xcache.la /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules
cp ./.libs/xcache.so /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules/xcache.so
cp ./.libs/xcache.lai /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules/xcache.la
PATH="$PATH:/sbin" ldconfig -n /home/cpeasyapache/phpextensions/xcache/xcache-1.3.2/modules
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

Build complete.
Don't forget to run 'make test'.

Got ret value 0 from system( make )
Will now run system( make,install )
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
Got ret value 0 from system( make,install )
Will now run system( make,clean )
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f 
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la   modules/* libs/*
Got ret value 0 from system( make,clean )
Xcache extension activated
./cpanel-install exiting with exit code 0

If you wanted to remove that module, you could do so with the uninstall flag.

[email protected]evbox [~]# /scripts/phpextensionmgr uninstall Xcache
Uninstalling Xcache
Removing xcache from /usr/local/lib/php.ini


Using /scripts/phpextensionmgr can help you to add, remove, find the status of particular modules and list the available modules.  In you day to day work, this can help you to save time by not needing to run EasyApache to install the PHP modules which can save time and unnecessary load on your server.




May 16th, 2012

Posted In: How To

Tags: , , , , , , , ,

Leave a Comment

The Flipboard android app was recently released with the Samsung Galaxy S3 and it is a great app. This has recently leaked from the S III dump and is working on other devices. We do not take any credit for this, we just wanted to add another place to download it. You can find that below. Enjoy!

[wpdm_file id=3]

May 13th, 2012

Posted In: Uncategorized

Leave a Comment

If you have recently updated to Ubuntu 12.04 with Gnome as your desktop and are using dual monitors, you have probably noticed that only one of the screens switch workspaces and the other stays fixed. Before, you were able to fix this by using the gconf-editor, however now when you make changes to that, it is no longer working and the changes are not being applied. To fix the monitors when that does not work, you need to run the following command, which will disable workspaces-only-on-primary, which is basically doing the same thing as is done in the gconf-editor.

Run this command as the user that you are logged in as (not using sudo or as root in the command line)

gsettings set org.gnome.shell.overrides workspaces-only-on-primary false

You should not receive any output when you run the command and the changes should be applied immediately without needing to log out. You will now be able to change workspaces correctly on both monitors.

May 3rd, 2012

Posted In: How To

Tags: , , , , , , ,

Leave a Comment

« Previous PageNext Page »