What is the difference between
The difference concerns the difference between a “login shell” and a “non-login shell”. A shell is a login shell the first time you log in (i.e., when you first
ssh). You can create non-login shells by running the
bashcommand from an existing shell.
With that background, we can now appreciate the difference between the two files.
.bash_profilegets run when you start a *login shell
.bashrcgets run when you start a non-login shell
For most people, you don’t care about the difference so a common procedure is to have all of your configuration in your
source ~/.bashrcfrom your
Say I have a python script (you can run a python script as a bash command by doing
- a) I want to be able to run it as a command from any directory, what do I need to do to accomplish this?
- b) Now I want it to run every time I login to Attu, how would I do this??
alias randomnumber="python script.py"(note you would likely want to use an absolute path to make sure you can run it from any directory)
- b) Add it to your
How could I make it so if I type
attuin a shell on my local machine it will ssh into attu?
alias attu="ssh firstname.lastname@example.org"
How could I print all the files in my current directory that belong to the
The first solution works generally, but fails in some minor edge cases such as a file named
cse391. The second solution works more generally:
ls -l | grep "cse391" find . -group cse391
I have the file
run.sh, it currently has unknown permissions. Say I want the owner to have read, write, and execute permissions, the group to have only execute permissions, and others to have only execute and read permissions.
- a) How can I accomplish this using letter codes?
- b) What is an equivalent command using octal syntax?
chmod u+rwx,g+x,g-rw,o+rx,o-w run.sh
chmod 715 run.sh