I started up my coding journey a little more than two weeks ago:
baby steps...
Michael Tharrington ・ ...
For further actions, you may consider blocking this person and/or reporting abuse
Awesome stuff, I love reading about people's early journeys into the world of the terminal 😎
You should definitely learn about your
~/.bashrc
file if you haven't yet, it's a special file that gets run each time you open the terminal and it lets you set up a bunch of environment stuff to make your life easier, things like short aliases for common long commands and, importantly, environment variables.And speaking of environment variables, the real reason I'm writing is that you can customize what your prompt (the
Michaels-MacBook-Pro:~ dev$
bit) looks like using a variable calledPS1
. Google around and you'll quickly find more examples that you could want, but the biggest thing is that you can set it up to always print your entire path, or your path relative to your home directory, so you always know where you are without having to typepwd
ever again!A very simple, no-frills PS1 that will accomplish this is:
Try typing that into your terminal, and you should start to see this prompt (assuming your username is
michael
and yourpwd
is~/code/dev
):If you like what it gives you, edit (or create)
~/.bashrc
and paste it at the bottom. Then it will work in all future shell sessions, and you can say goodbye topwd
!Here's a good overview of what the variables up there mean, and all the other ones you can use in your
PS1
: ss64.com/bash/syntax-prompt.htmlWOW! This is all amazing!! You just made my night, thanks so much. 😃
Btw, forgot to say this in the above comment: full paths can get pretty long, so what a lot of people (myself included) like to do is add a line break
\n
right before the$
to drop it onto a new line:And if you want a little splash of color, there's a bunch of color codes in the link in my last comment, but to start off, I like to make my
user@hostname
part a different color from my path, maybe light blue for the former and yellow for the latter. And always remember to reset your color to the default with\e[0m
at the end, unless you want all the text you type to be colored as well, if that's your thing.Give that a try and see what you think!
Thats great work with the terminal!
When I started out with C++ I was already a bit familiar with it since I used Ubuntu at the time, and we have command line package managers (instead of the app store). That being said, I still don't know some of the commands in your picture there 😂, but I do know quite a few languages (although I'm still learning).
Thanks for the kind words, Gavin! And, I've actually been thinking about installing Ubuntu on my Lenovo - kinda wanna see what's outside the Mac/Windows box. I've yet to explore...
Ohh I challenge you to a standard Arch Linux install. That's probably the quickest way to learn quite a bit about the command line and Linux at the same time. (We even have command line web browsers if you need to refer to the arch wiki, yeah that's a thing)
If you're really feeling daring, try Gentoo. Although your hair'll probably grow white before Chrome compiles 😂
Congrats on getting over the terminal fear! Now your family and friends will think you're a super-hacker even if all you do is
cd
around andcat
stuff.Btw. I tried to
cp -r test test
and it gives mecp: cannot copy a directory, 'test', into itself, 'test/test'
:(Hmmm... that is weird! I actually had to recreate this issue by memory because I kinda forgot how I did it the first time. Anyway, initially when I tried to recreate it I just went to type in
cp test test
and go the message:cp: test is a directory (not copied).
But then I remembered to involve the
-r
and the infinite folder situation played out as expected. In fact, I just tested it again to make sure I'm not going crazy.Could it be because I'm working with Terminal on Mac? Or possibly that I have no extra frills installed.
I'm on version 2.9.1:
Nice! It's cool to see your journey and observations. If you want more examples, exercises, and introductions for the command line, Small, Sharp Software Tools by @bphogan.
Brian P. Hogan
is a really great resource to work through. Takes things slow, but explains things with real-world examples that make the lessons stick. :)
Appreciate the kind words and thanks for sharing the resource! I'll definitely take a look!
Nice work. I think most people learn commands on a need to know basis. If you can navigate the filesystem you're set to do whatever.
Thanks! Good stuff! I feel pretty confident with these basic commands now and can get around pretty well. Glad to know the rest is really more of a need to know basis.
Awesome, Michael! I definitely had the same set of notecards a few years ago :)
But were yours hand cut from loose leaf notebook paper? Haha, appreciate the encouragement! 😀