0

So I´m learning some short commands, like mkdir, rm, cd, cp and they are not working in my terminal window at the moment. The only one that seems to be working is ctrl l as in taking away text

These are examples of what is happening:

When i try mkdir:

/ $ 
/ $ mkdir switches
mkdir: cannot create directory ‘switches’: Permission denied
/ $ mkdir switches/
mkdir: cannot create directory ‘switches/’: Permission denied
/ $ 

when I write pwd nothing comes up:

/ $ pwd
/
/ $ 

when i try cd:

/ $ cd meow
bash: cd: meow: No such file or directory
/ $ 

when i try cp

/ $ cp meow.c mjau.c
cp: cannot stat 'meow.c': No such file or directory
/ $ 
1
  • Are you in the CS50 IDE or in your local terminal? For the cd and cp commands, are you sure you are in the correct directory? Because terminal commands vary by system, are you in a Linux or Mac terminal (I assume you are not in a Windows shell as some of these are not Command Prompt or PowerShell commands)? Apr 7, 2021 at 14:47

1 Answer 1

0

I will assume this is in the cs50 IDE. The prompt and path don't look like windows. The attempts to make a directory show you don't have permission to make a dir under '/'. Try to 'cd' or 'cd ~', which will get back to the user home dir. In that dir you should be able to 'mkdir switches' or 'cd meow' if it's already been created.
Another command for you to learn: 'ls' shows the contents of the current directory.

~/ $ cd /home
/home/ $ ls
cs50/  ubuntu/
/home/ $ whoami
ubuntu
/home/ $ cd ubuntu/
~/ $ ls
pset1/  pset3/  pset4/  pset5/  temp/


The first thing on the first line above is the prompt, which shows the path (~/) and $. The $ has been used as the 'type here' character for a long time. My input was 'cd /home' which could also have been typed as 'cd ..' and moved up a level. Doing an ls shows directories called cs50 and ubuntu. The 'whoami' command asked for the username, which happens to be ubuntu. The attempt to ' cd ubuntu' gets us back to '~', and an 'ls' there shows several weeks worth of program directories. Notice that after running 'cd', the prompt changes to reflect the new pwd.
Keep playing with those commands. It won't take long to get comfortable with them. The ctrl-l does the same thing as the 'clear' command. Ah, but learn the hotkeys, it's more fun that way.

You must log in to answer this question.

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