cls: command not found


I used ‘cls’ for it does clear screen and ls.
After I upgraded my ubuntu, i can’t use that any more. It showed:

cls: command not found

Finally I have found the solution.

You have to create a alias for the command you want to use.
For example, for cls

$ alias cls='clear;ls'

You can make more aliases,

$ alias cll='clear;ls -lh'

These aliases will vanish on your next login. So to make the change permanent you can add it to your ~/.bashrc or ~/.bash_profile. Just add the whole alias line as these files are executed (as bash scripts) on login.

Advertisements

How to delete useless file in Ubuntu


Using gedit creates lot of temp files of pattern “*~”. And if you are working in multiple directories its really hard to get to all these directories and delete these files.
Also, people want to delete “Thumbs.db” from windows directories but don’t know how.

Here is a solution:

This will find all the files,

find /path_to_directory -type f -name "file_pattern"

To delete these files, you can use

find /path_to_directory -type f -name "file_pattern" -exec rm -f {} \;

where /path_to_directory is path to directory from which you want to delete the files having pattern or name file_pattern recursively.

For example, to remove files like program.cpp~ created by gedit you can use

find /home/user -type f -name "*~" -exec rm -f {} \;

and to remove Thumbs.db from windows directories you need to do

find /media -type f -name "Thumbs.db" -exec rm -f {} \;

If you want to examine the files that are going to be deleted before doing it, you should execute the same command, changing ‘rm’ for ‘ls’, like this:

find /path_to_directory -type f -name "file_pattern" -exec ls -f {} \;

In this way you may control the list of files to delete.

PS: \; is necessary.
I hope this helps.