Basic Linux Command LineΒΆ
Most of what we will do in this course can easily be done with a command- line window, sometimes called a shell window. The command-line window lets us type commands to run programs.
By default, command-line windows in Ubuntu uses the BASH command-line, and when you first launch it you will see a prompt something like this:
tjd@ubuntu-desktop:~/cmpt$
The key part of this prompt is the $
. Everything before the $
is
information about what computer you are using and what directory you are in.
Everything after the $ is what you, the user, type.
The shell includes a complete programming language and dozens of commands. Here is a brief summary of basic commands you should know:
Sample Command | Summary |
pwd | prints the present working directory |
ls | lists the files and folders in the current directory |
cd a2 | change to directory a2 |
rm old.cpp | delete the file old.cpp |
cp a1.cpp a1 | copy file a1.cpp to the folder a1 |
man g++ | display the manual page for the g++ command |
less a1.cpp | display contents of a file (paged) |
cat a1.cpp | display contents of a file (unpaged) |
There are many tutorials and help pages available on the web for learning Linux command-line. For xample, this tutorial list discusses many basic Linux commands, with helpful examples.
It is also common to manipulate files and folders interactively in the GUI. Just open the folder you want to change, and use the typical drag-and-drop actions to move, copy, rename, etc. files and folders.