Linux : How do you display each sub-directory size in a list format via the command line

If you want to get a list of the directories and their sizes in a list format then siply use the below:

du -h
Provides this but it displays all of the sub-folders.
du -h --max-depth=1

Alternative

If --max-depth=1 is a bit too long for your taste, you can also try using:

du -h -s *

This uses -s (--summarize) and will only print the size of the folder itself by default. By passing all elements in the current working directory (*), it produces similar output as --max-depth=1 would:

The difference is subtle. The former approach will display the total size of the current working directory and the total size of all folders that are contained in it… but only up to a depth of 1.

Add an Additional Disk Drive to Your Linux Server or VM and and partitioning it

Prerequisite: This tutorial covers adding a new disk drive to your linux computer. First it is assumed that the hard drive was physically added to your system.

IDE based systems, can support two drives on each ribbon cable. The cable is attached to either the Primary or Secondary IDE controller. A “jumper” is pressed onto two pins (thus connecting the two pins) on the drive to define the drive as a “Master” or a “Slave” drive. Each cable can support one master and one slave drive. Typically new desktop systems have one hard drive connected as a Master on the Primary controller and one CD-Rom on the second cable configured as a master. Read more

How to change the hostname in Linux

If you are new to linux you probably will wonder how to change the hostname of your computer or server. (A hostname is the unique name by which a network attached device is known on a network.) If you enter the wrong hostname during the installation, and you need to change the hostname, here is the solution:-

 

  • Edit file /etc/sysconfig/network using your favourite editor. In my case is nano. So i’ll enter  nano /etc/sysconfig/network
  • Look for HOSTNAME=xxxxxx
  • Change the xxxx to the name you wish to set for your computer. (ex: HOSTNAME=wiredgorilla.com)
  • Save the file and restart the xinetd service. (ex: type service xinetd restart in your shell)
  • Done! You have just changed your hostname in Linux platform

Plesk Login prompt error

Plesk Login prompt Issue

A strange login prompt is presented when trying to view a website on a windows plesk account , even though the website directory is not password protected.

The Fix:
This issue results from the anonymous account password used to deliver the site to public web viewers , getting out of sync with the main account password. To fix, just re sync anonymous password by issuing the following command in the run dialog:

"%plesk_bin%\websrvmng.exe " --update-anon-password --domain-name=yourdomain.com

Excluding Packages from Yum Update

When running a ‘yum update’ under CentOS, there are certain packages you may be running which you wish to remain static, or which can potentially cause errors with the update eg. Samba.

In these situations it is useful to force yum to exclude certain packages from being updated under CentOS.

Yum uses a configuration file located at <strong>/etc/yum/yum.conf or /etc/yum.conf

If you wish to exclude packages you need to define a list for exclusion from updates or installs. This should be a space separated list. (Shell globs using wildcards * and ?) are allowed).
Read more