Category: Linux/Unix/BSD

Information And Reviews On Linux, Unix And Bsd Operating Systems

Unix is a multi-user, multi-tasking operating system that was initially developed by Bell Labs in the 1970s. Various similar operating systems that are POSIX compliant (ie compatible with Unix) have since been developed (POSIX is an abbreviation for Portable Operating System Interface for UNIX). These include the following: the BSD family (OpenBSD, FreeBSD, NetBSD, Mac OS/X), Solaris, IRIX, AIX, SunOS, UnixWare, OpenServer and Linux.

Software written for POSIX compliant operating systems is generally able to be compiled for all POSIX platforms with little or no platform-specific changes. This makes the commands and utilities available for this extended family of operating systems very similar, and there are few differences between administering them.

The articles in this section are about useful command line utilities and commonly used application software on POSIX compliant operating systems. For Mac OSX specific articles see my OSX section.

Scp command

The scp command is a command-line utility primarily used to securely copy directories or files between two hosts or locations.

Read More »

Run a cron command every 15 minutes

Cron is a time based scheduling service on Linux and Unix computers which allows you to run process at specific times for example once a day, once every hour and so on. This brief post looks at how to run a cron command every 15 minutes.

Read More »

Screen: cannot open your terminal ‘/dev/pts/0’

If you are logged in as a user using “su” or “sudo su” and attempt to use screen, you’ll get the error message “Cannot open your terminal ‘/dev/pts/0’ – please check”. This post shows how to fix this.

Solution 1

Log out of the terminal/SSH session and log back in as the user you want to run screen as instead of using su.

Solution 2

script /dev/null


This worked for me on Debian 7.8 Wheezy.

Read More »

Change the default sort order for files and images in SilverStripe

SilverStripe’s File, Folder and Image objects have a default sort of ‘Name’, ‘Sort’ and ‘Name’ respectively, but if you are also using Uncle Cheese’s DataObjectManager the sort order will change to the ‘SortOrder’ field. Unless you’ve been sorting these yourself they’re going to appear in the ImageField control in a more or less random order, which isn’t idea. This post shows the solution.

SilverStripe version used

I have used the methods succesfully in this post with SilverStripe 2.4.5 

Changing the default_sort for ImageField and FileField

In your mysite/_config.php file, add the following:

File::$default_sort = 'Name';
 Folder::$default_sort = 'Name';
 Image::$default_sort = 'Name';

Alternatively make Folder::$default_sort = ‘Sort’ to restore the default behaviour, but I personally prefer to keep it in name order.

Files and Images table

Changing the default_sort as shown above won’t affect the order for the table of files/images in the Files and Images section of the CMS. However the DataObjectManager allows you to change the sort order by clicking the column headings, so it’s not really an issue so much.

However, if you want to make it use the default sort instead, the only way I could work out how to do this myself is to remove the File class from the sortable classes.

In theory, you should be able to do this:


But it didn’t work when I tried it because it only removes the extension from the class and doesn’t remove it from the SortableDataObject::$sortable_classes array. You could do this instead, although it’s a but hacky and may have unexpected consequences.

Again, add this to your mysite/_config.php file:

SortableDataObject::$sortable_classes = array();

and then move your existing SortableDataObject::add_sortable_classes declaration below it, if you did already have one.

This will not only make the table now sort in the default_sort, but will remove the useful features of dataobject_manager from the table, so I’d generally advise not to do this; I’m simply showing that it can be done.

Read More »