Terrifying bunch of codes!

Almost for two years, I was suffering from using clear  command in Putty terminal screen. If you have used it before, you could recall that this command is not cleaning the terminal. It’s just shifting your code. So whenever I scroll up, I was welcomed by my ugly code. Damn! It is especially annoying when I’m running make  command to compile my C codes. It becomes incredibly difficult to distinguish where it starts and where it ends.

Today I learn a hack that somehow really cleans my terminal screen. I read it online and thought it may worth a shot. Before that, I wasn’t thinking there would be such a trick. Anyway, here is how you create your own Linux command so you can “really” clean the terminal screen in Putty. As far as I read, it also works for some other Linux terminal types, but I haven’t tested myself. I would be happy to hear results if you try it.

First of all, create a file named clc (this is optional, you can choose whatever name you like). Inside this file, put the following terminal script

and save the file. Ok, great. Now you need to set permission to run this file. Run following command on your terminal screen. Be sure to be at the folder level where your new file is.

Now you could run your command simply by typing  clc in this folder. The thing is you can’t use this command in any other folder unless you copy your file. But there’s another solution for that! If you are super user in your system, you can create an alias. Since I was just a regular user in the server, I follow another path and put this file into my home directory. Now I can call my new ‘clear’ function clc by the following command:

Easy, isn’t it? Now you can’t see your old code even if you scroll back. Now, that is what I call clean!

Much better!

It brings tears to my eye when I find this solution, so I would like to write it here. Hopefully it would work for you, as well. Comment below if you know other cool tricks on the Putty terminal command line 🙂