1 / 17

Unix Tutorial

Unix Tutorial. Common Directory Commands. ls List directory contents cd {dir} Change working directory to {dir} pwd Print working directory mkdir Make a new directory rmdir {dir} Delete directory {dir}. Example. > cd lab1 > pwd /home/3/yourusername/lab1 > ls

knoton
Download Presentation

Unix Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unix Tutorial The Ohio State University

  2. Common Directory Commands • ls List directory contents • cd {dir} Change working directory to {dir} • pwd Print working directory • mkdir Make a new directory • rmdir {dir} Delete directory {dir} The Ohio State University

  3. Example > cd lab1 > pwd /home/3/yourusername/lab1 > ls a.out first.cpp first.cpp~ > cd > pwd /home/3/yourusername The Ohio State University

  4. Example > cd > pwd /home/3/yourusername > mkdir lab2 > cd lab2 > pwd /home/3/yourusername/lab2 > ls > The Ohio State University

  5. Common File Commands • cp {f1} {f2} Copy file {f1} into {f2} • mv {f1} {f2} Move file {f1} to {f2} • rm {f1} Delete file {f1} • g++ {f1} Compile C++ file {f1} using g++ compiler. The Ohio State University

  6. Example > cd > pwd /home/3/yourusername > mkdir lab2 > cp lab1/first.cpp lab2/second.cpp > cd lab2 > ls second.cpp > The Ohio State University

  7. Example > cd lab2 > ls second.cpp > g++ second.cpp > ls a.out second.cpp > rm a.out > ls second.cpp > The Ohio State University

  8. More File Commands • more {f1} View file {f1} • less {f1} View file {f1} • emacs {f1} Edit file {f1} using emacs • lp –d lj_cl_112_a {f1} Print file {f1} on printer lj_cl_112_a. The Ohio State University

  9. 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. The Ohio State University

  10. 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 The Ohio State University

  11. Example of Background Jobs > jobs [1] + Running emacs first.cpp [2] – Running emacs second.cpp > fg emacs first.cpp <control-Z> Suspended > bg [1] emacs first.cpp & The Ohio State University

  12. emacs Example > emacs first.cpp g++ first.cpp The Ohio State University

  13. emacs Example > emacs first.cpp g++ first.cpp ls The Ohio State University

  14. emacs Example > emacs first.cpp g++ first.cpp ls Why won’t my computer respond? What’s wrong? The Ohio State University

  15. emacs Example > emacs first.cpp g++ first.cpp ls Why won’t my computer respond? What’s wrong? Please help me Mr. Instructor. The Ohio State University

  16. 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 > The Ohio State University

  17. List of Common Unix Commands • ls List directory contents • cd {dir} Change working directory to {dir} • pwd Print working directory • mkdir Make a new directory • rmdir {dir} Delete directory {dir} • cp {f1} {f2} Copy file {f1} into {f2} • mv {f1} {f2} Move file {f1} to {f2} • rm {f1} Delete file {f1} • g++ {f1} Compile C++ file {f1} using g++ compiler • more {f1} View file {f1} • less {f1} View file {f1} • emacs {f1} Edit file {f1} using emacs • lp –d lj_cl_112_a {f1} Print file {f1} on printer lj_cl_112_a • control-C Interrupt a program/command • control-Z Suspend a program • bg Place suspended program in background. • fg Place suspended program in foreground. • jobs List background programs. The Ohio State University

More Related