| Usage Examples |
| $ ls |
lists files of your current working
directory. |
| $ cd /home/m012345/ |
change your working directory to your home
directory using a full, or absolute, pathname |
| $ cd |
change your working directory to your home
directory using a shortcut |
| $ mkdir lab |
creates a lab subdirectory in your current
working directory |
| $ cd lab |
change your working directory to the lab
directory in your home directory in this case |
| $ cd .. |
change your working directory to the parent
directory, which is your home directory |
| $ gedit main.cpp |
creates the file main.cpp, if it doesn't
already exist, and opens it in the gedit editing window |
| $ cp main.cpp lab/ |
copies the file main.cpp to the lab directory |
| $ mv main.cpp test.cpp |
renames main.cpp to test.cpp |
| $ mv test.cpp lab/lab1.cpp |
moves main.cpp to the lab directory under the
new name of lab1.cpp |
| $ ls -l lab |
lists files in the lab directory in more
detail |
| $ cat lab/main.cpp |
shows file contents of main.cpp, which is
located in the lab directory |
| $ rm lab/main.cpp |
deletes main.cpp from the lab directory |
| $ rm lab/lab1.cpp |
deletes main.cpp from the lab directory |
| $ rmdir /home/m012345/lab |
deletes the lab directory using its absolute
pathname. |
| |
| $ g++ new.cpp |
compiles and links new.cpp and creates an
executable file called a.out |
| $ g++ -o run new.cpp |
does the same as above, except creates an
executable file called run |
| $ g++ -Wall -o proj proj.cpp
|
compiles proj.cpp, but with all warnings enabled
and creates executable file called proj |