Check the size of a directory in Linux
In this tutorial, we will look at how to check the size of a directory in Linux. This task is done using the du command which is a standard Unix/Linux program. The abbreviation du is short for disk usage.
Checking the size of a directory may be useful, for example, on something like a Linux web server where we may want to know what the size of our web root is for backup purposes. The simple fact is, being able to check the size of a directory in Linux is very useful in a number of ways.
Check Free Space on Linux
In this tutorial we will look at how to check free space on Linux or Unix from the command line. It is important to keep track of the amount of free disk space you have, especially on a server where it is of utmost importance that data loss or downtime be kept to a minimum.
Linux and Unix systems come with a handy utility called df (short for disk free) which is used to display the amount of free space on any filesystem that the user invoking the command has read access to.
Which shell am I using?
In this tutorial we will look at how to find out which shell is currently being used. Let's say that you just got shell access on an Ubuntu Linux box or some other box with a Linux distribution. The first thing you should want to know is what shell you are using. This is because different shells offer different features. You may well come to realise that if you are not using a shell that you are familiar with, you may be less productive.
To find out which shell you are currently using, type the following command:
echo $SHELL
Access associative array from inside double-quotes in PHP
Outputting a variable as part of a string in PHP using double-quotes is straightforward. We all know that when strings are placed in double-quotes, the PHP interpreter examines them to see if there are any variables inside which we intend to output.
This is a very useful feature as it saves us from having to concatenate the variable to the string as in some other languages.
For example, this is how we would normally output a variable as part of a string in PHP:
<?php $name = 'Sally'; echo "I love $name"; ?>
The result would be:
Check open ports on Ubuntu Linux
One may want to check open ports on Ubuntu to ensure that there are no services listening that shouldn't be. If we remember, a port is what an application will use to communicate with another application, provide a service, etc. To get an idea of what services are running on a system, we would need to check the open ports on the system.
Why can't I edit a node that I have permission to edit in Drupal?
In Drupal, sometimes when you add the appropriate permissions for a user to be able to edit a node you are surprised when no edit tab comes up and if you navigate to the edit URL directly you get an "access denied" error.
If you think you have added the permissions correctly and cleared all the relevant caches, the following may help you solve your problem. It turns out that you may not have added the permissions correctly after all.