Introduction to Computer Organization & Systems
100 likes | 127 Views
This comprehensive guide covers the basics of UNIX command line, including file and directory manipulation, process management, killing processes, working with environmental variables, using pipes, and redirection techniques.
Introduction to Computer Organization & Systems
E N D
Presentation Transcript
Introduction to Computer Organization & Systems COMP 21000 Spring 2018 Topics: • UNIX command line • C - everything UNIX/Linux Command Line
Unix • Passwords • Changing • passwd • whoami • finger and the .plan file • Help • about a command • man cmdName • apropos cmdName • which cmdName ;gives path to the application
Unix • Directories • Seeing, manuvering, creating • cd /path/to/new/directory • pwd • ls [-a –l] • mkdir dirName • rmdir dirName • rm –r dirName • pushd . • popd
Unix • Files • Moving, deleting • cp src dest • rm fileName • Viewing • more fileName • cat fileName1 fileName2 • Permissions • ls –l • chmod 777 fileName
Unix • Processes • What’s running? • ps ;only your processes • ps –a ;all processes PID TTY TIME CMD 33129 ttys000 0:00.02 -bash 33178 ttys000 0:00.00 man builtin 33186 ttys000 0:00.00 /usr/bin/less -is 33131 ttys001 0:00.01 -bash 33130 ttys002 0:00.02 –bash
Kill • kill command is used to stop a running process • A user can kill all his process. • A user can not kill another user’s process. • A user can not kill processes System is using. • A root user* can kill System-level-process and the process of any user. * the root is the administrator
Kill • kill -9 pid;kill process pid • other ways to kill • kill by name • pkilla.out;kill all processes named a.out • kill on the command line • ^c ;hold down control key and press the c key ;kills currently running process
More Unix • Shells • Environmental variables (capitalization counts!) • Echo $ENV • $PATH • .bashrc and.bash_profile files • alias • changing $PATH • using source to act on changes to the file • Pipes • using the | operator to connect programs
More Unix • Redirection • using >and>> to redirect stdout to a file • > to overwrite • >> to append • using &> to redirect stdout and stderr to a file gcc –g -o ex1 ex1.c > err.txt &> err.txt • using < to redirect stdin from file • History • the ! operator