• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

command shortcut??

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

firebird79

Member
Joined
Mar 24, 2002
i don't know whether we can do it, but just give it a try! is there anyway i can type something like "command" and it will do other longer command? simply said like if want to view all file include hiden file, we used to type "ls -a", right? but can i make something that can do this long command in short word?
 
alias lsa="ls -a"

If you want it to be permanent, just put it in your ~/.bashrc
 
For even longer things you could make a bash script and put it in the /usr/bin or something of that sort.

I always put "ls --color" in my .bashrc
 
okey, thanks.....eh.....for bash script things.......how to do that?? just curious..... :)
 
In my oppinion half the stuff on that link is worthless. I use BASH for very very simple execution of a series of commands, usually for the crontab. If I get into a situation which requires a little bit of thinking I use perl scripts and anything more complex I go to C++.

Simple bash example:

#!/bin/bash
mv backup.tar backup.old.tar
tar -cf backup.tar file1 file2 file3


The beginning line just tells linux this is a bash script.

Just make the file executable chmod +x thisfile then you can run it where it is or move it to something like /usr/bin/ and execute it any where on your system.
 
Just as an FYI. I like to use the command "ls -lah"

That simply makes the output a little easier to read. Since its in human readable format.

Try it.
 
PolyPill said:
In my oppinion half the stuff on that link is worthless. I use BASH for very very simple execution of a series of commands, usually for the crontab. If I get into a situation which requires a little bit of thinking I use perl scripts and anything more complex I go to C++.

Simple bash example:

#!/bin/bash
mv backup.tar backup.old.tar
tar -cf backup.tar file1 file2 file3


The beginning line just tells linux this is a bash script.

Just make the file executable chmod +x thisfile then you can run it where it is or move it to something like /usr/bin/ and execute it any where on your system.

C++. Bleah.
 
Back