Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I create a new alias command called cet103demo which displays the contents of the bash history list one page at a time, and also making sure the new alias is automatically loaded when the virtual machine starts up?

share|improve this question

2 Answers 2

Fairly simple. Just run the following in a terminal:

echo 'alias cet103demo="history | more"' >> ~/.bash_aliases
source ~/.bash_aliases
cet103demo  # to test

You'll only have to run these once to remove it, you'll just need to edit ~/.bash_aliases (it'll be the last line).

share|improve this answer
1  
Isn't it better to put aliases in ~/.bash_aliases than in ~/.bashrc, though it does matter technically, just to organize things better? –  i08in Apr 3 at 14:02
    
@Jobin Probably, yeah. –  Oli Apr 3 at 14:06
    
So i would open Gedit add #!/bin/bash and paste in "echo 'alias cet103demo="history | more"' >> ~/.bash_aliases source ~/.bash_aliases' " under neath ?? –  user264934 Apr 3 at 17:37
    
@user264934 No. You must to open the terminal and run those commands inside of. –  Radu Rădeanu Apr 3 at 19:31

Add the following line to your ~/.bashrc file:

alias cet103demo="history | more"

And just hit SPACE to page down

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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