Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid McGarvey
Full Stack JavaScript Techdegree Graduate 27,424 Points'-n' command option doesn't respond as intended while using it in the Terminal.
First off, great course! So in the Terminal, the output I get when I type this at the prompt: cat -n bird.txt cart.txt statue.txt
is slightly different than when I type the same in the workspaces command line prompt. I get back the content numbered, but all numbers are #1, as opposed to the ascending numbers I should get.
I get:
1 There is a bird here, looking up at the statue with interest.
1 A stand selling hot dogs and bottles of diet cola.
1 A statue of a hunter standing over a dead bear. Creepy.
When I should be getting:
1 There is a bird here, looking up at the statue with interest.
2 A stand selling hot dogs and bottles of diet cola.
3 A statue of a hunter standing over a dead bear. Creepy.
I'm guessing this has something to do with the versioning of Python on my machine. It's default is still Python 2 but I use Anaconda to be able to use Python 3 in the Terminal. Any ideas as to what is happening? Thanks in advance!
PS. Also, when I try to use the long form command of ls --all
, I get an unusual error back:
ls: illegal option -- -
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file...]
This has to be related, right?
5 Answers
Jay McGavren
Treehouse TeacherMac OS is based on BSD, and so has the BSD versions of cat
, ls
, and other tools. Although the commands work very similarly, there may be small differences. You can learn the details of the BSD versions using man
.
Many developers prefer to switch out the BSD tools for their GNU versions (so they work just like they do on Linux). You can learn how to do so here.
David McGarvey
Full Stack JavaScript Techdegree Graduate 27,424 PointsThanks Jay McGavren! This course is awesome!
Haben Gebremeskel
Python Development Techdegree Graduate 11,475 PointsCan we get an updated version on this? The step by step found in "learn how to do so here" is not working for me
KRIS NIKOLAISEN
54,972 PointsI'm on a Mac 10.14.1 and get the same results as you
Dave StSomeWhere
19,870 PointsInteresting, maybe you're running a different shell or have different settings on MAC's.
Code works as desired/expected on my Ubuntu 18.04 running the bash shell.
Also, the workspaces console is running the bash shell on Ubuntu 16.04.
Maybe someone has some insight as to the differences with the OS X terminal - sure seems like most people are using MACs.
Haben Gebremeskel
Python Development Techdegree Student 4,569 PointsHaben Gebremeskel
Python Development Techdegree Student 4,569 PointsI am very very confused on how to switch from BSD to GNU!!!