Now that I scheduled my LFCS exam I am trying to spend more time with Linux. A big pet peeve of mine is that CLS and CLEAR are not the same thing, one works in CMD one works in the CLI but you can’t interchange them between Linux and Windows.

( Yet PowerShell is happy with either…!)

So to make life easier here how to add an alias in CentOS so both clear and CLS will work:

Aliases are defined in the .bashrc file on root. Can’t see it? It’s a hidden file so ‘ls -al’ should do the trick. See it now?

We can edit it just with vi:

vi .bashrc

The line we want to append should look like so:

alias keyword=’target’

So in my case: alias cls=’clear’

Keyword is the word you’d enter and target is the word / command that will actually be entered in the shell/CLI.

You’ll need to restart the shell or log out and back in again for it to work. Also make sure to save your .bashrc file for it to work….don’t ask… :oP

Post Navigation