2490c197d0d38ab729e25982648da43f.ppt
- Количество слайдов: 17
UNIX TUTORIAL CSE 1222: Unix Intro The Ohio State University 1
Common Directory Commands ls cd {dir} List directory contents Change working directory to {dir} pwd mkdir rmdir {dir} CSE 1222: Unix Intro Print working directory Make a new directory Delete directory {dir} The Ohio State University 2
Example > cd lab 1 > pwd /home/3/yourusername/lab 1 > ls a. out first. cpp~ > cd > pwd /home/3/yourusername CSE 1222: Unix Intro The Ohio State University 3
Example > cd > pwd /home/3/yourusername > mkdir lab 2 > cd lab 2 > pwd /home/3/yourusername/lab 2 > ls > CSE 1222: Unix Intro The Ohio State University 4
Common File Commands cp {f 1} {f 2} mv {f 1} {f 2} rm {f 1} g++ {f 1} Copy file {f 1} into {f 2} Move file {f 1} to {f 2} Delete file {f 1} Compile C++ file {f 1} using g++ compiler. CSE 1222: Unix Intro The Ohio State University 5
Example > cd > pwd /home/3/yourusername > mkdir lab 2 > cp lab 1/first. cpp lab 2/second. cpp > cd lab 2 > ls second. cpp > CSE 1222: Unix Intro The Ohio State University 6
Example > cd lab 2 > ls second. cpp > g++ second. cpp > ls a. out second. cpp > rm a. out > ls second. cpp > CSE 1222: Unix Intro The Ohio State University 7
More File Commands more {f 1} View file {f 1} less {f 1} View file {f 1} emacs {f 1} Edit file {f 1} using emacs lp –d lj_cl_112_a {f 1} Print file {f 1} on printer lj_cl_112_a. CSE 1222: Unix Intro The Ohio State University 8
More Unix Commands control-C Interrupt a program or command control-Z Suspend a program bg Place suspended program in background. fg Place suspended program in foreground. jobs List background programs. CSE 1222: Unix Intro The Ohio State University 9
Example of Background Jobs > emacs first. cpp & [1] 29943 > jobs [1] + Running emacs first. cpp > emacs second. cpp & [2] 29945 > jobs [1] + Running emacs first. cpp [2] – Running emacs second. cpp CSE 1222: Unix Intro The Ohio State University 10
Example of Background Jobs > jobs [1] + Running [2] – Running > fg emacs first. cpp emacs second. cpp
emacs Example > emacs first. cpp g++ first. cpp CSE 1222: Unix Intro The Ohio State University 12
emacs Example > emacs first. cpp g++ first. cpp ls CSE 1222: Unix Intro The Ohio State University 13
emacs Example > emacs first. cpp g++ first. cpp ls Why won’t my computer respond? What’s wrong? CSE 1222: Unix Intro The Ohio State University 14
emacs Example > emacs first. cpp g++ first. cpp ls Why won’t my computer respond? What’s wrong? Please help me Mr. Instructor. CSE 1222: Unix Intro The Ohio State University 15
emacs Example Either: Use the ‘&’ to place the emacs program in background, i. e. : > emacs first. cpp & [1] 29943 > Or: Close the emacs window before issuing any other commands. > emacs first. cpp > CSE 1222: Unix Intro The Ohio State University 16
List of Common Unix Commands ls cd {dir} pwd mkdir rmdir {dir} cp {f 1} {f 2} mv {f 1} {f 2} rm {f 1} g++ {f 1} more {f 1} less {f 1} emacs {f 1} lp –d lj_cl_112_a {f 1} control-C control-Z bg fg jobs CSE 1222: Unix Intro List directory contents Change working directory to {dir} Print working directory Make a new directory Delete directory {dir} Copy file {f 1} into {f 2} Move file {f 1} to {f 2} Delete file {f 1} Compile C++ file {f 1} using g++ compiler View file {f 1} Edit file {f 1} using emacs Print file {f 1} on printer lj_cl_112_a Interrupt a program/command Suspend a program Place suspended program in background. Place suspended program in foreground. List background programs. The Ohio State University 17


