Hello everyone,
I'm following Urban Penguin's (UP) Udemy course on FreeBSD; in module eight he enlightens me on the existence of aliases, a remarkably useful feature. Supplemented by this FreeBSD Wiki on aliases, I tried to follow UP's example and add an alias to the cshell. I open .cshrc, in this case of the root user, and add:
This is added below a row of aliases already present in .cshrc:
alias h history 25
alias j jobs -l
alias la ls -aF
alias lf ls -FA
alias ll ls -lAF
alias ls ls --color=always
On saving and exiting the document, I perform
I noticed that, apparently, there is an inconsistency between UP's example, and what I see presented in the Wiki. The Wiki is without the "=always" value.
I decided to try the Wiki's example, while also changing the alias name from
I thus try to create the alias as follows:
On exiting and saving the document, I perform
For a non-root user, I have tried to attain the same effect for the sh/bourne shell; I was adviced elsewhere on the Internet to add the following to .profile in a user's home directory in order to attain an abbreviated ls --color:
I understood I should add the following code, to attain the effect of
ls() {
command ls --color=auto "$@"
}
I have not yet been exposed to the coding language presented here, but I assume it is shell scripting, or a specific variant of shell scripting.
On saving and exiting, and executing
I have verified if whether or not I am in the relevant shell by using either
I have also tried opening a new terminal, just in case a new instance would load the altered configuration.
Thank you for bearing with me!
SilverC3ll
I'm following Urban Penguin's (UP) Udemy course on FreeBSD; in module eight he enlightens me on the existence of aliases, a remarkably useful feature. Supplemented by this FreeBSD Wiki on aliases, I tried to follow UP's example and add an alias to the cshell. I open .cshrc, in this case of the root user, and add:
alias ls ls --color=always
This is added below a row of aliases already present in .cshrc:
alias h history 25
alias j jobs -l
alias la ls -aF
alias lf ls -FA
alias ll ls -lAF
alias ls ls --color=always
On saving and exiting the document, I perform
ls
, but this does not automatically perform ls --color
, as intended.I noticed that, apparently, there is an inconsistency between UP's example, and what I see presented in the Wiki. The Wiki is without the "=always" value.
I decided to try the Wiki's example, while also changing the alias name from
ls
to lsc
, just in case setting an alias-ls conflicts with the already extant ls
command, present per base install.I thus try to create the alias as follows:
alias lsc ls --color
On exiting and saving the document, I perform
lsc
, but it is returned that the command is not found.For a non-root user, I have tried to attain the same effect for the sh/bourne shell; I was adviced elsewhere on the Internet to add the following to .profile in a user's home directory in order to attain an abbreviated ls --color:
I understood I should add the following code, to attain the effect of
ls
automatically being executed as ls --color
:ls() {
command ls --color=auto "$@"
}
I have not yet been exposed to the coding language presented here, but I assume it is shell scripting, or a specific variant of shell scripting.
On saving and exiting, and executing
ls
in the user's bourne shell, does not result in the effect of ls --color
.I have verified if whether or not I am in the relevant shell by using either
ps -s $$
or echo $SHELL
. I verified the correct user via whoami
. I did this because I considered that I might somehow not experience the root user's cshell configuration via attaining root and the root shell using su
via a wheelgroup user. Of course, optimally, that shouldn't matter, but I just wanted to make sure.I have also tried opening a new terminal, just in case a new instance would load the altered configuration.
Thank you for bearing with me!
SilverC3ll