tedesco.net.au

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

Linux bits and pieces

Remove ^M using VI

E-mail Print
User Rating: / 5
PoorBest 

Have you ever opened a file in VI(M) and you are completely overwhelmed by the number of ^M characters in the file. I find it extremely distracting and have to get rid of them.

Well in VI(M) there is an easy way to do this.

 

:%s/^M//g

To get the ^M character all you need to do is the following key combination: <ctrl>+v, <ctrl>+m

Now all the ^Ms are gone and you can concentrate on the real content of the file instead of those ^M characters.

 

Finding large files in GNU/Linux using the command line

E-mail Print

Sometimes I need to locate large files to clean up a hard drive before it fills up and kills your system. This can be handy to use on a windows machine when you can't be bothered right clicking on each file and selecting properties to see the file sizes.

Download a live linux CD from one of the many vendors - my favourites are Knoppix and Ubuntu.

Load up linux from the CD - this will not overwrite your windows install.

On the desktop you will see all your windows partitions and drives, you will need to mount the partitions you want to search by double clicking them.

Now open a terminal and change to the mount point of your partition you want to search and run the following command:

find . -size +nM -print0 |xargs -0 ls -sSh

You will see a listing of all the files that are over the value n. Replace n with the size you want to search for - ie for 10MB type

find . -size +10M -print0 |xargs -0 ls -sSh

and this will find all files larger than 10MB.

You are here: Linux