When you are working on the command line you are always in a working directory. Print your current working directory with the command pwd
.
This guide assumes you have previously cloned ic01-hello_world
into the folder cs110
. Once you have cloned a repository it will stay on your computer until you delete it. There is no need to clone it again.
I will use $
to designate the command line prompt.
The cd
command will change your current working directory. Change into your cs110
folder like so:
$ cd cs110
To go back a directory, use
$ cd ..
You can change directories along a longer path by separating directory names with a forward slash:
$ cd cs110/hw01-hello_world
ls
lists files and directories. When run without any arguments it will list the contents of the current working directory. Here is example output of ls
when run in the hw01-hello_world
directory:
$ ls
a.out hello_world hello_world.c
To list all files including hidden files:
$ ls -a
. .. .git a.out hello_world hello_world.c
.
is an alias for the current directory, and ..
is an alias for the parent directory of the current directory.
To delete a file, use rm
. WARNING!! rm
does not move files to a trash or recycle bin, it deletes them permanently. Make sure you know what you are removing when you use rm
!
$ rm a.out
$ less hello_world.c
Press q
to exit less
.