How can I create an alias in .bashrc for Kate editor, in order not to write kate file1 file2, but k file1 file2 for opening those files.


Add alias k='kate'. Here is a link to some more information on bash aliases.

You can't pass a parameter into an alias. You can do the cd dir_name"=>"cd dir_name; ls -l with a function and an alias like so

mcd () { cd "$1" && ls -l; }
alias cd='mcd'

That will only execute the ls -l if the cd is successful.

  • ok and how I can alias "cd dir_name"=>"cd dir_name; ls -l" – Narek Feb 3 '11 at 12:00

Alias is not safe and flexible. I always use the function.

$c() { cat $*; }
$b() { cd "$1" && ls -l; }
$ b /tmp
total 0
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.