Command structure | command [option]... [argument]... |
---|---|
Commands | man , pwd , ls , cd |
Pathnames | / , ~ , . , .. |
/
, or a user’s home directory.
~
or ~
username
.
and the parent directory is: ..
pwd
, ls
, cd
Many Unix command have options that modify their behavior.
To learn more about a specific command try:
man
– show manual for command
info
– show info page for command
Consider them travel guides. man
and info
can answer many of your questions.
% cat ~/monster /| /| ||__|| / o o \__ / \ / \ \ / _ \ \ / |\____\ \ / | | | |\____/ / \| | | |/ | __ / / \ ------- |_____||__ / | | | --| | | | |_____ --| |<–|_|_|_|––<<< | \---- /\ | / /\ | / / / | | | ___/ / | | | |____/ c_c_c_C/ \C_c_c_c
The simplest way to view the contents of a file is to use:
more
– show a file one screenful at a time
cat
– dump the complete file to the screen
% ls % cp ~/monster . % ls monster % cp monster foo % ls foo monster % mv foo bar % ls bar monster % rm monster % ls bar
Here are three commands for handling files:
cp
– copy a file to some location
mv
– move a file to a new location
rm
– remove a file
% cp ~/monster . % ls -l total 4 -rw------- 1 cs155 class 401 Nov 23 17:19 monster % mkdir new_dir % ls -l total 4 -rw------- 1 cs155 class 401 Nov 23 17:19 monster drwx------ 2 cs155 class 40 Nov 23 17:19 new_dir % rmdir new_dir % ls -l total 4 -rw------- 1 cs155 class 401 Nov 23 17:19 monster
The previous commands allowed us to move files around in the file system, but what about modifying the structure itself?
mkdir
: make directory
rmdir
: remove directory
% echo hey children hey children % echo hey children hey children % echo "hey children" hey children % echo "~" ~ % echo ~ /s/bach/a/class/cs155
The echo
command prints some text to the screen.
"
to preserve text on the command line
Is this useful for anything? Sure!