Theodoros Emmanouilidis

Notes & Thoughts
Browsing Tip Of The Day

Home Directory Consumes All Disk Space In Ubuntu

February27

Recently i faced a rather awkward situation. All available disk space of my Ubuntu workstation was gone. I was sure that i did not have that much files stored, so i began investigating.

The built in disk usage analyzer failed to report what was going on. It showed that my home directory occupied almost all disk space but the sum of the individual files reported was far less than the space my home directory used.

So, enough with the gui stuf. Terminal to the rescue!

Open a terminal and type

1
sudo du -a --max-depth=1 ~ | sort -n

inside the user’ s home folder or the folder that takes up most of disk space. Use sudo to read all available files.

The last file in the list the command outputs is the one that consumes the missing space. If it is not reported in disk usage analyzer, it is a hidden file that is very big.

In my case was

1
.xsession-errors

so, in order to reclaim your disk, type

1
2
sudo rm .xsession-errors
sudo rm .xsession-errors.old

and reboot.

So, if home directory consumes all disk space in Ubuntu, or you face a similar situation, the above method will surely help you out.

Case closed!

MySQL ERROR 1148

February15

You get this error

1
ERROR 1148: The used command is not allowed with this MySQL version.

in your MySQL version while trying to issue a

1
LOAD DATA LOCAL INFILE

command?

For security reasons this command is no longer available by default.

In order to use it, just start a MySQL client issuing this command:

1
mysql --local-infile=1 -u root(or some user) -p

Now the command is available for the session.

Remove Leading Whitespace Using Sed

February14

Sometimes a data file contains whitespace before the actual data. The following command will remove that whitespace.

1
cat original_file.txt | sed -e 's,^ *,,' > new_file.txt

Replace Spaces & Tabs With Spaces In File

February14

The following command will substitute all tabs & spaces in a file with just spaces. Very usefull if you want to prepare a file as csv or inject the data contained in a database table.

1
sed -r 's/[[:blank:]]/ /g' original_file > new_file
« Older Entries