0

I have just started pset6 and i am trying to run staff's implementation. However I am getting error as shown in picture below. Kindly suggest the fix. Thanks

~/workspace/ $ cd /home/cs50
/home/cs50/ $ cd pset6
/home/cs50/pset6/ $ ls
server*
/home/cs50/pset6/ $ server
bash: server: command not found
/home/cs50/pset6/ $ server*
bash: server: command not found
/home/cs50/pset6/ $ cd Dropbox
bash: cd: Dropbox: No such file or directory
1
  • Make sure you are using the correct version of the specification. CS50x 2015 mentions "Dropbox" in the instructions. CS50x 2016 does not. Correct specification can be found here. The assignment changed very much between the two terms. – DinoCoderSaurus Oct 7 '16 at 13:55
0

When you execute a program from the command line, you need to provide either an absolute pathname or a relative pathname to the executable file, unless the executable is located in a directory which is specified in your shell's $PATH environment variable.

Absolute pathnames start relative to the root directory:

/home/cs50/pset6/server

or this shorter version:

~cs50/pset6/server

The second one works because ~cs50 is equivalent to /home/cs50.

Using an absolute pathname like this should fix your problem. You will not even need to cd to the CS50 Staff's home directory.

Relative pathnames start relative to the current working directory:

cd /home/cs50/pset6
./server

or like this:

cd /home/cs50
./pset6/server

or even like this:

cd /home/ubuntu
../cs50/pset6/server

When you type server by itself on a line, instead of ./server (assuming that your working directory is /home/cs50/pset6) the shell looks for the server command in all the directories on your $PATH.

In the IDE, the $PATH is long and maybe a bit overwhelming:

~/workspace/ $ echo $PATH
/home/ubuntu/.nvm/versions/node/v4.2.1/bin:/home/ubuntu/bin:/usr/local/rvm/gems/ruby-2.2.1/bin:/usr/local/rvm/gems/ruby-2.2.1@global/bin:/usr/local/rvm/rubies/ruby-2.2.1/bin:/home/ubuntu/bin:/opt/cs50/bin:/mnt/shared/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin

In the Appliance, the $PATH is shorter and easier to read:

jharvard@appliance (~): echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Since there is no executable binary or script file named server in any of those locations, the bash shell responds with the helpful error message:

bash: server: command not found

The error message tells you three things. Most obviously, it tells you "command not found" -- something you typed was not found on the $PATH.

Less obviously, it also tells you where the error is coming from ("bash:" -- the "Bourne Again SHell" command interpreter) and also what invalid command you tried to execute.

~/workspace/ $ waleed
bash: waleed: command not found

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .