CS155: Introduction to Unix

Spring 2018

Commands 1

See this page as a slide show

CS155 Commands1

Review

Command structurecommand [option]... [argument]...
Commandsman, pwd, ls, cd
Pathnames/, ~, ., ..

Learning More with man and info

Many Unix command have options that modify their behavior.

To learn more about a specific command try:

Consider them travel guides. man and info can answer many of your questions.

Viewing Files

% 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:

Modifying the file system

% 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:

Modifying the file system (cont.)

% cp ~/monster .
% ls -l
total 4
-rw------- 1 cs155 class 401 May  1 16:11 monster
% mkdir new_dir
% ls -l
total 4
-rw------- 1 cs155 class 401 May  1 16:11 monster
drwx------ 2 cs155 class  40 May  1 16:11 new_dir
% rmdir new_dir
% ls -l
total 4
-rw------- 1 cs155 class 401 May  1 16:11 monster

The previous commands allowed us to move files around in the file system, but what about modifying the structure itself?

echo, echo, echo, echo, echo, echo, echo, echo, echo, echo, echo, echo, echo, echo, echo,

% 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.

Is this useful for anything? Sure!

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2018-02-07T14:25

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building