The shell takes commands in the following format:
program [argument1 ...]
When you see notation like this, it is not meant to be copy and pasted directly. Underlined words are placeholders for something, otherwise the word should be typed as written. [words in brackets]
are optional arguments which should either be present or absent. A ...
means that additional arguments can optionally follow.
All file or directory arguments are paths. For a refresher on how to write paths, see Unix Filesystem section on the ECE 120 wiki.
man 1 program
Get detailed help on usage of program
. On most systems, you can scroll with the arrow keys and hit "q" to quit.
man 3 function
[C Programming] Get detailed help on usage of library function function
.
pwd
Print the absolute path for the current working directory
ls [directory]
List contents of directory
, or current working directory if directory
is absent.
cd directory
Change current working directory to directory
.
mkdir directory
Create a new directory directory
touch file
Create a new empty file file
mv source destination
Move a file or directory source
to file or directory destination
. If destination
is an existing directory, move source
into it. Otherwise move and rename (if names are different) source
to destination
.
cp [-r] source destination
Copy a file or directory source
to file or directory destination
. Behaves like mv, but copies instead of moving. If a directory is being copied, all of its contents will be copied and the -r
flag must be present.
rm [-r] path
Delete a file or directory path
. This cannot be undone. If a directory is being deleted, all of its contents will be deleted and the -r
flag must be present.
gedit file [&]
Edit file
using gedit (GUI text editor). If file
doesn't exist, create it when you click on "save". Appending the &
will tell the shell to launch a separate process for gedit.
nano file
Edit file
using nano (command line text editor). Useful if you don't have access to the GUI. Nano "commands" will appear at the bottom of the screen, which are control key sequences. For example, ^X: Exit
means hit Control-x
to exit back to the shell.
exit
Terminate the shell (which will also close your terminal emulator window on most systems)