unable to use the alias command
Hello world,
I am fairly new to linux and just learning how to use the terminal. I am unable to use the {alias} command (ie: alias list = "ls -a -l -t" ) in fact when i use {whatis alias} i get the message : alias nothing appropriate i tried {sudo apt-get install alias} but it didn't find anything. any suggestions? |
No spaces allowed around '=', but for a cmd like that you will need single quotes thus
Code:
alias list='ls -a -l -t' NB: if you type that interactively, it will only persist for the current terminal session. For permanence, add that line to your .bashrc file (ie /home/<username>/.bashrc. PS: the 'alias' cmd with no args will list all current aliases. Note that leading '.' at the start of a filename means its hidden from normal ls cmd; you'll need the -a option to list it. |
ty ty
well i know more about whats inside .bashrc and .bash_history now, but my alias still doesn't work for example: {alias Biglist = "ls -alt" } still wont work because my terminal does not acknowledge the command alias also, where are the aliases saved? |
As chrism01 said, no spaces between alias and first quote.
aka alias biglist='ls -alt' not alias biglist = 'ls -alt' Alias's are saved in your bash environment until you log out, unless you make them permanent as pointed out earlier. |
Like I said NO spaces ....
The 'alias' cmd is a built in for the bash shell. Which shell are you using Code:
echo $SHELL Also, please use code tags as specified here https://www.linuxquestions.org/quest...do=bbcode#code |
i see
thanks brethren i figured it all out |
glad to hear that.
Please mark the thread solved if your issue is solved. Also please tell us a few words about the solution you found. |
yes,
for all nooblets: the simple way i found for using aliases is to permanently add them into the terminal using {gedit .bashrc} then type in any alias you want and restart the terminal to take effect |
alias is part of bash, the package is bash, the executable is bash.
$ help alias $ alias -p $ unalias ls $ alias ls='ls --color=auto' alias is likely common among many shells, but it's part of the shell(s). |
All times are GMT -5. The time now is 10:35 PM. |